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

add icann.dns to meta-TLD #67

Closed
wants to merge 7 commits into from

Conversation

wemeetagain
Copy link
Member

added icann.dns support to the http server
returns dns response json

added icann.dns support to the http server
returns dns response json
authority: []
additional: []
edns_options: []
payload: undefined}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's potentially dangerous to do it this way, since the format could change in the future if native-dns gets updated. If you need to create a new empty packet, then just create an instance of the class that already exists (i.e. in your resolve: method). For oldDNSLookup: you should just keep and use the parameter that was passed in.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this felt a little gross. Problem is, while we can copy the resultant packet from the request in oldDNSLookup (and replace this line) there are no packets to copy from in resolve; it creates a new packet where there was only a 'path' string before.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem is, while we can copy the resultant packet from the request in oldDNSLookup (and replace this line)

So do it. 👍 (Unless there's a reason not to...?)

there are no packets to copy from in resolve; it creates a new packet where there was only a 'path' string before.

Did you have a look at this giant comment above callback:?

It explains the way native-dns works, and where to look for classes and whatnot. But I'm pretty sure you know that since you wrote:

# fields from: https://github.com/tjfontaine/native-dns-packet

So then you should know that you can simply:

req = new require('native-dns-packet')()

(Except I wouldn't do it with an inline require like that.)

@taoeffect
Copy link
Member

Good job @wemeetagain! See my review above.

I tested it and it seems to be working correctly. Some changes probably need to be made as per the review (and some questions need answering).

Also, can you add the ability to specify the record type? The reason is that by default this just returns A records. We can probably do that by using a GET parameter type. So GET /okturtles.org?type=ANY, etc.

@oldDNSLookup req, res
@oldDNSLookup req, (packet, code) ->
_.assign res, _.pick packet, ['edns_version', 'edns_options',
'edns', 'answer', 'authority', 'additional']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're copying over a list of properties from packet, the output of oldDNSLookup with the answers, into res, the packet with the proper _socket that was passed into callback.

Sorry, I guess I wasn't clear enough: this is already done in on 'message'. DRY.

This should be done once only, somewhere, whether here or elsewhere. One has to go.

@taoeffect
Copy link
Member

@wemeetagain OK, review done!

@@ -43,6 +43,7 @@
"lodash": "~2.4.1",
"lodash-contrib": "^241.4.14",
"native-dns": "git+https://github.com/okTurtles/node-dns.git#08433ec98f517eed3c6d5e47bdf62603539cd402",
"native-dns-packet": "^0.1.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use precise versioning (remove the ^). See #78.

@taoeffect
Copy link
Member

@wemeetagain Can you rebase your stuff off the latest master and git push -f it to this branch?

@wemeetagain wemeetagain deleted the icann.dns branch December 12, 2014 03:59
@wemeetagain wemeetagain restored the icann.dns branch December 12, 2014 04:21
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

Successfully merging this pull request may close these issues.

2 participants