Skip to content

Commit

Permalink
add NTPAddr override
Browse files Browse the repository at this point in the history
  • Loading branch information
lambchr committed Sep 19, 2024
1 parent 0693357 commit d9e2335
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type Session struct {
type SessionOptions struct {
TLSConfig *tls.Config // TLS configuration for NTS key exchange, only used in the defaultDialer
Dialer func(network, addr string) (*tls.Conn, error) // Dialer returns a net.Conn that has completed a TLS handshake, if nil the defaultDialer is used
NTPAddr string // NTPAddr overrides the NTP address discovered from the NTS connection, this can be used with the custom Dialer when traversing a proxy
}

// NewSession creates an NTS session by connecting to an NTS key-exchange
Expand Down Expand Up @@ -89,6 +90,10 @@ func NewSessionWithOptions(address string, opt *SessionOptions) (*Session, error
if err != nil {
return nil, err
}

if opt.NTPAddr != "" {
s.ntpAddr = opt.NTPAddr
}
return s, nil
}

Expand Down

0 comments on commit d9e2335

Please sign in to comment.