summaryrefslogtreecommitdiff
path: root/internal/configuration/schema/ntp.go
blob: 7687601fe143ceb818a536b4e9b32e7e7921121c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package schema

import (
	"net/url"
	"time"
)

// NTP represents the configuration related to ntp server.
type NTP struct {
	Address             *AddressUDP   `koanf:"address" json:"address" jsonschema:"title=NTP Address" jsonschema_description:"The remote address of the NTP server."`
	Version             int           `koanf:"version" json:"version" jsonschema:"enum=3,enum=4,title=NTP Version" jsonschema_description:"The NTP Version to use."`
	MaximumDesync       time.Duration `koanf:"max_desync" json:"max_desync" jsonschema:"default=3 seconds,title=Maximum Desync" jsonschema_description:"The maximum amount of time that the server can be out of sync."`
	DisableStartupCheck bool          `koanf:"disable_startup_check" json:"disable_startup_check" jsonschema:"default=false,title=Disable Startup Check" jsonschema_description:"Disables the NTP Startup Check entirely."`
	DisableFailure      bool          `koanf:"disable_failure" json:"disable_failure" jsonschema:"default=false,title=Disable Failure" jsonschema_description:"Disables complete failure whe the Startup Check fails and instead just logs the error."`
}

// DefaultNTPConfiguration represents default configuration parameters for the NTP server.
var DefaultNTPConfiguration = NTP{
	Address:       &AddressUDP{Address{valid: true, socket: false, port: 123, url: &url.URL{Scheme: AddressSchemeUDP, Host: "time.cloudflare.com:123"}}},
	Version:       4,
	MaximumDesync: time.Second * 3,
}