io.systemd.Resolve¶
| Property | Value |
|---|---|
| Go package | github.com/rossedman/sdvarlink/systemd/latest/resolve |
| Socket | /run/systemd/resolve/io.systemd.Resolve |
| Available since | systemd v257 |
| Methods · types · errors | 6 · 17 · 21 |
Methods¶
ResolveHostname¶
Resolves a hostname to one or more IP addresses.
func (c *Client) ResolveHostname(ctx context.Context, in ResolveHostnameIn) (*ResolveHostnameOut, error)
Parameters
| Field | Type | Description |
|---|---|---|
ifindex |
?int |
The Linux interface index for the network interface to search on. Typically left unspecified, in order to search on all interfaces. |
name |
string |
The host name to resolve. |
family |
?int |
The address family to search for, one of AF_INET or AF_INET6. |
flags |
?int |
Various search flags. |
Reply
| Field | Type | Description |
|---|---|---|
addresses |
[]ResolvedAddress |
Array of resolved IP addresses |
name |
string |
Canonical name of the host. |
flags |
int |
Various flags indicating details on discovered data. |
ResolveAddress¶
Resolves an IP address to a hostname.
func (c *Client) ResolveAddress(ctx context.Context, in ResolveAddressIn) (*ResolveAddressOut, error)
Parameters
| Field | Type | Description |
|---|---|---|
ifindex |
?int |
The Linux interface index for the network interface to search on. Typically left unspecified, in order to search on all interfaces. |
family |
int |
The address family of the specified address, one of AF_INET or AF_INET6. |
address |
[]int |
The IP address to look up, either 4 or 16 integers (depending if an AF_INET or AF_INET6 address shall be resolved). |
flags |
?int |
Reply
| Field | Type | Description |
|---|---|---|
names |
[]ResolvedName |
|
flags |
int |
ResolveService¶
Resolves a named DNS-SD or unnamed simple SRV service.
func (c *Client) ResolveService(ctx context.Context, in ResolveServiceIn) (*ResolveServiceOut, error)
Parameters
| Field | Type | Description |
|---|---|---|
name |
?string |
|
type |
?string |
|
domain |
string |
|
ifindex |
?int |
|
family |
?int |
|
flags |
?int |
Reply
| Field | Type | Description |
|---|---|---|
services |
[]ResolvedService |
|
txt |
?[]string |
|
canonical |
ResolvedCanonical |
|
flags |
int |
ResolveRecord¶
Resolves a domain name to one or more DNS resource records.
Parameters
| Field | Type | Description |
|---|---|---|
ifindex |
?int |
|
name |
string |
|
class |
?int |
|
type |
int |
|
flags |
?int |
Reply
| Field | Type | Description |
|---|---|---|
rrs |
[]ResolvedRecord |
|
flags |
int |
BrowseServices¶
streaming (requires more) · since v258
Starts browsing for DNS-SD services of specified type.
func (c *Client) BrowseServices(ctx context.Context, in BrowseServicesIn) iter.Seq2[*BrowseServicesOut, error]
Parameters
| Field | Type | Description |
|---|---|---|
domain |
?string |
The domain to browse for services. If null, the default browsing domain local is used. |
type |
?string |
The service type to browse for (e.g., '_http._tcp'). |
ifindex |
?int |
The Linux interface index for the network interface to search on. |
flags |
?int |
Various browsing flags to modify the operation. |
Reply
| Field | Type | Description |
|---|---|---|
browserServiceData |
[]ServiceData |
An array of service data containing information about discovered services. |
DumpDNSConfiguration¶
since v260
Current global and per-link DNS configurations.
Reply
| Field | Type | Description |
|---|---|---|
configuration |
[]DNSConfiguration |
The current global and per-interface DNS configurations |
Types¶
DNSProtocol¶
The type of protocol.
| Value | Description |
|---|---|
dns |
DNS |
mdns |
Multicast DNS |
llmnr |
LLMNR |
DNSOverTLSMode¶
The mode of DNSOverTLS.
| Value | Description |
|---|---|
no |
DNSOverTLS is disabled. |
yes |
DNSOverTLS is enabled. |
opportunistic |
Try to use DNSOverTLS, but disabled when the server does not support it. |
ResolveSupport¶
Whether the protocol is enabled.
| Value | Description |
|---|---|
no |
The protocol is disabled. |
yes |
The protocol is enabled. |
resolve |
The protocol is used only for resolving. |
ResolvConfMode¶
The management mode of /etc/resolve.conf file.
| Value | Description |
|---|---|
uplink |
/etc/resolv.conf is a symbolic link to /run/systemd/resolve/resolv.conf. |
stub |
/etc/resolv.conf is a symbolic link to /run/systemd/resolve/stub-resolv.conf. |
static |
/etc/resolv.conf is a symbolic link to /usr/lib/systemd/resolv.conf. |
missing |
/etc/resolv.conf does not exist. |
foreign |
/etc/resolv.conf is not managed by systemd-resolved. |
BrowseServiceUpdateFlag¶
Describes the update flag for browsing services, indicating whether a service was added or removed during browsing.
| Value | Description |
|---|---|
added |
Indicates that the service was added. |
removed |
Indicates that the service was removed. |
ResolvedAddress¶
Encapsulates a resolved address.
| Field | Type | Description |
|---|---|---|
ifindex |
?int |
|
family |
int |
|
address |
[]int |
ResolvedName¶
Encapsulates a resolved host name.
| Field | Type | Description |
|---|---|---|
ifindex |
?int |
|
name |
string |
ResolvedService¶
Encapsulates resolved service information.
| Field | Type | Description |
|---|---|---|
priority |
int |
|
weight |
int |
|
port |
int |
|
hostname |
string |
|
canonicalName |
?string |
|
addresses |
?[]ResolvedAddress |
ResolvedCanonical¶
Encapsulates the canonical name, type and domain of a DNS-SD or simple SRV service. Note that due to CNAME redirections and similar, a named DNS-SD service might resolve to a canonical service that is an unnamed simple SRV service. Or in other words: resolving a named service might return an unnamed canonical service.
| Field | Type | Description |
|---|---|---|
name |
?string |
The DNS-SD name of the service. For simple SRV services this field is absent or null. |
type |
string |
|
domain |
string |
ResourceKey¶
The 'key' part of a DNS resource record.
| Field | Type | Description |
|---|---|---|
class |
?int |
The RR class, almost always IN, i.e 0x01. If unspecified defaults to IN. |
type |
int |
The RR types, one of A, AAAA, PTR, … |
name |
string |
The domain name. |
ResourceRecord¶
A full DNS resource record..
| Field | Type | Description |
|---|---|---|
key |
ResourceKey |
|
priority |
?int |
|
weight |
?int |
|
port |
?int |
|
name |
?string |
|
cpu |
?string |
|
os |
?string |
|
items |
?[]string |
|
address |
?[]int |
|
mname |
?string |
|
rname |
?string |
|
serial |
?int |
|
refresh |
?int |
|
expire |
?int |
|
minimum |
?int |
|
exchange |
?string |
|
version |
?int |
|
size |
?int |
|
horiz_pre |
?int |
|
vert_pre |
?int |
|
latitude |
?int |
|
longitude |
?int |
|
altitude |
?int |
|
keyTag |
?int |
|
algorithm |
?int |
|
digestType |
?int |
|
digest |
?string |
|
fptype |
?int |
|
fingerprint |
?string |
|
flags |
?int |
|
protocol |
?int |
|
dnskey |
?string |
|
signer |
?string |
|
typeCovered |
?int |
|
labels |
?int |
|
originalTtl |
?int |
|
expiration |
?int |
|
inception |
?int |
|
signature |
?string |
|
nextDomain |
?string |
|
types |
?[]int |
|
iterations |
?int |
|
salt |
?string |
|
hash |
?string |
|
certUsage |
?int |
|
selector |
?int |
|
matchingType |
?int |
|
data |
?string |
|
tag |
?string |
|
value |
?string |
|
target |
?string |
|
svcparams |
?object |
|
order |
?int |
|
preference |
?int |
|
naptrFlags |
?string |
|
services |
?string |
|
regexp |
?string |
|
replacement |
?string |
ResolvedRecord¶
Encapsulates information about a resolved DNS resource record
| Field | Type | Description |
|---|---|---|
ifindex |
?int |
|
rr |
?ResourceRecord |
|
raw |
string |
ServiceData¶
Encapsulates the service data obtained from browsing.
| Field | Type | Description |
|---|---|---|
updateFlag |
BrowseServiceUpdateFlag |
|
family |
int |
The address family of the service, one of AF_INET or AF_INET6. |
name |
?string |
The name of the service, e.g., 'My Service'. May be null if not specified. |
type |
string |
The type of service, e.g., '_http._tcp'. |
domain |
string |
The domain in which the service resides, e.g., 'local'. |
ifindex |
int |
The Linux interface index for the network interface associated with this service. |
DNSServer¶
Encapsulates a DNS server address specification.
| Field | Type | Description |
|---|---|---|
address |
[]int |
IPv4 or IPv6 address of the server. |
addressString |
?string |
IPv4 or IPv6 address of the server, formatted as a human-readable string. |
family |
int |
Address family of the server, one of AF_INET or AF_INET6. |
port |
int |
Port number of the server. |
ifindex |
?int |
Interface index for which this server is configured. |
name |
?string |
Server Name Indication (SNI) of the server. |
accessible |
bool |
Indicates if the DNS server is accessible or not. |
SearchDomain¶
Encapsulates a search domain specification.
| Field | Type | Description |
|---|---|---|
name |
string |
Domain name. |
routeOnly |
bool |
Indicates whether or not this is a routing-only domain. |
ifindex |
?int |
Interface index for which this search domain is configured. |
DNSConfiguration¶
Encapsulates a global or per-link DNS configuration, including configured DNS servers, search domains, and more.
| Field | Type | Description |
|---|---|---|
ifname |
?string |
Interface name, if any, associated with this configuration. Empty for global configuration. |
ifindex |
?int |
Interface index, if any, associated with this configuration. Empty for global configuration. |
delegate |
?string |
Delegate name, if any, associated with this configuration. Empty for global or link configurations. |
defaultRoute |
?bool |
Indicates whether or not this link's DNS servers will be used for resolving domain names that do not match any link's configured domains. |
currentServer |
?DNSServer |
DNS server currently selected to use for lookups. |
servers |
?[]DNSServer |
Array of configured DNS servers. |
fallbackServers |
?[]DNSServer |
Array of configured fallback DNS servers, set for global configuration only. |
searchDomains |
?[]SearchDomain |
Array of configured search domains. |
negativeTrustAnchors |
?[]string |
Array of configured DNSSEC negative trust anchors. |
dnssec |
?string |
DNSSEC mode. |
dnssecSupported |
?bool |
Indicates if the current DNS server supports DNSSEC. Always false if DNSSEC mode is "no". |
dnsOverTLS |
?DNSOverTLSMode |
DNSOverTLS mode. |
llmnr |
?string |
LLMNR support. |
mDNS |
?ResolveSupport |
mDNS support. |
resolvConfMode |
?ResolvConfMode |
resolv.conf mode, set for global configuration only. |
scopes |
?[]DNSScope |
Array of current DNS scopes. |
DNSScope¶
Encapsulates a DNS scope specification.
| Field | Type | Description |
|---|---|---|
protocol |
DNSProtocol |
Protocol associated with this scope. |
family |
?int |
Address family associated with this scope. |
ifindex |
?int |
Interface index associated with this scope. |
ifname |
?string |
Interface name associated with this scope. |
dnssec |
?string |
DNSSEC mode associated with this scope. |
dnsOverTLS |
?DNSOverTLSMode |
DNSOverTLS mode associated with this scope. |
Errors¶
| Error | Go type | Description |
|---|---|---|
NoNameServers |
NoNameServersError |
|
NoSuchResourceRecord |
NoSuchResourceRecordError |
|
QueryTimedOut |
QueryTimedOutError |
|
MaxAttemptsReached |
MaxAttemptsReachedError |
|
InvalidReply |
InvalidReplyError |
|
QueryAborted |
QueryAbortedError |
|
QueryRefused |
QueryRefusedError |
|
DNSSECValidationFailed |
DNSSECValidationFailedError |
|
NoTrustAnchor |
NoTrustAnchorError |
|
ResourceRecordTypeUnsupported |
ResourceRecordTypeUnsupportedError |
|
NetworkDown |
NetworkDownError |
|
NoSource |
NoSourceError |
|
StubLoop |
StubLoopError |
|
DNSError |
DNSError |
|
CNAMELoop |
CNAMELoopError |
|
BadAddressSize |
BadAddressSizeError |
|
ResourceRecordTypeInvalidForQuery |
ResourceRecordTypeInvalidForQueryError |
|
ZoneTransfersNotPermitted |
ZoneTransfersNotPermittedError |
|
ResourceRecordTypeObsolete |
ResourceRecordTypeObsoleteError |
|
InconsistentServiceRecords |
InconsistentServiceRecordsError |
The DNS resource records of the specified service are not consistent (e.g. lacks a DNS-SD service type when resolved). |
ServiceNotProvided |
ServiceNotProvidedError |
The service is explicitly not provided on the queried domain (RFC 2782 root domain SRV record). |