Documentation ¶
Overview ¶
Package nts provides a client implementation of Network Time Security (NTS) for the Network Time Protocol (NTP). It enables the secure querying of time-related information that can be used to synchronize the local system clock with a more accurate network clock. See RFC 8915 (https://tools.ietf.org/html/rfc8915) for more details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrAuthFailedOnClient = errors.New("authentication failed on client") ErrAuthFailedOnServer = errors.New("authentication failed on server") ErrInvalidFormat = errors.New("invalid packet format") ErrNoCookies = errors.New("no NTS cookies available") ErrUniqueIDMismatch = errors.New("client and server unique ID mismatch") )
var ErrKeyExchangeFailed = errors.New("key exchange failure")
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session contains the state of an active NTS session. It is initialized by exchanging keys and cookies with an NTS key-exchange server, after which the connection to the key-exchange server is immediately dropped. The session's internal state is updated as NTP queries are made against an NTS-capable NTP server.
func NewSession ¶
NewSession creates an NTS session by connecting to an NTS key-exchange server and requesting keys and cookies to be used for future secure NTP queries. Once keys and cookies have been received, the connection is dropped. The address is of the form "host", "host:port", "host%zone:port", "[host]:port" or "[host%zone]:port". If no port is included, NTS default port 4460 is used.
func (*Session) Address ¶
Address returns the NTP server "host:port" pair configured for the session.
func (*Session) Query ¶
Query time data from the session's associated NTP server. The response contains information from which an accurate local time can be determined.
func (*Session) QueryWithOptions ¶
QueryWithOptions performs the same function as Query but allows for the customization of certain NTP behaviors.