Documentation ¶
Index ¶
Constants ¶
const ( // Deprecated: use ma.P_DNS P_DNS = ma.P_DNS // Deprecated: use ma.P_DNS4 P_DNS4 = ma.P_DNS4 // Deprecated: use ma.P_DNS6 P_DNS6 = ma.P_DNS6 // Deprecated: use ma.P_DNSADDR P_DNSADDR = ma.P_DNSADDR )
Extracted from source of truth for multicodec codes: https://github.com/multiformats/multicodec
Variables ¶
var DefaultResolver = &Resolver{def: net.DefaultResolver}
var Dns4Protocol = ma.ProtocolWithCode(P_DNS4)
Deprecated: use ma.ProtocolWithCode(P_DNS4)
var Dns6Protocol = ma.ProtocolWithCode(P_DNS6)
Deprecated: use ma.ProtocolWithCode(P_DNS6)
var DnsProtocol = ma.ProtocolWithCode(P_DNS)
Deprecated: use ma.ProtocolWithCode(P_DNS)
var DnsaddrProtocol = ma.ProtocolWithCode(P_DNSADDR)
Deprecated: use ma.ProtocolWithCode(P_DNSADDR)
var ResolvableProtocols = []ma.Protocol{DnsaddrProtocol, Dns4Protocol, Dns6Protocol, DnsProtocol}
Functions ¶
Types ¶
type BasicResolver ¶ added in v0.3.0
type BasicResolver interface { LookupIPAddr(context.Context, string) ([]net.IPAddr, error) LookupTXT(context.Context, string) ([]string, error) }
BasicResolver is a low level interface for DNS resolution
type MockResolver ¶ added in v0.3.0
func (*MockResolver) LookupIPAddr ¶ added in v0.3.0
type Option ¶ added in v0.3.0
func WithDefaultResolver ¶ added in v0.3.0
func WithDefaultResolver(def BasicResolver) Option
WithDefaultResolver is an option that specifies the default basic resolver, which resolves any TLD that doesn't have a custom resolver. Defaults to net.DefaultResolver
func WithDomainResolver ¶ added in v0.3.0
func WithDomainResolver(domain string, rslv BasicResolver) Option
WithDomainResolver specifies a custom resolver for a domain/TLD. Custom resolver selection matches domains left to right, with more specific resolvers superseding generic ones.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver is an object capable of resolving dns multiaddrs by using one or more BasicResolvers; it supports custom per domain/TLD resolvers. It also implements the BasicResolver interface so that it can act as a custom per domain/TLD resolver.
func NewResolver ¶ added in v0.3.0
NewResolver creates a new Resolver instance with the specified options