resolver

package
v0.0.0-...-1711327 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GeoResolver

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

func NewGeoResolver

func NewGeoResolver(geo *geoip2.Reader, db *database.Queries) *GeoResolver

func (*GeoResolver) GeoResolvedRecords

func (l *GeoResolver) GeoResolvedRecords(ctx context.Context, name string, remoteIp net.IP) ([]*models.Record, error)

GeoResolvedRecords returns the record for a service name closest to the remoteIp TODO(melon): add tests for this

func (*GeoResolver) GetBestLocation

func (l *GeoResolver) GetBestLocation(ctx context.Context, name string, remoteIp net.IP) (database.GetBestLocationResolvedRecordRow, error)

func (*GeoResolver) GetLatLong

func (l *GeoResolver) GetLatLong(ip net.IP) (LatLong, error)

type LatLong

type LatLong struct {
	Lat  float64
	Long float64
}

type Resolver

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

func NewResolver

func NewResolver(soa conf.SoaConf, db *database.Queries, geo *GeoResolver) *Resolver

func (*Resolver) AnswerQuestion

func (r *Resolver) AnswerQuestion(ctx context.Context, q dns.Question, addr net.Addr) (answers chan *models.Record, errors chan error)

AnswerQuestion takes two channels, one for answers and one for errors. It will answer the given question writing the answers as dns.RR structures, and any errors it encounters along the way. The function will return immediately, and spawn off a bunch of goroutines to do the work, when using this function one should use a WaitGroup to know when all work has been completed.

func (*Resolver) Authority

func (r *Resolver) Authority(ctx context.Context, domain string) (soa *models.Record)

func (*Resolver) GetAllRecords

func (r *Resolver) GetAllRecords(ctx context.Context) ([]*models.Record, error)

func (*Resolver) GetZoneRecords

func (r *Resolver) GetZoneRecords(ctx context.Context, zone string) ([]*models.Record, error)

func (*Resolver) Lookup

func (r *Resolver) Lookup(ctx context.Context, req *dns.Msg, addr net.Addr) (msg *dns.Msg)

func (*Resolver) LookupAnswersForType

func (r *Resolver) LookupAnswersForType(ctx context.Context, name string, rrType uint16, addr net.Addr) (answers []*models.Record, err error)

Jump to

Keyboard shortcuts

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