dns

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorNotSupportSplitDNS = errors.New("not support split DNS")

Functions

func CleanupHosts

func CleanupHosts() error

func GetHostFile

func GetHostFile() string

func GetResolveCtlCmd added in v2.2.19

func GetResolveCtlCmd(ctx context.Context, tunName string, config *miekgdns.ClientConfig) error

GetResolveCtlCmd resolvectl dns utun0 10.10.129.161 resolvectl domain utun0 default.svc.cluster.local svc.cluster.local cluster.local

func GetSystemdResolveCmd added in v2.2.19

func GetSystemdResolveCmd(ctx context.Context, tunName string, config *miekgdns.ClientConfig) error

func ListenAndServe added in v2.2.5

func ListenAndServe(network, address string, forwardDNS *miekgdns.ClientConfig) error

func SetupLocalDNS

func SetupLocalDNS(ctx context.Context, clientConfig *miekgdns.ClientConfig, existNameservers []string) error

func WriteResolvConf

func WriteResolvConf(filename string, config miekgdns.ClientConfig) error

Types

type Config

type Config struct {
	Config  *miekgdns.ClientConfig
	Ns      []string
	TunName string

	Hosts []Entry
	Lock  *sync.Mutex

	// only set it on linux
	OSConfigurator dns.OSConfigurator
}

func (*Config) AddServiceNameToHosts

func (c *Config) AddServiceNameToHosts(ctx context.Context, serviceInterface v13.ServiceInterface, hosts ...Entry) error

func (*Config) CancelDNS

func (c *Config) CancelDNS()

func (*Config) SetupDNS

func (c *Config) SetupDNS(ctx context.Context) error

SetupDNS systemd-resolve --status, systemd-resolve --flush-caches

func (*Config) UseLibraryDNS added in v2.2.19

func (c *Config) UseLibraryDNS(tunName string, clientConfig *miekgdns.ClientConfig) error

type CoreFile

type CoreFile struct {
	Content []byte
}

func BuildCoreFile

func BuildCoreFile(corefileTmpl CoreFileTmpl) (*CoreFile, error)

func (*CoreFile) Body

func (c *CoreFile) Body() []byte

Body Gets the Caddyfile contents

func (*CoreFile) Path

func (c *CoreFile) Path() string

Path Gets the path to the origin file

func (*CoreFile) ServerType

func (c *CoreFile) ServerType() string

ServerType The type of server this input is intended for

type CoreFileTmpl

type CoreFileTmpl struct {
	UpstreamDNS string
	Nameservers string
}

type Entry

type Entry struct {
	IP     string
	Domain string
}

Jump to

Keyboard shortcuts

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