Coder Social home page Coder Social logo

hyper-dns's Introduction

hyper-dns

Advanced resolving of decentralized web links using different name systems such as DNS Txt entries and .well-known https lookups locations. It implements various naming systems such as dat, hyper and cabal but is extensible to support other systems as well.

πŸš€ Basic API

After installing it through npm, you can simply run it like this:

const { resolveProtocol, resolve, resolveURL } = require('hyper-dns')
const protocol = 'dat'
const domain = 'dat-ecosystem.org'
const key = await resolveProtocol(protocol, domain)

Note: You may need to wrap it in a async function until top level async/await lands.

That's it! πŸŽ‰ - in the key variable you will get the dat key or null, if it can't be found.

πŸ§™β€β™€οΈ What is this magic?

Different decentralized web systems have different means to resolve "names" to a decentralized document.

hyper-dns contains a variety of implementations. Many are using DNS TXT records that contain a key of specified pattern, but other means are possible as well. βˆ’ (more in the Protocol Guide)

The power of hyper-dns in comparison to other, protocol-specific implementations is that it has a shared cache for all protocols, it works in he browser and does a list of things well. βˆ’ (more in the Architecture Overview)

πŸ‘©β€πŸŽ“ Further reading

πŸ“œ License

MIT License

hyper-dns's People

Contributors

jwerle avatar martinheidegger avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

hyper-dns's Issues

Remove sqlite3 from default import

It's been really hard to get stuff working cross platform while better-sqlite3 is in the dependency tree since it doesn't have prebuilds the way other native dependencies in the hyper stack do.

It'd be nice if this dependency could be marked as optional or opt-in to unblock development.

Turn multiple lookups into async iterator

Currently the lookup of dns entries (.resolve) for multiple protocols uses one async handler.

As the various protocols may resolve at different speeds, it may be a good idea to turn this into an asynchronous iterator that servers each protocol as they resolve, with an automatic abort.

Add Command line API

It would be nice to have a good command line API that functions pretty simply like:

$ hyper-dns hyper://datproject.org
{
  "hyper": "ab123c...404eff"
}

etc.

Considering #4, it may be good (optionally?) return a JSON stream instead of an object, as the results may "trickle" in.

Considering #3, it may be good to optionally start a hyper-dns compatible lookup server?

hyper-dns lookup server

When looking-up dns-entries-over-https (DOH) we are running into the issue that we have to trust the servers, which are hosted by google/cloudflare at the moment as they can handle any load (more servers can be found here - though they may not support json).

With this in mind I am wondering to "offload" the name lookup for decentralized names to a federated service that behaves equally but reduces complexity by doing things like the .well-known lookups, conflict resolution (multiple entries) and decentralized lookups (etherns, ...).

This way we can serve the same (possibly better) performance than we can get with a simple DoH lookup, while at the same time supporting decentralization.

Document flushing of (SQLite) cache

Currently the SQLite cache can be flushed only manually. This behavior (and the apis) needs to be documented!

async clear () {
await lru.clear()
run(Q_CLEAR, {})
},
async clearName (name) {
await lru.clearName(name)
run(Q_CLEAR_NAME, { name })
},
async close () {
if (db !== null && db.open) {
db.close()
db = null
}
},
async flush (timestamp) {
timestamp = typeof timestamp === 'number' ? timestamp : Date.now()
await lru.flush(timestamp)
run(Q_FLUSH, { now: timestamp })
},

Document DNS-over-HTTPS configuration recommendations

DNS-over-HTTPS uses google/cloudflare servers by default, which is important to note if you offer the dns-over-https option to users. They may want to configure that. There should also be a information on where to get other servers (https://dnscrypt.info/public-servers/) Additionally windows 10 supports the setup of dns-over-https on a system level (and it should probably be using the system's dns in that case) and there are system add-ons for linux. This means it needs to be possible to disable the dns-over-https on those systems.

Add "hyper-dns in 2 mins" section

The readme needs to explain the basics of hyperdns and the most important implications of using hyperdns in the browser / in node.

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.