started browser code

This commit is contained in:
AJ ONeal 2017-02-01 21:57:40 -07:00
parent 2f87cd3797
commit fb55be240d
4 changed files with 48 additions and 8 deletions

17
browser.js Normal file
View File

@ -0,0 +1,17 @@
;(function () {
'use strict';
var dnsjs = window.DNSPacket;
// I got the test data by running this in the node console:
// JSON.stringify(fs.readFileSync('./test/fixtures/www.google.com.a.bin', null))
var arr = [
191,164,129,128,0,1,0,5,0,0,0,0,3,119,119,119,6,103,111,111,103,108,101,3,99
,111,109,0,0,1,0,1,192,12,0,1,0,1,0,0,0,29,0,4,74,125,239,112,192,12,0,1,0,1,0
,0,0,29,0,4,74,125,239,116,192,12,0,1,0,1,0,0,0,29,0,4,74,125,239,113,192,12,0
,1,0,1,0,0,0,29,0,4,74,125,239,115,192,12,0,1,0,1,0,0,0,29,0,4,74,125,239,114
];
var ab = Uint8Array.from(arr).buffer;
var result = dnsjs.parse(ab);
console.log(result);
}());

View File

@ -1,7 +1,30 @@
<!-- <!DOCTYPE html>
<html>
<body>
<!--
This demo is meant to have 3 feilds that accept base-64, hex and array values the user This demo is meant to have 3 feilds that accept base-64, hex and array values the user
can copy in, and a button that will call the dns parser to parse the input and display can copy in, and a button that will call the dns parser to parse the input and display
the output in a seperate field. the output in a seperate field.
--> -->
<!-- run `serve-https` to test at https://localhost.daplie.me:8443/demo.html -->
<!-- put form here -->
<!-- I added some of the library files for you -->
<script src="./dns.types.js"></script>
<script src="./dns.classes.js"></script>
<script src="./dns.type.a.js"></script>
<script src="./dns.rdata.parse.js"></script>
<script src="./dns.unpack-labels.js"></script>
<script src="./dns.parser.js"></script>
<script src="./dns.packer.js"></script>
<script src="./dns.js"></script>
<!-- put jquery here -->
<!-- application code in here -->
<script src="./browser.js"></script>
</body>
</html>

View File

@ -1,7 +1,7 @@
(function (exports) { (function (exports) {
'use strict'; 'use strict';
var pdns = module.exports.DNS_PACK = function () { var pdns = exports.DNS_PACK = function () {
}; };

View File

@ -1,7 +1,7 @@
;(function (exports) { ;(function (exports) {
'use strict'; 'use strict';
var pdns = module.exports.DNS_PARSER = {}; var pdns = exports.DNS_PARSER = {};
var classes = exports.DNS_CLASSES || require('./dns.classes.js').DNS_CLASSES; var classes = exports.DNS_CLASSES || require('./dns.classes.js').DNS_CLASSES;
var types = exports.DNS_TYPES || require('./dns.types.js').DNS_TYPES; var types = exports.DNS_TYPES || require('./dns.types.js').DNS_TYPES;