std/dns
On this page
Index
- type
Mx - type
Srv - type
Resolver- method
Resolver.lookup_mx - method
Resolver.lookup_txt - method
Resolver.lookup_srv - method
Resolver.lookup_addr
- method
- fn
lookup_mx - fn
lookup_txt - fn
lookup_srv - fn
lookup_addr
Types
Mx
struct Mx {
host: Str
pref: Int
}A mail exchanger (Go’s net.MX): its host, rooted (“mx1.example.com.”), and its preference (lower first).
Srv
struct Srv {
target: Str
port: Int
priority: Int
weight: Int
}A service location (Go’s net.SRV): the target host (rooted), its port, priority (lower first) and weight (a share within one priority).
Resolver
struct Resolver {
server: Str = ""
}Where lookups go: server "" asks the system’s servers (resolv.conf
on Linux and macOS), else only that server, “host:port” with a numeric
host (“127.0.0.1:5353”), as Go’s Resolver with its own Dial.
Resolver.lookup_mx
fn (r: Resolver) lookup_mx(n: Net, name: Str) -> List[Mx] ! NetErr uses net.dialResolver.lookup_txt
fn (r: Resolver) lookup_txt(n: Net, name: Str) -> List[Str] ! NetErr uses net.dialResolver.lookup_srv
fn (r: Resolver) lookup_srv(n: Net, service: Str, proto: Str, name: Str) -> List[Srv] ! NetErr uses net.dialResolver.lookup_addr
fn (r: Resolver) lookup_addr(n: Net, ip: Str) -> List[Str] ! NetErr uses net.dialFunctions
lookup_mx
fn lookup_mx(n: Net, name: Str) -> List[Mx] ! NetErr uses net.dialThe MX records of name, by preference (equal ones shuffled, as Go’s). Records whose host is not a domain name are left out; Err when every record is (Go returns both).
lookup_txt
fn lookup_txt(n: Net, name: Str) -> List[Str] ! NetErr uses net.dialThe TXT records of name, each record’s strings joined (Go’s LookupTXT); a record that is not UTF-8 is left out, Err when all are.
lookup_srv
fn lookup_srv(n: Net, service: Str, proto: Str, name: Str) -> List[Srv] ! NetErr uses net.dialThe SRV records of _service._proto.name (name alone when service and
proto are both “”), by priority, shuffled by weight within one (RFC
2782, Go’s). Records with a target that is not a domain name are left
out; Err when every record is.
lookup_addr
fn lookup_addr(n: Net, ip: Str) -> List[Str] ! NetErr uses net.dialThe names of the address ip (PTR records of its in-addr.arpa or ip6.arpa name), rooted; /etc/hosts first, as Go’s LookupAddr.
↑ index