1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// Copyright 2026 U.S. Federal Government (in countries where recognized)
// SPDX-License-Identifier: Apache-2.0
//! NTP server library with tokio/smol runtime support and NTS-KE.
//!
//! This crate provides NTPv4 server implementations using either the tokio
//! or smol async runtimes, with optional NTS (Network Time Security) support.
//!
//! # Feature Flags
//!
//! | Feature | Default | Description |
//! |---------|---------|-------------|
//! | `tokio` | no | NTP server using the tokio runtime. |
//! | `smol-runtime` | no | NTP server using the smol runtime. |
//! | `nts` | no | NTS-KE server (RFC 8915) via tokio + tokio-rustls. Implies `tokio`. |
//! | `nts-smol` | no | NTS-KE server via smol + futures-rustls. Implies `smol-runtime`. Cannot be combined with `nts` (different TLS backends). |
//! | `pq-nts` | no | Enable post-quantum key exchange for NTS (ML-KEM via aws-lc-rs). |
//! | `symmetric` | no | NTP symmetric passive mode (RFC 5905 mode 2). |
//! | `broadcast` | no | NTP broadcast mode (mode 5). Deprecated by RFC 8633. |
//! | `refclock` | no | Reference clock support for Stratum 1. Implies `tokio`, pulls in `ntp_usg-client`. |
//! | `gps` | no | GPS reference clock driver. Implies `refclock`. |
//! | `pps` | no | PPS reference clock driver. Implies `refclock`. |
//! | `socket-opts` | no | DSCP, `IPV6_V6ONLY`, and multicast socket options via `socket2`. |
//! | `ipv4` | no | Default to `0.0.0.0` instead of `[::]` for listen addresses. |
//! | `ntpv5` | no | NTPv5 draft support (draft-ietf-ntp-ntpv5). |
// Re-export protocol types from ntp_proto for convenience.
pub use ;
/// Custom error types for the NTP server.
/// Shared NTS logic re-exported from `ntp_proto`.
pub use nts_common;
/// TLS configuration for NTS-KE server (crypto provider selection).
pub
/// Default listen address based on the `ipv4` feature flag.
///
/// Without `ipv4`: binds to `[::]` (IPv6 dual-stack, accepts both IPv4 and IPv6).
/// With `ipv4`: binds to `0.0.0.0` (IPv4 only).
pub
/// Socket options for `IPV6_V6ONLY` and DSCP/Traffic Class control.
/// Shared types and logic for the NTP server.
///
/// Provides request validation, response building, rate limiting, access control,
/// and interleaved mode tracking per RFC 5905, RFC 8633, and RFC 9769.
/// NTP server using the Tokio runtime.
///
/// Provides a configurable NTPv4 server that responds to client requests.
/// NTP server using the smol runtime.
///
/// Provides the same server functionality as [`server`] but using the smol
/// async runtime.
/// Shared NTS server logic (cookie generation, master key management, NTS request processing).
/// Shared NTS-KE server logic (config, record processing, key exchange).
pub
/// NTS-KE server using the Tokio runtime (RFC 8915).
///
/// Provides a TLS 1.3 listener for NTS Key Establishment, distributing cookies
/// and negotiating AEAD algorithms with NTS clients.
/// NTS-KE server using the smol runtime (RFC 8915).
///
/// Provides the same NTS-KE server functionality as [`nts_ke_server`] but
/// using the smol async runtime and futures-rustls.
/// NTP broadcast mode (mode 5) packet building per RFC 5905 Section 8.
///
/// Deprecated by BCP 223 (RFC 8633) but implemented for spec completeness.
/// IPv6 multicast NTP discovery support.
///
/// Extends broadcast mode with IPv6-specific multicast group management
/// using `socket2` for `IPV6_JOIN_GROUP` socket options.