@@ -25,26 +25,22 @@ import (
2525)
2626
2727var (
28- ErrAuthFailed = errors .New ("authentication failed" )
29- ErrAuthNAK = errors .New ("authentication NAK received" )
30- ErrExtensionsNotSupported = errors .New ("NTPV3 does not support extension fields" )
31- ErrInvalidAuthKey = errors .New ("invalid authentication key" )
32- ErrInvalidDispersion = errors .New ("invalid dispersion in response" )
33- ErrInvalidDraftID = errors .New ("invalid draft ID value in response" )
34- ErrInvalidExtensionField = errors .New ("invalid extension field in response" )
35- ErrInvalidLeapSecond = errors .New ("invalid leap second in response" )
36- ErrInvalidMode = errors .New ("invalid mode in response" )
37- ErrInvalidProtocolVersion = errors .New ("invalid protocol version requested" )
38- ErrInvalidReferenceRequest = errors .New ("invalid reference ID request" )
39- ErrInvalidStratum = errors .New ("invalid stratum in response" )
40- ErrInvalidTime = errors .New ("invalid time reported" )
41- ErrInvalidTransmitTime = errors .New ("invalid transmit time in response" )
42- ErrKissOfDeath = errors .New ("kiss of death received" )
43- ErrServerClockFreshness = errors .New ("server clock not fresh" )
44- ErrServerNotSynchronized = errors .New ("NTPv5 server not synchronized" )
45- ErrServerResponseMismatch = errors .New ("server response didn't match request" )
46- ErrServerTickedBackwards = errors .New ("server clock ticked backwards" )
47- ErrUnexpectedCorrectionField = errors .New ("unexpected correction extension field in response" )
28+ ErrAuthFailed = errors .New ("authentication MAC verification failed" )
29+ ErrAuthNAK = errors .New ("authentication NAK received" )
30+ ErrExtensionsNotSupported = errors .New ("NTPV3 does not support extension fields" )
31+ ErrInvalidAuthKey = errors .New ("invalid authentication key" )
32+ ErrInvalidDispersion = errors .New ("invalid dispersion in response" )
33+ ErrInvalidLeapSecond = errors .New ("invalid leap second in response" )
34+ ErrInvalidMode = errors .New ("invalid mode in response" )
35+ ErrInvalidProtocolVersion = errors .New ("invalid protocol version requested" )
36+ ErrInvalidStratum = errors .New ("invalid stratum in response" )
37+ ErrInvalidTime = errors .New ("invalid time reported" )
38+ ErrInvalidTransmitTime = errors .New ("invalid transmit time in response" )
39+ ErrKissOfDeath = errors .New ("kiss of death received" )
40+ ErrServerClockFreshness = errors .New ("server clock not fresh" )
41+ ErrServerNotSynchronized = errors .New ("NTPv5 server not synchronized" )
42+ ErrServerResponseMismatch = errors .New ("server response didn't match request" )
43+ ErrServerTickedBackwards = errors .New ("server clock ticked backwards" )
4844)
4945
5046// Internal constants
@@ -147,6 +143,10 @@ type QueryOptions struct {
147143 // NTPv5.
148144 AdditionalTimescales []Timescale
149145
146+ // ServerCookie contains the server cookie returned by a prior server
147+ // response when operating in interleaved mode. Used only in NTPv5.
148+ ServerCookie uint64
149+
150150 // Auth contains the options used to configure symmetric key
151151 // authentication. See RFC 5905 for further details. For NTPv3 and NTPv4,
152152 // this results in a MAC or digest being appended to the end of the NTP
@@ -155,22 +155,23 @@ type QueryOptions struct {
155155 // authentication.
156156 Auth AuthOptions
157157
158- // Extensions may be added in order to (a) modify NTP queries before they
159- // are transmitted and (b) process NTP responses after they arrive. When
160- // building an NTP request, extensions are processed in the order listed.
161- // When processing a server response, extensions are processed in reverse
162- // order.
158+ // Extensions may be provided in order to (a) modify NTP queries before
159+ // they are transmitted and (b) process NTP responses after they arrive.
160+ // When building an NTP request, these extensions are processed in the
161+ // order listed. When processing a server response, they are processed in
162+ // reverse order. An example of an extension is one that implements
163+ // Network Time Security (NTS). See: https://github.com/beevik/nts.
163164 Extensions []Extension
164165
165166 // GetSystemTime is a callback used to override the default method of
166167 // obtaining the local system time during time synchronization. If not
167168 // specified, time.Now is used.
168169 GetSystemTime func () time.Time
169170
170- // ReferenceIDRequest is an optional field used to request NTPv5 reference
171- // ID bloom filter values. The filter values are returned in the Response
172- // struct's ReferenceIDFilterValues field . Used only in NTPv5.
173- ReferenceIDRequest ReferenceIDRequest
171+ // RequestReferenceID is a struct used to request reference ID bloom
172+ // filter values, which are returned in the ReferenceIDFilterValues field
173+ // of the response . Used only in NTPv5.
174+ RequestReferenceID ReferenceIDRequest
174175
175176 // RequestSupportedVersions indicates whether to request which versions of
176177 // the NTP protocol are supported by the server in its response. Used only
@@ -199,10 +200,6 @@ type QueryOptions struct {
199200 // only in NTPv5.
200201 RequestInterleavedMode bool
201202
202- // ServerCookie contains the server cookie returned by a prior server
203- // response when operating in interleaved mode. Used only in NTPv5.
204- ServerCookie uint64
205-
206203 // Dialer is a callback used to override the default UDP network dialer.
207204 // The localAddress is directly copied from the LocalAddress field
208205 // specified in QueryOptions. It may be the empty string or a host address
0 commit comments