Documentation ¶
Index ¶
- type GeoResolver
- func (l *GeoResolver) GeoResolvedRecords(ctx context.Context, name string, remoteIp net.IP) ([]*models.Record, error)
- func (l *GeoResolver) GetBestLocation(ctx context.Context, name string, remoteIp net.IP) (database.GetBestLocationResolvedRecordRow, error)
- func (l *GeoResolver) GetLatLong(ip net.IP) (LatLong, error)
- type LatLong
- type Resolver
- func (r *Resolver) AnswerQuestion(ctx context.Context, q dns.Question, addr net.Addr) (answers chan *models.Record, errors chan error)
- func (r *Resolver) Authority(ctx context.Context, domain string) (soa *models.Record)
- func (r *Resolver) GetAllRecords(ctx context.Context) ([]*models.Record, error)
- func (r *Resolver) GetZoneRecords(ctx context.Context, zone string) ([]*models.Record, error)
- func (r *Resolver) Lookup(ctx context.Context, req *dns.Msg, addr net.Addr) (msg *dns.Msg)
- func (r *Resolver) LookupAnswersForType(ctx context.Context, name string, rrType uint16, addr net.Addr) (answers []*models.Record, err error)
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 Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
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) GetAllRecords ¶
func (*Resolver) GetZoneRecords ¶
Click to show internal directories.
Click to hide internal directories.