| 
									
										
										
										
											2017-02-16 15:52:07 -07:00
										 |  |  | (function (exports) { | 
					
						
							|  |  |  | 'use strict'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // An 'A' record is a 32-bit value representing the IP address
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | exports.DNS_PACKER_TYPE_A = function (ab, dv, total, record) { | 
					
						
							|  |  |  |   if (!record.address) { | 
					
						
							|  |  |  |     throw new Error("no address on A record"); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-16 16:29:23 -07:00
										 |  |  |   // RDLENGTH
 | 
					
						
							| 
									
										
										
										
											2017-02-17 15:14:14 -07:00
										 |  |  |   var IP_LEN = 4; | 
					
						
							|  |  |  |   dv.setUint16(total, IP_LEN, false); | 
					
						
							| 
									
										
										
										
											2017-02-16 16:29:23 -07:00
										 |  |  |   total += 2; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // RDATA
 | 
					
						
							| 
									
										
										
										
											2017-02-16 15:52:07 -07:00
										 |  |  |   // i.e. 127.0.0.1 => 0x7F, 0x00, 0x00, 0x01
 | 
					
						
							|  |  |  |   record.address.split('.').forEach(function (octet) { | 
					
						
							|  |  |  |     dv.setUint8(total, parseInt(octet, 10), false); | 
					
						
							|  |  |  |     total += 1; | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return total; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }('undefined' !== typeof window ? window : exports)); |