Add possibility to define your own ntp servers

This commit is contained in:
9seconds
2020-03-20 14:32:23 +03:00
parent efdac2c0d8
commit 8e29ff78ba
3 changed files with 17 additions and 8 deletions
+8
View File
@@ -68,6 +68,8 @@ const (
OptionTypeMultiplexPerConnection
OptionTypeNTPServers
OptionTypeSecret
OptionTypeAdtag
)
@@ -96,6 +98,7 @@ type Config struct {
Verbose bool `json:"verbose"`
SecretMode SecretMode `json:"secret_mode"`
PreferIP PreferIP `json:"prefer_ip"`
NTPServers []string `json:"ntp_servers"`
Secret []byte `json:"secret"`
AdTag []byte `json:"adtag"`
@@ -165,6 +168,11 @@ func Init(options ...Opt) error { // nolint: gocyclo, funlen
C.AntiReplayMaxSize = int(opt.Value.(units.Base2Bytes))
case OptionTypeMultiplexPerConnection:
C.MultiplexPerConnection = int(opt.Value.(uint))
case OptionTypeNTPServers:
C.NTPServers = opt.Value.([]string)
if len(C.NTPServers) == 0 {
return errors.New("ntp server list is empty")
}
case OptionTypeSecret:
C.Secret = opt.Value.([]byte)
case OptionTypeAdtag: