
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@multiformats/dns
Advanced tools
Resolve DNS queries with browser fallback
Query DNS records using node:dns
, DNS over HTTP and/or DNSJSON over HTTP.
A list of publicly accessible servers can be found here.
import { dns } from '@multiformats/dns'
const resolver = dns()
// resolve A records with a 5s timeout
const result = await dns.query('google.com', {
signal: AbortSignal.timeout(5000)
})
import { dns } from '@multiformats/dns'
import { dnsJsonOverHttps } from '@multiformats/dns/resolvers'
const resolver = dns({
resolvers: {
// will only be used to resolve `.com` addresses
'com.': dnsJsonOverHttps('https://cloudflare-dns.com/dns-query'),
// this can also be an array, resolvers will be shuffled and tried in
// series
'net.': [
dnsJsonOverHttps('https://dns.google/resolve'),
dnsJsonOverHttps('https://dns.pub/dns-query')
],
// will only be used to resolve all other addresses
'.': dnsJsonOverHttps('https://dnsforge.de/dns-query'),
}
})
import { dns, RecordType } from '@multiformats/dns'
const resolver = dns()
// resolve only TXT records
const result = await dns.query('google.com', {
types: [
RecordType.TXT
]
})
Individual Aanswers are cached so. If you make a request, for which all record types are cached, all values will be pulled from the cache.
If any of the record types are not cached, a new request will be resolved as if none of the records were cached, and the cache will be updated to include the new results.
import { dns, RecordType } from '@multiformats/dns'
const resolver = dns()
// do not used cached results, always resolve a new query
const result = await dns.query('google.com', {
cached: false
})
$ npm i @multiformats/dns
<script>
tagLoading this module through a script tag will make its exports available as MultiformatsDns
in the global namespace.
<script src="https://unpkg.com/@multiformats/dns/dist/index.min.js"></script>
Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
FAQs
Resolve DNS queries with browser fallback
We found that @multiformats/dns demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.