Documentation ¶
Overview ¶
Package server implements simple UDP server to work with NTP packets. In addition, it run checker, announce and stats implementations
Index ¶
Constants ¶
This section is empty.
Variables ¶
DefaultServerIPs is a default list of IPs server will bind to if nothing else is specified
Functions ¶
This section is empty.
Types ¶
type Announce ¶
type Announce interface { // Do the announcement // Usually here advertise config is renewed // Unblocking. Run periodically Advertise([]net.IP) error // Stop announcement // Usually here advertise config is deleted Withdraw() error }
Announce is an announce interface
type Checker ¶
type Checker interface { // Check is a method which performs basic validations that responder is alive Check() error // IncListeners atomically add 1 to the counter IncListeners() // IncWorkers atomically add 1 to the counter IncWorkers() // DecListeners atomically removes 1 from the counter DecListeners() // DecWorkers atomically removes 1 from the counter DecWorkers() }
Checker is an internal healthcheck interface
type Config ¶
type Config struct { ExtraOffset time.Duration Iface string IPs MultiIPs ManageLoopback bool MonitoringPort int Port int RefID string ShouldAnnounce bool Stratum int TimestampType timestamp.Timestamp Workers int // contains filtered or unexported fields }
Config is a server config structure
type MultiIPs ¶
MultiIPs is a wrapper allowing to set multiple IPs with flag parser
func (*MultiIPs) SetDefault ¶
func (m *MultiIPs) SetDefault()
SetDefault adds all checks to the runlist
type Server ¶
type Server struct { Config Config Announce Announce Stats Stats Checker Checker // contains filtered or unexported fields }
Server is a type for UDP server which handles connections.
func (*Server) DeleteAllIPs ¶
func (s *Server) DeleteAllIPs()
DeleteAllIPs deletes all IPs from interface specified in config
type Stats ¶
type Stats interface { // Start starts a stat reporter // Use this for passive reporters Start(int) // IncInvalidFormat atomically add 1 to the counter IncInvalidFormat() // IncRequests atomically add 1 to the counter IncRequests() // IncResponses atomically add 1 to the counter IncResponses() // IncListeners atomically add 1 to the counter IncListeners() // IncWorkers atomically add 1 to the counter IncWorkers() // IncReadError atomically add 1 to the counter IncReadError() // DecListeners atomically removes 1 from the counter DecListeners() // DecWorkers atomically removes 1 from the counter DecWorkers() // SetAnnounce atomically sets counter to 1 SetAnnounce() // ResetAnnounce atomically sets counter to 0 ResetAnnounce() }
Stats is a metric collection interface
Click to show internal directories.
Click to hide internal directories.