4
4
===
5
5
6
6
The ntp package is an implementation of a Simple NTP (SNTP) client based on
7
- [ RFC5905 ] ( https://tools.ietf.org/html/rfc5905 ) . It allows you to connect to
7
+ [ RFC 5905 ] ( https://tools.ietf.org/html/rfc5905 ) . It allows you to connect to
8
8
a remote NTP server and request information about the current time.
9
9
10
10
@@ -17,9 +17,9 @@ time, err := ntp.Time("0.beevik-ntp.pool.ntp.org")
17
17
```
18
18
19
19
20
- ## Querying time metadata
20
+ ## Querying time synchronization data
21
21
22
- To obtain the current time as well as some additional metadata about the time ,
22
+ To obtain the current time as well as some additional synchronization data ,
23
23
use the [ ` Query ` ] ( https://godoc.org/github.com/beevik/ntp#Query ) function:
24
24
``` go
25
25
response , err := ntp.Query (" 0.beevik-ntp.pool.ntp.org" )
@@ -28,11 +28,11 @@ time := time.Now().Add(response.ClockOffset)
28
28
29
29
The [ ` Response ` ] ( https://godoc.org/github.com/beevik/ntp#Response ) structure
30
30
returned by ` Query ` includes the following information:
31
- * ` Time ` : The time the server transmitted its response, according to its own
32
- clock.
33
31
* ` ClockOffset ` : The estimated offset of the local system clock relative to
34
32
the server's clock. For a more accurate time reading, you may add this
35
33
offset to any subsequent system clock reading.
34
+ * ` Time ` : The time the server transmitted its response, according to its own
35
+ clock.
36
36
* ` RTT ` : An estimate of the round-trip-time delay between the client and the
37
37
server.
38
38
* ` Precision ` : The precision of the server's clock reading.
@@ -57,8 +57,8 @@ returned by `Query` includes the following information:
57
57
server.
58
58
59
59
The ` Response ` structure's [ ` Validate ` ] ( https://godoc.org/github.com/beevik/ntp#Response.Validate )
60
- method performs additional sanity checks to determine whether the response is
61
- suitable for time synchronization purposes.
60
+ function performs additional sanity checks to determine whether the response
61
+ is suitable for time synchronization purposes.
62
62
``` go
63
63
err := response.Validate ()
64
64
if err == nil {
@@ -80,16 +80,16 @@ include:
80
80
* ` Timeout ` : How long to wait before giving up on a response from the NTP
81
81
server.
82
82
* ` Version ` : Which version of the NTP protocol to use (2, 3 or 4).
83
- * ` LocalAddress ` : The local network address to use when connecting to the
84
- server.
85
- * ` Port ` : The remote NTP server port to contact.
86
83
* ` TTL ` : The maximum number of IP hops before the request packet is discarded.
87
84
* ` Auth ` : The symmetric authentication key and algorithm used by the server to
88
85
authenticate the query. The same information is used by the client to
89
86
authenticate the server's response.
87
+ * ` Extensions ` : Extensions may be added to modify NTP queries before they are
88
+ transmitted and to process NTP responses after they arrive.
90
89
* ` Dial ` : A custom network connection "dialer" function used to override the
91
90
default UDP dialer function.
92
91
92
+
93
93
## Using the NTP pool
94
94
95
95
The NTP pool is a shared resource provided by the [ NTP Pool
@@ -98,3 +98,12 @@ over the world. To prevent it from becoming overloaded, please avoid querying
98
98
the standard ` pool.ntp.org ` zone names in your applications. Instead, consider
99
99
requesting your own [ vendor zone] ( http://www.pool.ntp.org/en/vendors.html ) or
100
100
[ joining the pool] ( http://www.pool.ntp.org/join.html ) .
101
+
102
+
103
+ ## Network Time Security (NTS)
104
+
105
+ Network Time Security (NTS) is a recent enhancement of NTP, designed to add
106
+ better authentication and message integrity to the protocol. It is defined by
107
+ [ RFC 8915] ( https://tools.ietf.org/html/rfc8915 ) . If you wish to use NTS, see
108
+ the [ nts package] ( https://github.com/beevik/nts ) . (The nts package is
109
+ implemented as an extension to this package.)
0 commit comments