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

/dns in multiaddrs #22

Closed
jbenet opened this issue Sep 16, 2016 · 20 comments
Closed

/dns in multiaddrs #22

jbenet opened this issue Sep 16, 2016 · 20 comments

Comments

@jbenet
Copy link
Member

jbenet commented Sep 16, 2016

There's been some conversation on how to handle DNS, in these issues and others:

Finally looking back at this-- sorry for the delay everyone -- @sivachandran @lgierth @Gaboose and more. I am going to collect the options here and make a decision in coming weeks.

Proposals so far

So far, the proposals are:

Proposal 1: /dns/<domain>/<proto>

# format
/dns/<domain>/<proto> 

# example
/dns/example.com/ip4  --resolves-to-->  /ip4/1.2.3.4

Proposal 2: /dns/<domain>/<record-type>

# format
/dns/<domain>/<record-type> 

# possibilities / examples 
/dns/example.com/A     --resolves-to-->  /ip4/1.2.3.4
/dns/example.com/AAAA  --resolves-to-->  /ip6/1::1
/dns/example.com/CNAME --resolves-to-->  /dns/another.com/*
/dns/example.com/MX    --resolves-to-->  /dns/mail.another.com/* 
/dns/example.com/A     --resolves-to-->  /dns/another.com/A  (through a CNAME)
/dns/example.com/TXT   --resolves-to-->  /ipfs/QmZS2PeM6rtSJXPPSBiqyNRss3M1JpuNAkkQmzEWR7aw1w  (through a dnslink)

Other Questions

  • could we support both proposals?
  • are there other proposals?
  • can we come up with a long list of all the concrete example resolutions we want? (engineer to the use case)
  • maybe (for CNAME, MX, etc) we can return a multiaddr that is "either ip4 or ip6" or a "combination"?
  • what would just /dns/example.com mean? a list or combination? (1 -> many)
@progval
Copy link

progval commented Sep 18, 2016

Other proposal: have both a modified version of proposal 1 (let's call it 1b) and proposal 2.

proposal 1b: /resolution/name/proto

/resolution/name/proto could be resolved to any resolution protocol, eg. DNS.

For instance, /resolution/example.com/ip6 --> /dns/example.com/AAAA --> /ip6/1::1

@progval
Copy link

progval commented Sep 18, 2016

Other issue: how to differentiate “IP over DNS” (it is possible) and “IP over address resolved via DNS”?

Both seem to be represented as /dns/example.org/ip6/127.0.0.1

EDIT: actually, I think the former would be represented as /dns/example.org/ip6/127.0.0.1, but the latter as /dns/example.org/ip6/ip6/127.0.0.1 (prop 1) or /dns/example.org/aaaa/ip6/127.0.0.1 (prop 2)

@progval
Copy link

progval commented Sep 18, 2016

Proposal 3 (to be combined with either 1 or 2): Add address nesting to multiaddr.

This would allow more flexibility in the protocols used for resolution

Example:

/ip4/[/ip4/127.0.0.1/https/dns/example.com/aaaa]/tcp/443    -->    ip4/1.2.3.4/tcp/443
      \                                       /
               this is DNS over HTTPS

@jbenet
Copy link
Member Author

jbenet commented Sep 18, 2016

  • nesting is an interesting idea we've discussed before without resolution.
    There should be a separate issue tracking it.
  • but [ ] are unsafe characters. They may be used in addresses themselves
  • what is /resolution/... ? Looks like you just mean dns.
  • If you somehow mean that the DNS namespace is special/obvious and doesn't
    need to be namespaced under /dns/... I disagree. It's not special or
    obvious.
  • your ordering of https is backwards, https should come at the end
    On Sun, Sep 18, 2016 at 6:56 PM Valentin Lorentz notifications@github.com
    wrote:

Proposal 3 (to be combined with either 1 or 2): Add address nesting to
multiaddr.

This would allow more flexibility in the protocols used for resolution

Example:

ip4/[/https/127.0.0.1/dns/example.com/aaaa]/tcp/443 http://127.0.0.1/dns/example.com/aaaa%5D/tcp/443 --> ip4/1.2.3.4/tcp/443
\ /
this is DNS over HTTPS


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAIcodV1WxJl1qC_QiDCrZYGPxhbCBP1ks5qrRj0gaJpZM4J_bQt
.

@progval
Copy link

progval commented Sep 19, 2016

  • what is /resolution/... ? Looks like you just mean dns.

Any name resolution system. DNS, /etc/hosts, namecoin, ...

  • If you somehow mean that the DNS namespace is special/obvious and doesn't need to be namespaced under /dns/...

I don't

  • your ordering of https is backwards, https should come at the end

fixed

@ghost
Copy link

ghost commented Nov 2, 2016

I'll get to writing up a proposal and code in the next 3 weeks.

@ghost ghost self-assigned this Nov 2, 2016
@ghost
Copy link

ghost commented Dec 19, 2016

/dns in multiaddrs

We had a very productive call about /dns and /tls multiaddrs a while ago, here's the results.
For both /dns and /tls we want to with the simplest options that could possibly work.
These options also must not be in the way of expanding this in the future.

  • Comments on proposal 1:
    • It specifies record types in terms of multiaddr protocols (ip4, ip6) which is GOOD.
    • It has 3 segments. This is not a problem in itself, but complicates implementation and adoption,
      since there's tons of code that just blindly assumes multiaddr protocols always have 2 segments.
  • Comments on proposal 2:
    • Has 3 segments too.
    • Couples multiaddrs to DNS implementation details (record types).
    • Includes unneccessary record types.

The plan

Based on proposal 3 which was brought up in the call.

  • Plain and simple: /dns/example.com
  • Multiaddrs will get Resolve() method which returns a list of resolved multiaddrs,
    e.g. Multiaddr("/dns/example.com/tcp/4001").Resolve() returns
    []string{Multiaddr("/ip4/1.2.3.4/tcp/4001"), Multiaddr("/ip6/1:2:3:4::/tcp/4001")}.
  • Some part within the libp2p stack will decide which of the resolved addresses are usable.
    • Based on which listeners and dialers are available.
    • Based on the Happy Eyeballs algorithm (RFC 6555).
  • The domain name should be subject to go-is-domain,
    which should get regex-based check in addition to the check based on the ICANN TLD list.

We'll tag this new multiaddr protocol as /dns-3 for now, and once it stabilizes promote it to /dns.


In addition to /dns, we could add two more protocols /dns4 and /dns6,
which are explicit about the protocol of the to-be-resolved address, and make
decisions based on listeners/dialers or RFC 6555 unneccessary.


Issues down the road:

  • Can't currently combine round-robin DNS with /ipfs multiaddrs,
    since these contain the PeerID which is unique per host.
    We could do something certificate-chain-like and have the node's key
    signed by the key corresponding to the given PeerID.

Modification to the plan: we've started doing /dns4 and /dns6 instead of /dns. They yield /ip4 or /ip6 addresses respectively, instead of both /ip4 and /ip6. This helps in unambiguously addressing and endpoint.

We're also not doing experimental protocol names, to avoid the mistake of the various X- HTTP headers.

@ghost ghost changed the title Adding DNS to Multiaddr /dns in multiaddrs Dec 19, 2016
ghost pushed a commit that referenced this issue Jan 17, 2017
Also add a fourth column, for comments.

- We'll be using the experimental /dns-exp protocol for now, as per #22. Once we're sure it's right, we'll make it into /dns.
- Same procedure for /relay, where in addition to the semantics, we're not even sure about the name.
- /wss on the other hand is pretty straightforward.
@daviddias
Copy link
Member

Linking ipfs/team-mgmt#102, which has the notes from that discussion: https://hackmd.io/KbAcFYGYEME4AYC0BjALAMwEyI9YjYAjebVARgHZR5x1VoA2C2IA#

ghost pushed a commit that referenced this issue Jan 19, 2017
Also add a fourth column, for comments.

- We'll be using the experimental /dns-exp protocol for now, as per #22. Once we're sure it's right, we'll make it into /dns.
- Same procedure for /relay, where in addition to the semantics, we're not even sure about the name.
- /wss on the other hand is pretty straightforward.
@ghost
Copy link

ghost commented Jan 25, 2017

Modification to the plan: we've started doing /dns4 and /dns6 instead of /dns. They yield /ip4 or /ip6 addresses respectively, instead of both /ip4 and /ip6. This helps in unambiguously addressing and endpoint.

We're also not doing experimental protocol names, to avoid the mistake of the various X- HTTP headers.

@kpcyrd
Copy link

kpcyrd commented Feb 1, 2017

A quick question (as it's probably worth defining this), does /dns respect nsswitch? This way we would get support for /etc/hosts and a bunch of other resolution techniques.

@ghost
Copy link

ghost commented Feb 1, 2017

That'd be an implementation detail, but most will probably just defer to the system for name resolution. In the browser, it defers to the browser and never actually gets to see an /ip4 address.

Thanks, should write down that implementations SHOULD defer to the system, but MAY come up with their own way of resolving names.

@Nemo157
Copy link

Nemo157 commented Feb 15, 2017

I haven't looked through the linked discussions yet, but have SRV records been brought up at all, or is this all based off using A/AAAA records only?

@olizilla
Copy link
Contributor

olizilla commented Nov 9, 2018

Without a /dns protocol in multiaddr it's not possible to convert from a URL with a domain name in it to a multiaddr without DNS requests to determine if it's of type dns4 or dns6. In the browser, I'd like to be able to convert window.location.origin to a multiaddr like:

Multiaddr.fromUrl(window.location.origin) // e.g https://github.com
// /dns/github.com/tcp/443/https ?

Stebalien added a commit to multiformats/go-multiaddr-dns that referenced this issue Jul 9, 2019
Stebalien added a commit to multiformats/go-multiaddr-dns that referenced this issue Jul 9, 2019
Stebalien added a commit to multiformats/go-multiaddr-dns that referenced this issue Jul 9, 2019
@Stebalien
Copy link
Member

Implementation of /dns in go: multiformats/go-multiaddr-dns#17. I did this as we already have to resolve to multiple addresses so this hardly makes the situation any worse. Objections/thoughts?

@ntninja
Copy link
Contributor

ntninja commented Jul 9, 2019

👍

py-multiaddr already encodes it like the other DNS types: https://github.com/multiformats/py-multiaddr/blob/master/multiaddr/protocols.py#L130
py-ipfs-http-client resolves it as such: https://github.com/ipfs/py-ipfs-api/blob/master/ipfshttpclient/http.py#L168-L206 (Yes, this is my fault, but it's part of the API now. 😉)

OT:

  1. What's the binary encoding for DNS addresses? py-multiaddr encodes them as IDNA, but I'm not sure that's interoperable with other implementations?
  2. Could somebody with the required privileges finally rename the py-ipfs-http-client repo?

@Stebalien
Copy link
Member

What's the binary encoding for DNS addresses? py-multiaddr encodes them as IDNA, but I'm not sure that's interoperable with other implementations?

I think the answer is "none". Could you file a new issue for domain name encoding, that's a question we need to answer.

Could somebody with the required privileges finally rename the py-ipfs-http-client repo?

Done (please bug me on #ipfs-dev if something like that falls through the cracks).

@Stebalien
Copy link
Member

Stebalien commented Jul 9, 2019

Also, it looks like the "dns4 and dns6 only" resolution was just a go thing. JS also supports dns.

@ntninja
Copy link
Contributor

ntninja commented Jul 9, 2019

What's the binary encoding for DNS addresses? py-multiaddr encodes them as IDNA, but I'm not sure that's interoperable with other implementations?

I think the answer is "none". Could you file a new issue for domain name encoding, that's a question we need to answer.

Will do this.

Could somebody with the required privileges finally rename the py-ipfs-http-client repo?

Done (please bug me on #ipfs-dev if something like that falls through the cracks).

Will remember that in the future. Thanks for finally fixing this!

@ntninja
Copy link
Contributor

ntninja commented Aug 11, 2019

see #100 for a spec fix

Stebalien added a commit to multiformats/go-multiaddr that referenced this issue Sep 19, 2019
This is a defacto standard and is used by js-libp2p.

Ported from multiformats/go-multiaddr-dns#17.
This was decided in multiformats/multiaddr#22.
Stebalien added a commit to multiformats/go-multiaddr-dns that referenced this issue Sep 19, 2019
@Ericson2314
Copy link

I haven't looked through the linked discussions yet, but have SRV records been brought up at all, or is this all based off using A/AAAA records only?

I too am interested in SRV records. Are records besides A and AAAA decidedly out of scope, or just deemed lower priority and left for the future with the "proposal 3" that was chosen above and since implemented?

Jorropo pushed a commit to Jorropo/multiaddr that referenced this issue Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants