proxy

package
v0.0.0-...-c6549bd Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRR

func BuildRR(rrList []string, question string, qtype uint16) []dns.RR

func ConvPTRtoIP

func ConvPTRtoIP(ptr string) string

func DecodeTypeAResponse

func DecodeTypeAResponse(answer []dns.RR) []string

func Lookup

func Lookup(msg *dns.Msg, server string) (*dns.Msg, error)

Lookup is used to get the response from external server

func LookupWithClientEDNS

func LookupWithClientEDNS(msg *dns.Msg, server string, client string) (*dns.Msg, error)

LookupWithClientEDNS is used to get the response from external server

func ReadCfg

func ReadCfg(filename string) map[string][]string

func ReadServerListCfg

func ReadServerListCfg(filename string) []string

func ReverseString

func ReverseString(req string) string

func RoutedAddress

func RoutedAddress() (string, error)

Types

type DNSReport

type DNSReport struct {
	Server string
	Record []string
}

type ProbeCacheEntry

type ProbeCacheEntry struct {
	Latency  time.Duration
	ProbeCnt uint64
	LossCnt  uint64
}

type ProbeMetric

type ProbeMetric struct {
	DestIP   string
	Duration time.Duration
}

type Proxy

type Proxy struct {
	PTRCache *tsyncmap.Map

	ProbeChan         chan *ProbeMetric
	LogLevel          string
	ProbeLFUCacheSize int
	CacheTimeOut      time.Duration
	LookupTimeOut     time.Duration
	ProbeFrequency    time.Duration
	Latitude          float64
	Longitude         float64
	ProbeWorkerCnt    *uint64
	MaxProberWorker   uint64
	ProbeDport        uint16
	BestRecordNum     int
	// contains filtered or unexported fields
}

func New

func New(routecfg string, hostcfg string, servercfg string, geocfg string, asncfg string) *Proxy

func (*Proxy) DomainRouteLookup

func (p *Proxy) DomainRouteLookup(req string) []string

func (*Proxy) DumpCacheTable

func (p *Proxy) DumpCacheTable()

func (*Proxy) GetFromCache

func (p *Proxy) GetFromCache(question string, qtype uint16) []string

func (*Proxy) GetResponse

func (p *Proxy) GetResponse(req *dns.Msg) (*dns.Msg, error)

func (*Proxy) MultipleLookup

func (p *Proxy) MultipleLookup(msg *dns.Msg, serverList []string) map[string]string

func (*Proxy) RandomLookup

func (p *Proxy) RandomLookup(msg *dns.Msg, serverList []string) (*dns.Msg, error)

RandomLookup is based on shuffled serverlist sequence

func (*Proxy) RenderProbeCacheList

func (p *Proxy) RenderProbeCacheList(s []string)

func (*Proxy) SeqLookup

func (p *Proxy) SeqLookup(msg *dns.Msg, serverList []string) (*dns.Msg, error)

SeqLookup is based on serverlist sequence

func (*Proxy) SortByLatency

func (p *Proxy) SortByLatency(addrList []string) []string

func (*Proxy) TCPPing

func (p *Proxy) TCPPing(dip string, dport uint16)

func (*Proxy) TCPProbe

func (p *Proxy) TCPProbe()

func (*Proxy) TableRender

func (p *Proxy) TableRender(name string, addrList map[string]string)

Jump to

Keyboard shortcuts

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