dnscore

package
v0.0.203 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: LGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USER_AGENT = "DNS-over-HTTPS/1.0 NekoQ-Bootstrap"
)

Variables

This section is empty.

Functions

func AddIpReverseDnsToStorage

func AddIpReverseDnsToStorage(storage DnsStorage, ipStr, domain string) error

func FromIPAddressToPtrFqdn

func FromIPAddressToPtrFqdn(ipStr string) string

func IsValidIPAddress

func IsValidIPAddress(ipStr string) bool

Types

type DnsCache

type DnsCache interface {
	Put(req, res *dns.Msg)
	Get(req *dns.Msg) *dns.Msg
}

func NewDnsMemCache

func NewDnsMemCache() DnsCache

type DnsEndpoint

type DnsEndpoint struct {
	Storage DnsStorage
	Server  *dns.Server
	Cache   DnsCache

	Addr string

	DebugPrintDnsRequest bool

	HandlerMapping map[uint16]DnsRecordHandler
}

func NewDnsEndpoint

func NewDnsEndpoint(addr string, storage DnsStorage, upstreams []string, enclosureDomainSuffixes []struct {
	Type   string
	Suffix string
}, debug bool) (*DnsEndpoint, error)

func (*DnsEndpoint) ProcessDnsMsg

func (d *DnsEndpoint) ProcessDnsMsg(r *dns.Msg, ctx *RequestContext) *dns.Msg

func (*DnsEndpoint) ServeDNS

func (d *DnsEndpoint) ServeDNS(w dns.ResponseWriter, r *dns.Msg)

func (*DnsEndpoint) StartSync

func (d *DnsEndpoint) StartSync() error

type DnsHttp

type DnsHttp struct {
	Router *httprouter.Router

	Addr string

	DebugPrintDnsRequest bool
	// contains filtered or unexported fields
}

func NewHttpDns

func NewHttpDns(addr string, endpoint *DnsEndpoint, debug bool) (*DnsHttp, error)

func (*DnsHttp) StartSync

func (this *DnsHttp) StartSync() error

type DnsMemCache

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

func (*DnsMemCache) Get

func (d *DnsMemCache) Get(req *dns.Msg) *dns.Msg

func (*DnsMemCache) Put

func (d *DnsMemCache) Put(req, res *dns.Msg)

type DnsRecordHandler

type DnsRecordHandler interface {
	HandleQuestion(m *dns.Msg, ctx *RequestContext) (*dns.Msg, error)
}

func NewRecordAHandler

func NewRecordAHandler(parent DnsRecordHandler, storage DnsStorage, debug bool) DnsRecordHandler

func NewRecordPtrHandler

func NewRecordPtrHandler(parent DnsRecordHandler, storage DnsStorage, debug bool) DnsRecordHandler

func NewRecordSRVHandler

func NewRecordSRVHandler(parent DnsRecordHandler, storage DnsStorage, debug bool) DnsRecordHandler

func NewRecordTxtHandler

func NewRecordTxtHandler(parent DnsRecordHandler, storage DnsStorage, debug bool) DnsRecordHandler

type DnsStorage

type DnsStorage interface {
	ResolveDomain(domain string, domainType shared.DomainType) (string, error)
	PutDomain(domain, resolve string, domainType shared.DomainType)
}

type NotFoundUpstreamDns

type NotFoundUpstreamDns struct {
}

func (NotFoundUpstreamDns) HandleQuestion

func (u NotFoundUpstreamDns) HandleQuestion(m *dns.Msg, ctx *RequestContext) (*dns.Msg, error)

type ParentRecordHandler

type ParentRecordHandler struct {
	Handler DnsRecordHandler
}

func (*ParentRecordHandler) HandleQuestion

func (c *ParentRecordHandler) HandleQuestion(m *dns.Msg, ctx *RequestContext) (*dns.Msg, error)

type RecordAHandler

type RecordAHandler struct {
	*ParentRecordHandler
	DnsStorage
	// contains filtered or unexported fields
}

func (*RecordAHandler) HandleQuestion

func (r *RecordAHandler) HandleQuestion(m *dns.Msg, ctx *RequestContext) (*dns.Msg, error)

type RecordPtrHandler

type RecordPtrHandler struct {
	*ParentRecordHandler
	DnsStorage
	// contains filtered or unexported fields
}

func (*RecordPtrHandler) HandleQuestion

func (r *RecordPtrHandler) HandleQuestion(m *dns.Msg, ctx *RequestContext) (*dns.Msg, error)

type RecordSRVHandler

type RecordSRVHandler struct {
	*ParentRecordHandler
	DnsStorage
	// contains filtered or unexported fields
}

func (*RecordSRVHandler) HandleQuestion

func (r *RecordSRVHandler) HandleQuestion(m *dns.Msg, ctx *RequestContext) (*dns.Msg, error)

type RecordTxtHandler

type RecordTxtHandler struct {
	*ParentRecordHandler
	DnsStorage
	// contains filtered or unexported fields
}

func (*RecordTxtHandler) HandleQuestion

func (r *RecordTxtHandler) HandleQuestion(m *dns.Msg, ctx *RequestContext) (*dns.Msg, error)

type RequestContext

type RequestContext struct {
	Ctx context.Context
	// contains filtered or unexported fields
}

func NewRequestContext

func NewRequestContext() *RequestContext

func (*RequestContext) AddTraceInfo

func (r *RequestContext) AddTraceInfo(info string)

func (*RequestContext) AddTraceInfoWithDnsAnswersIfNoError

func (r *RequestContext) AddTraceInfoWithDnsAnswersIfNoError(info string, msg *dns.Msg, err error)

func (*RequestContext) GetTraceInfoString

func (r *RequestContext) GetTraceInfoString() string

type UpstreamDns

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

func NewUpstreamDNSWithSingle

func NewUpstreamDNSWithSingle(server []string, suffixes []struct {
	Type   string
	Suffix string
}) *UpstreamDns

func (*UpstreamDns) HandleQuestion

func (u *UpstreamDns) HandleQuestion(m *dns.Msg, ctx *RequestContext) (*dns.Msg, error)

Jump to

Keyboard shortcuts

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