Version: v1.8.7 Latest Latest

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

Go to latest
Published: Sep 18, 2021 License: GPL-3.0 Imports: 22 Imported by: 1




This section is empty.


This section is empty.


func BoolLogic

func BoolLogic(ctx context.Context, qCtx *handler.Context, fs []handler.Matcher, logicalAND bool) (matched bool, err error)

func BytesToStringUnsafe

func BytesToStringUnsafe(b []byte) string

BytesToStringUnsafe converts bytes to string.

func ExchangeParallel

func ExchangeParallel(ctx context.Context, qCtx *handler.Context, upstreams []Upstream, logger *zap.Logger) (r *dns.Msg, err error)

func GenerateCertificate

func GenerateCertificate(dnsName string) (cert tls.Certificate, err error)

GenerateCertificate generates a ecdsa certificate with given dnsName. This should only use in test.

func GetIPFromAddr

func GetIPFromAddr(addr net.Addr) (ip net.IP)

GetIPFromAddr returns net.IP from net.Addr. Will return nil if no ip address can be parsed.

func GetMsgKey

func GetMsgKey(m *dns.Msg, salt uint16) (string, error)

GetMsgKey unpacks m and set its id to salt.

func IsIPAddr added in v1.8.0

func IsIPAddr(s string) bool

IsIPAddr returns true is s is a IP address. s can contain ":port".

func LoadCertPool

func LoadCertPool(certs []string) (*x509.CertPool, error)

LoadCertPool reads and loads certificates in certs.

func RemoveComment

func RemoveComment(s, symbol string) string

RemoveComment removes comment after "symbol".

func SplitLine

func SplitLine(s string) []string

SplitLine removes all spaces " " and extracts words from s.

func SplitLineReg

func SplitLineReg(s string) []string

SplitLineReg extracts words from s by using regexp "\S+".

func SplitSchemeAndHost

func SplitSchemeAndHost(addr string) (protocol, host string)

SplitSchemeAndHost splits addr to protocol and host.

func SplitString2

func SplitString2(s, symbol string) (s1 string, s2 string, ok bool)

SplitString2 split s to two parts by given symbol


type ExchangeSingleFlightGroup

type ExchangeSingleFlightGroup struct {

func (*ExchangeSingleFlightGroup) Exchange

func (g *ExchangeSingleFlightGroup) Exchange(ctx context.Context, qCtx *handler.Context, upstreams []Upstream, logger *zap.Logger) (r *dns.Msg, err error)

type NetAddr

type NetAddr struct {
	// contains filtered or unexported fields

NetAddr implements net.Addr interface.

func NewNetAddr

func NewNetAddr(addr string, network string) *NetAddr

func (*NetAddr) IP

func (n *NetAddr) IP() net.IP

func (*NetAddr) Network

func (n *NetAddr) Network() string

func (*NetAddr) String

func (n *NetAddr) String() string

type Upstream

type Upstream interface {
	// Exchange should not keep nor modify qCtx.
	Exchange(qCtx *handler.Context) (*dns.Msg, error)
	Address() string
	Trusted() bool

Source Files

Jump to

Keyboard shortcuts

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