Documentation ¶
Index ¶
- Constants
- Variables
- func AddLocalRecord(domain string, record Record)
- func AllowForwarding(cidr []string)
- func Debug()
- func Discard(node string)
- func EnableProxyStats(b bool)
- func FindTargets(dnsmanager map[string]Domains, domain, name, request string) ([]string, []string, []string)
- func GetCache() map[string]Domains
- func Listen(server *dnssrv.Server) error
- func MarkOffline(node string)
- func Remove(node, domainName, hostName string)
- func RemoveLocalRecord(domain string, recordid int)
- func RemoveLocalRecordByContent(domainName string, hostName string, TTL int, Target string, Type string)
- func Server(host string, port int, allowedRequests []string)
- func Update(node string, domain string, record Record)
- func UpdateStatistics(clusterNode string, domain string, s *balancer.Statistics)
- func WebGLBStatus(w http.ResponseWriter, r *http.Request)
- type Config
- type Domain
- type Domains
- type Record
- type Status
- type StatusType
Constants ¶
const ( Automatic = Status(iota) Online Offline Maintenance )
Status values of a check
Variables ¶
var IntToStatusType = map[int]Status{ 0: Automatic, 1: Online, 2: Offline, 3: Maintenance, }
IntToStatusType converts int to status
var StatusTypeToString = map[Status]string{ Automatic: "automatic", Online: "online", Offline: "offline", Maintenance: "maintance", }
StatusTypeToString converts status to string
var StringToStatusType = map[string]Status{ "automatic": Automatic, "online": Online, "offline": Offline, "maintenance": Maintenance, }
StringToStatusType converts string to status
Functions ¶
func AddLocalRecord ¶
AddLocalRecord adds a local record
func AllowForwarding ¶
func AllowForwarding(cidr []string)
AllowForwarding return true if client is allowed to forward dns requests
func EnableProxyStats ¶
func EnableProxyStats(b bool)
EnableProxyStats set to true to use proxy stats, or to false to use internal stats of dns manager
func FindTargets ¶
func FindTargets(dnsmanager map[string]Domains, domain, name, request string) ([]string, []string, []string)
FindTargets returns all targets of matching records
func MarkOffline ¶
func MarkOffline(node string)
MarkOffline marks all dns entries of a node as offline
func RemoveLocalRecord ¶
RemoveLocalRecord adds a local record
func RemoveLocalRecordByContent ¶
func RemoveLocalRecordByContent(domainName string, hostName string, TTL int, Target string, Type string)
RemoveLocalRecordByContent remove content by record data
func UpdateStatistics ¶
func UpdateStatistics(clusterNode string, domain string, s *balancer.Statistics)
UpdateStatistics for node
func WebGLBStatus ¶
func WebGLBStatus(w http.ResponseWriter, r *http.Request)
WebGLBStatus Provides a status page for GLB
Types ¶
type Config ¶
type Config struct { Domains map[string]Domain `toml:"domains" json:"domains"` Binding string `toml:"binding" json:"binding"` AllowForwarding []string `toml:"allow_forwarding" json:"allow_forwarding"` Port int `toml:"port" json:"port"` AllowedRequests []string `toml:"allowed_requests" json:"allowed_requests"` }
Config has the dns config
type Record ¶
type Record struct { Name string `toml:"name" json:"name"` // hostname Type string `toml:"type" json:"type"` // record type Target string `toml:"target" json:"target"` // reply of record TTL int `toml:"ttl" json:"ttl"` // time to live BalanceMode string `toml:"balancemode" json:"balancemode"` // balance mode of dns ActivePassive string `toml:"activepassive" json:"activepassive"` // used for monitoring only: record is active/passive setup ServingClusterNodes int `toml:"serving_cluster_nodes" json:"serving_cluster_nodes"` // ammount of cluster nodes that should serve this domain (defaults to len(clusternodes)) LocalNetwork string `toml:"localnetwork" json:"localnetwork"` // used by balance mode: topology Statistics *balancer.Statistics `toml:"statistics" json:"statistics"` // stats Status Status `toml:"status" json:"status"` // is record online (do we serve it) Local bool `toml:"local" json:"local"` // true if record is of the local dns server UUID string `toml:"uuid" json:"uuid"` // links record to check that added it,usefull for removing dead checks }
Record of any type
func GetAllLocalDomainRecords ¶
GetAllLocalDomainRecords get all local records from domain
func GetRecordsByStats ¶
func GetRecordsByStats(rec []Record, stat []balancer.Statistics) ([]Record, error)
GetRecordsByStats returns the statistics of all records
type StatusType ¶
type StatusType struct {
Status `json:"status" toml:"status"` // status container for toml conversion
}
StatusType contains the status
func (*StatusType) UnmarshalJSON ¶
func (s *StatusType) UnmarshalJSON(text []byte) error
UnmarshalJSON converts json Status to Status uint8
func (*StatusType) UnmarshalText ¶
func (s *StatusType) UnmarshalText(text []byte) error
UnmarshalText converts json Status to Status uint8