Documentation
¶
Index ¶
- Constants
- Variables
- func CacheKey(q dns.Question, tcp bool) string
- func DnsDomain(s string) string
- func DnsPath(s string) string
- func FitUdpSize(m *dns.Msg) *dns.Msg
- func New(backend Backend, domains []string, addr, ipMonitorPath string, ...) *server
- type Backend
- type Cache
- func (c *Cache) Add2MsgCache(s string, msg *dns.Msg, remoteIp string, timeNow time.Time, forwarding bool)
- func (c *Cache) CacheForwardTtlGet() uint64
- func (c *Cache) CacheForwardTtlSet(ttl uint64)
- func (c *Cache) CacheSizeUsed() int
- func (c *Cache) Capacity() int
- func (c *Cache) DelCachedDataCnameTypeAMap(host, alias string)
- func (c *Cache) DeleteCacheDnsDomain(domain string, tcp bool) bool
- func (c *Cache) EnsureNoExist(name string, qtype uint16, tcp bool)
- func (c *Cache) GetAllDomianStats() DomainList
- func (c *Cache) InsertCachedDataCnameTypeAMap(host, alias string)
- func (c *Cache) KeyTypeA(name string, dnssec, tcp bool) string
- func (c *Cache) Remove(s string)
- func (c *Cache) SearchRecordInCache(question dns.Question, tcp bool, msgid uint16, remoteIp string, ...) *dns.Msg
- func (c *Cache) ShowCacheDnsDomain(domain string, tcp bool) *dns.Msg
- func (c *Cache) ShowCacheStats(domain string, tcp bool) (int64, time.Time, time.Time)
- func (c *Cache) SyncCachedDataCnameMap(records map[string][]string, timenow time.Time)
- func (c *Cache) SyncCheckCachedRecords(mAnswers map[string][]dns.RR)
- func (c *Cache) UpdateRcacheDelete(valA interface{})
- func (c *Cache) UpdateRcacheSet(val interface{})
- func (c *Cache) UpdateRcacheUpdate(valAOld interface{}, valANew interface{})
- type DomainList
- type DomainTop
- type ServiceRecord
- func (s *ServiceRecord) NewRecordA(name string, ip net.IP) *dns.A
- func (s *ServiceRecord) NewRecordAAAA(name string, ip net.IP) *dns.AAAA
- func (s *ServiceRecord) NewRecordCname(name string, target string) *dns.CNAME
- func (s *ServiceRecord) NewRecordMx(name string) *dns.MX
- func (s *ServiceRecord) NewRecordNS(name string, target string) *dns.NS
- func (s *ServiceRecord) NewRecordPTR(name string, ttl uint32) *dns.PTR
- func (s *ServiceRecord) NewRecordSRV(name string, weight uint16) *dns.SRV
- func (s *ServiceRecord) NewRecordTXT(name string) *dns.TXT
Constants ¶
View Source
const DnsPathPrefix = "containerdns"
View Source
const Version = "2.1.1"
Variables ¶
View Source
var ( EtcdCachesLock sync.RWMutex // lcok EtcdRecordCaches EtcdRecordCaches map[string][]ServiceRecord = make(map[string][]ServiceRecord) // EtcdRecordUpdateTime map[string]time.Time = make(map[string]time.Time) // )
View Source
var MsgCachePool *queue.Queue
Functions ¶
Types ¶
type Backend ¶
type Backend interface { Records(name string) ([]ServiceRecord, error) ReverseRecord(name string) (*ServiceRecord, error) Get(name string) ([]ServiceRecord, int64, error) GetRaw(name string) (*clientv3.GetResponse, error) }
type Cache ¶
type Cache struct { sync.RWMutex AvaliableIps map[string]bool // the host alive AvaliableIpsUpdateTime time.Time // contains filtered or unexported fields }
Cache is a cache that holds on the a number of RRs or DNS messages. The cache eviction is randomized.
func NewMsgCache ¶
New returns a new cache with the capacity and the ttl specified.
func (*Cache) Add2MsgCache ¶
func (*Cache) CacheForwardTtlGet ¶
func (*Cache) CacheForwardTtlSet ¶
func (*Cache) CacheSizeUsed ¶
func (*Cache) DelCachedDataCnameTypeAMap ¶
func (*Cache) DeleteCacheDnsDomain ¶
func (*Cache) GetAllDomianStats ¶
func (c *Cache) GetAllDomianStats() DomainList
func (*Cache) InsertCachedDataCnameTypeAMap ¶
func (*Cache) SearchRecordInCache ¶
func (*Cache) ShowCacheDnsDomain ¶
func (*Cache) ShowCacheStats ¶
func (*Cache) SyncCachedDataCnameMap ¶
func (*Cache) SyncCheckCachedRecords ¶
func (*Cache) UpdateRcacheDelete ¶
func (c *Cache) UpdateRcacheDelete(valA interface{})
func (*Cache) UpdateRcacheSet ¶
func (c *Cache) UpdateRcacheSet(val interface{})
func (*Cache) UpdateRcacheUpdate ¶
func (c *Cache) UpdateRcacheUpdate(valAOld interface{}, valANew interface{})
type DomainList ¶
type DomainList []*DomainTop
func (DomainList) Len ¶
func (s DomainList) Len() int
func (DomainList) Less ¶
func (s DomainList) Less(i, j int) bool
func (DomainList) Swap ¶
func (s DomainList) Swap(i, j int)
type ServiceRecord ¶
type ServiceRecord struct { Dnstype string `json:"type,omitempty"` RecordSource string `json:"source,omitempty"` DnsHost string `json:"host,omitempty"` DnsTtl uint32 `json:"ttl,omitempty"` DnsPort int `json:"port,omitempty"` DnsPriority int `json:"priority,omitempty"` DnsWeight int `json:"weight,omitempty"` DnsText string `json:"text,omitempty"` DnsMail bool `json:"mail,omitempty"` Cluster string `json:"cluster,omitempty"` // Etcd key Key string `json:"-"` }
func (*ServiceRecord) NewRecordA ¶
NewRecordA returns a new A record based on the Service.
func (*ServiceRecord) NewRecordAAAA ¶
NewRecordAAAA returns a new AAAA record based on the Service.
func (*ServiceRecord) NewRecordCname ¶
func (s *ServiceRecord) NewRecordCname(name string, target string) *dns.CNAME
NewRecordCname returns a new CNAME record based on the Service.
func (*ServiceRecord) NewRecordMx ¶
func (s *ServiceRecord) NewRecordMx(name string) *dns.MX
NewRecordMx returns a new MX record based on the Service.
func (*ServiceRecord) NewRecordNS ¶
func (s *ServiceRecord) NewRecordNS(name string, target string) *dns.NS
NewRecordNS returns a new NS record based on the Service.
func (*ServiceRecord) NewRecordPTR ¶
func (s *ServiceRecord) NewRecordPTR(name string, ttl uint32) *dns.PTR
NewRecordPTR returns a new PTR record based on the Service.
func (*ServiceRecord) NewRecordSRV ¶
func (s *ServiceRecord) NewRecordSRV(name string, weight uint16) *dns.SRV
NewRecordSRV returns a new SRV record based on the Service.
func (*ServiceRecord) NewRecordTXT ¶
func (s *ServiceRecord) NewRecordTXT(name string) *dns.TXT
NewRecordTXT returns a new TXT record based on the Service.
Click to show internal directories.
Click to hide internal directories.