Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipv6 adaptation #7

Open
esmiwuals2 opened this issue Nov 16, 2021 · 3 comments
Open

ipv6 adaptation #7

esmiwuals2 opened this issue Nov 16, 2021 · 3 comments

Comments

@esmiwuals2
Copy link

$>node scripts/printzone.js
/root/handout/node_modules/bns/lib/internal/scan.js:1857
throw item.error;
^

ParseError: invalid ipv4: "2600:8805:7f80:200:442d:a26f:c212:51ca" (string) at line: 0:65.

@pinheadmz
Copy link
Owner

Sorry ipv6 isn't supported yet, wanna open a PR?

@esmiwuals2
Copy link
Author

any hints?

@pinheadmz
Copy link
Owner

Hm you probably will need to encode the ipv6 address for the SSL cert. I'm doing it in a really hacky way currently:

// hex-encode IP address
let ipaddr = '';
const bytes = host.split('.');
for (const byte of bytes)
ipaddr += Buffer.from([parseInt(byte)]).toString('hex');

data gets inserted into ssl cert here:

extnValue: [
{ type: 'DNSName', node: name },
{ type: 'DNSName', node: `*.${name}` },
{ type: 'IPAddress', node: ipaddr }

you might want to import bcoin-org/binet and parse the IPv6 address correctly:

https://github.com/bcoin-org/binet/blob/d3decfb7a7257abdfb03c3a9c091499b2ebff0e1/lib/ip.js#L405

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants