Documentation ¶
Index ¶
- Variables
- func ChooseIp(ips []IP_RR, weighted bool) int
- func GetSourceIp(request *request.Request) net.IP
- func GetSourceSubnet(request *request.Request) string
- func HandleHealthCheck(h *Healthcheck) workerpool.JobHandler
- func NSec(name string, zone *Zone) dns.RR
- func NewServer(config []ServerConfig) []dns.Server
- func Sign(rrs []dns.RR, qname string, record *Record) []dns.RR
- type ANAME_Record
- type CAA_RR
- type CAA_RRSet
- type CNAME_RRSet
- type DnsRequestHandler
- func (h *DnsRequestHandler) A(name string, record *Record, ips []IP_RR) (answers []dns.RR)
- func (h *DnsRequestHandler) AAAA(name string, record *Record, ips []IP_RR) (answers []dns.RR)
- func (h *DnsRequestHandler) CAA(name string, record *Record) (answers []dns.RR)
- func (h *DnsRequestHandler) CNAME(name string, record *Record) (answers []dns.RR)
- func (h *DnsRequestHandler) FetchRecord(qname string, logData map[string]interface{}) (*Record, int)
- func (h *DnsRequestHandler) Filter(request *request.Request, rrset *IP_RRSet, logData map[string]interface{}) []IP_RR
- func (h *DnsRequestHandler) FindCAA(record *Record) *Record
- func (h *DnsRequestHandler) GetRecord(qname string) (record *Record, rcode int)
- func (h *DnsRequestHandler) HandleRequest(state *request.Request)
- func (h *DnsRequestHandler) LoadLocation(location string, z *Zone) *Record
- func (h *DnsRequestHandler) LoadZone(zone string) *Zone
- func (h *DnsRequestHandler) LoadZones()
- func (h *DnsRequestHandler) LogRequest(data map[string]interface{}, startTime time.Time, responseCode int)
- func (h *DnsRequestHandler) MX(name string, record *Record) (answers []dns.RR)
- func (h *DnsRequestHandler) Matches(qname string) string
- func (h *DnsRequestHandler) NS(name string, record *Record) (answers []dns.RR)
- func (h *DnsRequestHandler) PTR(name string, record *Record) (answers []dns.RR)
- func (h *DnsRequestHandler) SRV(name string, record *Record) (answers []dns.RR)
- func (h *DnsRequestHandler) SetLocation(location string, z *Zone, val *Record)
- func (h *DnsRequestHandler) ShutDown()
- func (h *DnsRequestHandler) TLSA(name string, record *Record) (answers []dns.RR)
- func (h *DnsRequestHandler) TXT(name string, record *Record) (answers []dns.RR)
- type GeoIp
- func (g *GeoIp) GetASN(ip net.IP) (uint, error)
- func (g *GeoIp) GetGeoLocation(ip net.IP) (latitude float64, longitude float64, country string, err error)
- func (g *GeoIp) GetMinimumDistance(sourceIp net.IP, ips []IP_RR, logData map[string]interface{}) []IP_RR
- func (g *GeoIp) GetSameASN(sourceIp net.IP, ips []IP_RR, logData map[string]interface{}) []IP_RR
- func (g *GeoIp) GetSameCountry(sourceIp net.IP, ips []IP_RR, logData map[string]interface{}) []IP_RR
- type GeoIpConfig
- type HandlerConfig
- type HealthCheckItem
- type Healthcheck
- type HealthcheckConfig
- type IP_RR
- type IP_RRSet
- type IpFilterConfig
- type IpHealthCheckConfig
- type Limiter
- type MX_RR
- type MX_RRSet
- type NS_RR
- type NS_RRSet
- type PTR_RRSet
- type RRSets
- type RateLimiter
- type RateLimiterConfig
- type Record
- type SOA_RRSet
- type SRV_RR
- type SRV_RRSet
- type ServerConfig
- type TLSA_RR
- type TLSA_RRSet
- type TXT_RR
- type TXT_RRSet
- type TlsConfig
- type Upstream
- type UpstreamConfig
- type UpstreamConnection
- type Zone
- type ZoneConfig
- type ZoneKey
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetSourceSubnet ¶
func HandleHealthCheck ¶
func HandleHealthCheck(h *Healthcheck) workerpool.JobHandler
func NewServer ¶
func NewServer(config []ServerConfig) []dns.Server
Types ¶
type ANAME_Record ¶
type ANAME_Record struct {
Location string `json:"location,omitempty"`
}
type CNAME_RRSet ¶
type DnsRequestHandler ¶
type DnsRequestHandler struct { Config *HandlerConfig Zones *iradix.Tree LastZoneUpdate time.Time Redis *uperdis.Redis Logger *logger.EventLogger RecordCache *cache.Cache ZoneCache *cache.Cache // contains filtered or unexported fields }
func NewHandler ¶
func NewHandler(config *HandlerConfig) *DnsRequestHandler
func (*DnsRequestHandler) CAA ¶
func (h *DnsRequestHandler) CAA(name string, record *Record) (answers []dns.RR)
func (*DnsRequestHandler) CNAME ¶
func (h *DnsRequestHandler) CNAME(name string, record *Record) (answers []dns.RR)
func (*DnsRequestHandler) FetchRecord ¶
func (h *DnsRequestHandler) FetchRecord(qname string, logData map[string]interface{}) (*Record, int)
func (*DnsRequestHandler) FindCAA ¶
func (h *DnsRequestHandler) FindCAA(record *Record) *Record
func (*DnsRequestHandler) GetRecord ¶
func (h *DnsRequestHandler) GetRecord(qname string) (record *Record, rcode int)
func (*DnsRequestHandler) HandleRequest ¶
func (h *DnsRequestHandler) HandleRequest(state *request.Request)
func (*DnsRequestHandler) LoadLocation ¶
func (h *DnsRequestHandler) LoadLocation(location string, z *Zone) *Record
func (*DnsRequestHandler) LoadZone ¶
func (h *DnsRequestHandler) LoadZone(zone string) *Zone
func (*DnsRequestHandler) LoadZones ¶
func (h *DnsRequestHandler) LoadZones()
func (*DnsRequestHandler) LogRequest ¶
func (h *DnsRequestHandler) LogRequest(data map[string]interface{}, startTime time.Time, responseCode int)
func (*DnsRequestHandler) MX ¶
func (h *DnsRequestHandler) MX(name string, record *Record) (answers []dns.RR)
func (*DnsRequestHandler) Matches ¶
func (h *DnsRequestHandler) Matches(qname string) string
func (*DnsRequestHandler) NS ¶
func (h *DnsRequestHandler) NS(name string, record *Record) (answers []dns.RR)
func (*DnsRequestHandler) PTR ¶
func (h *DnsRequestHandler) PTR(name string, record *Record) (answers []dns.RR)
func (*DnsRequestHandler) SRV ¶
func (h *DnsRequestHandler) SRV(name string, record *Record) (answers []dns.RR)
func (*DnsRequestHandler) SetLocation ¶
func (h *DnsRequestHandler) SetLocation(location string, z *Zone, val *Record)
func (*DnsRequestHandler) ShutDown ¶
func (h *DnsRequestHandler) ShutDown()
type GeoIp ¶
type GeoIp struct { Enable bool CountryDB *maxminddb.Reader ASNDB *maxminddb.Reader }
func NewGeoIp ¶
func NewGeoIp(config *GeoIpConfig) *GeoIp
func (*GeoIp) GetGeoLocation ¶
func (*GeoIp) GetMinimumDistance ¶
func (*GeoIp) GetSameASN ¶
type GeoIpConfig ¶
type HandlerConfig ¶
type HandlerConfig struct { Upstream []UpstreamConfig `json:"upstream,omitempty"` GeoIp GeoIpConfig `json:"geoip,omitempty"` HealthCheck HealthcheckConfig `json:"healthcheck,omitempty"` MaxTtl int `json:"max_ttl,omitempty"` CacheTimeout int `json:"cache_timeout,omitempty"` ZoneReload int `json:"zone_reload,omitempty"` LogSourceLocation bool `json:"log_source_location,omitempty"` UpstreamFallback bool `json:"upstream_fallback,omitempty"` Redis uperdis.RedisConfig `json:"redis,omitempty"` Log logger.LogConfig `json:"log,omitempty"` }
type HealthCheckItem ¶
type HealthCheckItem struct { Protocol string `json:"protocol,omitempty"` Uri string `json:"uri,omitempty"` Port int `json:"port,omitempty"` Status int `json:"status,omitempty"` LastCheck time.Time `json:"lastcheck,omitempty"` Timeout int `json:"timeout,omitempty"` UpCount int `json:"up_count,omitempty"` DownCount int `json:"down_count,omitempty"` Enable bool `json:"enable,omitempty"` DomainId string `json:"domain_uuid, omitempty"` Host string `json:"-"` Ip string `json:"-"` Error error `json:"-"` }
type Healthcheck ¶
type Healthcheck struct { Enable bool // contains filtered or unexported fields }
func NewHealthcheck ¶
func NewHealthcheck(config *HealthcheckConfig, redisConfigServer *uperdis.Redis) *Healthcheck
func (*Healthcheck) FilterHealthcheck ¶
func (h *Healthcheck) FilterHealthcheck(qname string, rrset *IP_RRSet) []IP_RR
func (*Healthcheck) ShutDown ¶
func (h *Healthcheck) ShutDown()
func (*Healthcheck) Start ¶
func (h *Healthcheck) Start()
func (*Healthcheck) Transfer ¶
func (h *Healthcheck) Transfer()
type HealthcheckConfig ¶
type HealthcheckConfig struct { Enable bool `json:"enable,omitempty"` MaxRequests int `json:"max_requests,omitempty"` MaxPendingRequests int `json:"max_pending_requests,omitempty"` UpdateInterval int `json:"update_interval,omitempty"` CheckInterval int `json:"check_interval,omitempty"` RedisStatusServer uperdis.RedisConfig `json:"redis,omitempty"` Log logger.LogConfig `json:"log,omitempty"` }
type IP_RR ¶
type IP_RR struct { Weight int `json:"weight,omitempty"` Ip net.IP `json:"ip"` Country []string `json:"country,omitempty"` ASN []uint `json:"asn,omitempty"` }
func (*IP_RR) UnmarshalJSON ¶
type IP_RRSet ¶
type IP_RRSet struct { FilterConfig IpFilterConfig `json:"filter,omitempty"` HealthCheckConfig IpHealthCheckConfig `json:"health_check,omitempty"` Ttl uint32 `json:"ttl,omitempty"` Data []IP_RR `json:"records,omitempty"` }
type IpFilterConfig ¶
type IpHealthCheckConfig ¶
type IpHealthCheckConfig struct { Protocol string `json:"protocol,omitempty"` Uri string `json:"uri,omitempty"` Port int `json:"port,omitempty"` Timeout int `json:"timeout,omitempty"` UpCount int `json:"up_count,omitempty"` DownCount int `json:"down_count,omitempty"` Enable bool `json:"enable,omitempty"` }
type RRSets ¶
type RRSets struct { A IP_RRSet `json:"a,omitempty"` AAAA IP_RRSet `json:"aaaa,omitempty"` TXT TXT_RRSet `json:"txt,omitempty"` CNAME *CNAME_RRSet `json:"cname,omitempty"` NS NS_RRSet `json:"ns,omitempty"` MX MX_RRSet `json:"mx,omitempty"` SRV SRV_RRSet `json:"srv,omitempty"` CAA CAA_RRSet `json:"caa,omitempty"` PTR *PTR_RRSet `json:"ptr,omitempty"` TLSA TLSA_RRSet `json:"tlsa,omitempty"` ANAME *ANAME_Record `json:"aname,omitempty"` }
type RateLimiter ¶
type RateLimiter struct { Limiters *cache.Cache MaxTime time.Duration TimeStep time.Duration Config *RateLimiterConfig WhiteList map[string]interface{} BlackList map[string]interface{} }
func NewRateLimiter ¶
func NewRateLimiter(config *RateLimiterConfig) *RateLimiter
func (*RateLimiter) CanHandle ¶
func (rl *RateLimiter) CanHandle(key string) bool
type RateLimiterConfig ¶
type ServerConfig ¶
type TLSA_RRSet ¶
type Upstream ¶
type Upstream struct {
// contains filtered or unexported fields
}
func NewUpstream ¶
func NewUpstream(config []UpstreamConfig) *Upstream
type UpstreamConfig ¶
type UpstreamConnection ¶
type UpstreamConnection struct {
// contains filtered or unexported fields
}
type ZoneConfig ¶
Click to show internal directories.
Click to hide internal directories.