multiformats / go-multiaddr-dns Goto Github PK
View Code? Open in Web Editor NEWGo library and CLI tool for /dns4, /dns6, /dnsaddr multiaddr resolution
Home Page: https://multiformats.io/multiaddr
License: MIT License
Go library and CLI tool for /dns4, /dns6, /dnsaddr multiaddr resolution
Home Page: https://multiformats.io/multiaddr
License: MIT License
IIRC, normally the code will use the default net.DefaultResolver
and has no caching layer.
The code for dnsaddr
is not consistent.
dnsaddr
but has a dns
at code 53.Can someone please clarify! cc: @diasdavid @whyrusleeping
The -p
on the CLI filters results by protocol stack. Not sure yet what the interface around Resolve()
should be.
> madns -p /ip6/tcp/wss /dnsaddr/example.net
/ip6/2001:db8::a3/tcp/443/wss/ipfs/Qmfoo
/ip6/2001:db8::a4/tcp/443/wss/ipfs/Qmbar
It seems that this library supports /dns4
and /dns6
but does not support /dns
Given that
/dns/
i think we should add it here as well.
Reuse prior art from https://en.wikipedia.org/wiki/Happy_Eyeballs ?
Should be able to:
When DNS over HTTPS resolver is set up, every query produces HTTP request.
To illustrate, when using https://resolver.cloudflare-eth.com/dns-query
for crypto
TLDs, this adds around 1 second to EVERY resolution event (only the very first one should be that slow):
$ t ipfs name resolve /ipns/brave.crypto
/ipfs/QmWrdNJWMbvRxxzLhojVKaBDswS4KNVM7LvjsN7QbDrvka
0.25s user 0.03s system 21% cpu 1.274 total
$ t ipfs name resolve /ipns/brave.crypto /ipfs/QmWrdNJWMbvRxxzLhojVKaBDswS4KNVM7LvjsN7QbDrvka
0.21s user 0.02s system 20% cpu 1.100 total
$ t ipfs name resolve /ipns/brave.crypto
/ipfs/QmWrdNJWMbvRxxzLhojVKaBDswS4KNVM7LvjsN7QbDrvka
0.23s user 0.02s system 23% cpu 1.058 total
To illustrate, using non-DoH name leverages OS-level resolver as a cache, and only first lookup is expensive:
$ t ipfs name resolve /ipns/en.wikipedia-on-ipfs.org
/ipfs/bafybeiaysi4s6lnjev27ln5icwm6tueaw2vdykrtjkwiphwekaywqhcjze
0.23s user 0.05s system 80% cpu 0.343 total
$ t ipfs name resolve /ipns/en.wikipedia-on-ipfs.org /ipfs/bafybeiaysi4s6lnjev27ln5icwm6tueaw2vdykrtjkwiphwekaywqhcjze
0.04s user 0.01s system 173% cpu 0.029 total
$ t ipfs name resolve /ipns/en.wikipedia-on-ipfs.org /ipfs/bafybeiaysi4s6lnjev27ln5icwm6tueaw2vdykrtjkwiphwekaywqhcjze
0.03s user 0.02s system 160% cpu 0.032 total
The problem is not limited to DoH โ there is no point in hitting OS-level default resolver if we could use cached record.
We need to add a global DNS Cache to resolve.go
that makes sure we don't do redundant lookups until TTL from resolved record expires.
cc @aschmahmann @vyzo what would be the least painful way to solve this globally?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.