meshdns

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package meshdns contains the Mesh DNS server.

Index

Constants

View Source
const DefaultAdvertisePort = 53

DefaultAdvertisePort is the default port to advertise for Mesh DNS.

View Source
const DefaultListenTCP = "[::]:53"

DefaultListenTCP is the default TCP listen address.

View Source
const DefaultListenUDP = "[::]:53"

DefaultListenUDP is the default UDP listen address.

Variables

This section is empty.

Functions

This section is empty.

Types

type DomainOptions added in v0.1.2

type DomainOptions struct {
	// NodeID is the node ID to use for this domain.
	NodeID types.NodeID
	// MeshDomain is the domain to serve.
	MeshDomain string
	// MeshStorage is the storage for the mesh that this domain belongs to.
	MeshStorage storage.Provider
	// IPv6Only indicates that this domain should only respond to IPv6 requests.
	IPv6Only bool
	// SubscribeForwarders indicates that new forwarders added to the mesh should be
	// appeneded to the current server.
	SubscribeForwarders bool
}

type Options

type Options struct {
	// UDPListenAddr is the UDP address to listen on.
	UDPListenAddr string
	// TCPListenAddr is the TCP address to listen on.
	TCPListenAddr string
	// ReusePort enables SO_REUSEPORT on the listeners.
	// TODO: not implemented yet
	ReusePort int
	// Compression enables DNS compression.
	Compression bool
	// RequestTimeout is the timeout for DNS requests.
	// Defaults to 5 seconds.
	RequestTimeout time.Duration
	// Forwaders are the DNS forwarders to use. If empty,
	// the system DNS servers will be used.
	Forwarders []string
	// IncludeSystemResolvers includes the system DNS
	// servers in the forwarders list if it is non-empty.
	IncludeSystemResolvers bool
	// DisableForwarding disables forwarding requests to the
	// configured forwarders.
	DisableForwarding bool
	// CacheSize is the size of the remote DNS cache.
	CacheSize int
}

Options are the Mesh DNS server options.

type Server

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

Server is the MeshDNS server.

func NewServer

func NewServer(ctx context.Context, o *Options) *Server

NewServer returns a new Mesh DNS server.

func (*Server) DeregisterDomain added in v0.14.2

func (s *Server) DeregisterDomain(domain string)

DeregisterDomain deregisters a domain from the Mesh DNS server.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe serves the Mesh DNS server.

func (*Server) ListenPort added in v0.14.2

func (s *Server) ListenPort() int

ListenPort returns the UDP or TDP listen port in that order depending on which is available.

func (*Server) ListenPortTCP added in v0.14.2

func (s *Server) ListenPortTCP() int

ListenPortTCP returns the TCP listen port.

func (*Server) ListenPortUDP added in v0.14.2

func (s *Server) ListenPortUDP() int

ListenPortUDP returns the UDP listen port.

func (*Server) PushForwarder added in v0.13.7

func (s *Server) PushForwarder(forwarder string)

PushForwarder pushes a forwarder to the front of the static forwarders list.

func (*Server) RegisterDomain added in v0.1.2

func (s *Server) RegisterDomain(opts DomainOptions) error

RegisterDomain registers a new domain to be served by the Mesh DNS server.

func (*Server) RemoveForwarder added in v0.13.7

func (s *Server) RemoveForwarder(forwarder string)

RemoveForwarder removes a forwarder from the static forwarders list.

func (*Server) ReplaceForwarders added in v0.13.7

func (s *Server) ReplaceForwarders(forwarders []string)

ReplaceForwarders replaces the static forwarders list with the given list.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown shuts down the Mesh DNS server.

func (*Server) UpsertForwarder added in v0.13.7

func (s *Server) UpsertForwarder(forwarder string)

UpsertForwarder upserts a forwarder into the static forwarders list.

Jump to

Keyboard shortcuts

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