Giter Club home page Giter Club logo

go-multiaddr-dns's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-multiaddr-dns's Issues

Add DNS Cache that respects TTL of resolved DNS records

Problem

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

Solution

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?

End-to-end and CLI tests

Should be able to:

  • plug in a local DNS server/resolver
  • can use a different madns executable (e.g. js?)

Filtering by protocol stack

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.