network

package
v0.0.0-...-76c1feb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2021 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExternalIPAddress

func GetExternalIPAddress(ctx context.Context) ([]net.IPAddr, error)

GetExternalIPAddress retrieves the external IP address of the host.

func ReadFromSRV

func ReadFromSRV(service string, protocol string, name string, fallbackDNSResolverAddress string, secure bool) (addrs []string, err error)

ReadFromSRV is a helper to collect SRV addresses for a given name.

func StartTelemetryURIUpdateService

func StartTelemetryURIUpdateService(interval time.Duration, cfg config.Local, genesisNetwork protocol.NetworkID, log logging.Logger, abort chan struct{})

StartTelemetryURIUpdateService starts a go routine which queries SRV records for a telemetry URI every <interval>

Types

type ResolveController

type ResolveController struct {
	// contains filtered or unexported fields
}

ResolveController provides a layer of abstaction for a regular, or DNSSEC-aware resolvers

func NewResolveController

func NewResolveController(secure bool, fallbackDNSResolverAddress string, log logging.Logger) ResolveController

NewResolveController creates a new ResolveController

func (*ResolveController) DefaultResolver

func (c *ResolveController) DefaultResolver() ResolverIf

DefaultResolver returns a resolver that uses fallback DNS address

func (*ResolveController) FallbackResolver

func (c *ResolveController) FallbackResolver() ResolverIf

FallbackResolver returns a resolver that uses fallback DNS address

func (*ResolveController) SystemResolver

func (c *ResolveController) SystemResolver() ResolverIf

SystemResolver returns a resolver that uses OS-defined DNS servers

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver provides equivalent functionality to the net.Resolver with one exception - it allows to use a provided DNS server instead of relying on the existing default resolver.

func (*Resolver) EffectiveResolverDNS

func (p *Resolver) EffectiveResolverDNS() string

EffectiveResolverDNS returns effective DNS server address that would be used for the resolve operation.

func (*Resolver) LookupAddr

func (p *Resolver) LookupAddr(ctx context.Context, addr string) (names []string, err error)

LookupAddr performs a reverse lookup for the given address, returning a list of names mapping to that address.

func (*Resolver) LookupCNAME

func (p *Resolver) LookupCNAME(ctx context.Context, host string) (cname string, err error)

LookupCNAME returns the canonical name for the given host. Callers that do not care about the canonical name can call LookupHost or LookupIP directly; both take care of resolving the canonical name as part of the lookup. A canonical name is the final name after following zero or more CNAME records. LookupCNAME does not return an error if host does not contain DNS "CNAME" records, as long as host resolves to address records.

func (*Resolver) LookupHost

func (p *Resolver) LookupHost(ctx context.Context, host string) (addrs []string, err error)

LookupHost looks up the given host using the local resolver. It returns a slice of that host's addresses.

func (*Resolver) LookupIPAddr

func (p *Resolver) LookupIPAddr(ctx context.Context, host string) ([]net.IPAddr, error)

LookupIPAddr looks up host using the local resolver. It returns a slice of that host's IPv4 and IPv6 addresses.

func (*Resolver) LookupMX

func (p *Resolver) LookupMX(ctx context.Context, name string) ([]*net.MX, error)

LookupMX returns the DNS MX records for the given domain name sorted by preference.

func (*Resolver) LookupNS

func (p *Resolver) LookupNS(ctx context.Context, name string) ([]*net.NS, error)

LookupNS returns the DNS NS records for the given domain name.

func (*Resolver) LookupPort

func (p *Resolver) LookupPort(ctx context.Context, network, service string) (port int, err error)

LookupPort looks up the port for the given network and service.

func (*Resolver) LookupSRV

func (p *Resolver) LookupSRV(ctx context.Context, service, proto, name string) (cname string, addrs []*net.SRV, err error)

LookupSRV tries to resolve an SRV query of the given service, protocol, and domain name. The proto is "tcp" or "udp". The returned records are sorted by priority and randomized by weight within a priority. LookupSRV constructs the DNS name to look up following RFC 2782. That is, it looks up _service._proto.name. To accommodate services publishing SRV records under non-standard names, if both service and proto are empty strings, LookupSRV looks up name directly.

func (*Resolver) LookupTXT

func (p *Resolver) LookupTXT(ctx context.Context, name string) ([]string, error)

LookupTXT returns the DNS TXT records for the given domain name.

func (*Resolver) SetFallbackResolverAddress

func (p *Resolver) SetFallbackResolverAddress(fallbackDNSResolverAddress net.IPAddr)

SetFallbackResolverAddress sets preferred DNS server address

type ResolverIf

type ResolverIf interface {
	dnssec.ResolverIf
}

ResolverIf is re-import from dnssec.ResolverIf

Directories

Path Synopsis
Package dnssec provides net.Resolver-compatible methods for DNSSEC.
Package dnssec provides net.Resolver-compatible methods for DNSSEC.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL