From 121479e6705b86e888ec01bafb36ef2557f74630 Mon Sep 17 00:00:00 2001 From: Michiel Date: Wed, 11 Sep 2024 10:32:29 +0200 Subject: [PATCH] Fix typos --- README.md | 2 +- docs/development/ca.md | 4 ++-- docs/development/threat-model.md | 2 +- docs/guide/installation.md | 4 ++-- docs/guide/migrating-chrony.md | 2 +- docs/guide/migrating-ntpd.md | 2 +- docs/guide/migrating-ntpsec.md | 2 +- docs/guide/nts.md | 6 +++--- docs/guide/security-guidance.md | 2 +- ntp-proto/src/algorithm/kalman/config.rs | 2 +- ntp-proto/src/algorithm/kalman/mod.rs | 2 +- ntp-proto/src/algorithm/kalman/source.rs | 8 ++++---- ntp-proto/src/algorithm/mod.rs | 6 +++--- ntp-proto/src/config.rs | 2 +- ntp-proto/src/identifiers.rs | 2 +- ntp-proto/src/ipfilter.rs | 4 ++-- ntp-proto/src/nts_pool_ke.rs | 2 +- ntp-proto/src/nts_record.rs | 2 +- ntp-proto/src/packet/extension_fields.rs | 12 +++++------ ntp-proto/src/packet/mod.rs | 10 ++++----- ntp-proto/src/server.rs | 26 ++++++++++++------------ ntp-proto/src/source.rs | 4 ++-- ntp-proto/src/time_types.rs | 20 +++++++++--------- ntp-proto/src/tls_utils.rs | 2 +- ntpd/src/daemon/config/mod.rs | 2 +- ntpd/src/daemon/config/ntp_source.rs | 2 +- ntpd/src/daemon/ntp_source.rs | 6 +++--- ntpd/src/daemon/observer.rs | 2 +- ntpd/src/daemon/server.rs | 6 +++--- ntpd/src/daemon/spawn/mod.rs | 6 +++--- ntpd/src/metrics/exporter.rs | 4 ++-- ntpd/src/metrics/mod.rs | 2 +- nts-pool-ke/src/cli.rs | 2 +- 33 files changed, 81 insertions(+), 81 deletions(-) diff --git a/README.md b/README.md index 389edaf22..4dab56380 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ ntpd-rs.pool.ntp.org:123/162.159.200.123:123 (4): +0.000111±0.000076(±0.004066 Servers: ``` -The top part shows the overal quality of the time synchronization, and the time sources section shows which servers are used as well as offsets and uncertainties of those individual servers. +The top part shows the overall quality of the time synchronization, and the time sources section shows which servers are used as well as offsets and uncertainties of those individual servers. For more details on how to install and use ntpd-rs, see our [documentation website]. diff --git a/docs/development/ca.md b/docs/development/ca.md index 030824764..3dc209e8e 100644 --- a/docs/development/ca.md +++ b/docs/development/ca.md @@ -4,7 +4,7 @@ Setting up your own CA is not recommended except for development purposes and setting up internal-only networks. For all other purposes, we would - recommend to use a widely trusted CA for issueing certificates. See the + recommend to use a widely trusted CA for issuing certificates. See the [NTS guide](../guide/nts.md) for more information. Setting up NTS-KE when your server has no public domain name is still possible @@ -92,7 +92,7 @@ openssl x509 -req -in ntpd-rs.test.csr -CA ca.pem -CAkey ca.key -CAcreateserial The above command gives the certificate a period validity of 5 years. If a different lifetime is desired, change the number following the `-days` argument to the number of days the certificate should be valid. The generated certificate -should be concattenated together with the CA certificate, as ntpd-rs needs the +should be concatenated together with the CA certificate, as ntpd-rs needs the full certificate chain in order to operate. We can use a simple command to do this: diff --git a/docs/development/threat-model.md b/docs/development/threat-model.md index a0f6ef36e..30da75814 100644 --- a/docs/development/threat-model.md +++ b/docs/development/threat-model.md @@ -194,7 +194,7 @@ We model the following assets: Create - N/A Read - Never Create - N/A - Read - Someitmes + Read - Sometimes Create - Sometimes Read - Sometimes Create - Never diff --git a/docs/guide/installation.md b/docs/guide/installation.md index 76ce719d3..a2f070998 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -50,8 +50,8 @@ main NTP daemon. Running it from the command line to test it should provide outp 2023-09-04T12:01:44.071735Z INFO ntpd::daemon::system: new source source_id=SourceId(2) addr=162.159.200.1:123 spawner=SpawnerId(1) 2023-09-04T12:01:44.071944Z INFO ntpd::daemon::system: new source source_id=SourceId(3) addr=45.138.55.62:123 spawner=SpawnerId(1) 2023-09-04T12:01:44.072150Z INFO ntpd::daemon::system: new source source_id=SourceId(4) addr=213.154.236.182:123 spawner=SpawnerId(1) -2023-09-04T12:01:44.084626Z INFO ntp_proto::algorithm::kalman: No concensus cluster found -2023-09-04T12:01:44.085422Z INFO ntp_proto::algorithm::kalman: No concensus cluster found +2023-09-04T12:01:44.084626Z INFO ntp_proto::algorithm::kalman: No consensus cluster found +2023-09-04T12:01:44.085422Z INFO ntp_proto::algorithm::kalman: No consensus cluster found 2023-09-04T12:01:44.086879Z INFO ntp_proto::algorithm::kalman: Offset: 2.3686082232975885+-72.6249392570874ms, frequency: 0+-5773502.691896258ppm 2023-09-04T12:01:44.087846Z INFO ntp_proto::algorithm::kalman: Offset: 2.7204471636925773+-61.339759726948046ms, frequency: 0+-5000000.000000001ppm ``` diff --git a/docs/guide/migrating-chrony.md b/docs/guide/migrating-chrony.md index 4ffde1aa9..779043758 100644 --- a/docs/guide/migrating-chrony.md +++ b/docs/guide/migrating-chrony.md @@ -75,7 +75,7 @@ The current version of ntpd-rs does not yet support local reference clocks, but The minimum number of sources needed for time synchronization in ntpd-rs is configured through `minimum-agreeing-sources`: ```toml [synchronization] -mininum-agreeing-sources = +minimum-agreeing-sources = ``` Note that although the effect of this option is the same as chrony's `minsources`, the default in ntpd-rs is 3, rather than the default 1 source required by chrony. Although 3 is recommended for security, it may not be appropriate for all configurations, particularly configurations where few remote sources are configured. diff --git a/docs/guide/migrating-ntpd.md b/docs/guide/migrating-ntpd.md index 60d56d076..bc90d4fb3 100644 --- a/docs/guide/migrating-ntpd.md +++ b/docs/guide/migrating-ntpd.md @@ -55,7 +55,7 @@ The current version of ntpd-rs does not yet support local reference clocks, but The minimum number of time sources needed for time synchronization in ntpd-rs is configured through `minimum-agreeing-sources`: ```toml [synchronization] -mininum-agreeing-sources = +minimum-agreeing-sources = ``` If fewer agreeing source are available, no synchronization is performed and the clock will drift. This option is a combination of ntpd's `minclock` and `minsane`. Its default value is 3, the recommended value from a security perspective. In ntpd, a default of 3 is used for `minclock` and 1 for `minsane`. diff --git a/docs/guide/migrating-ntpsec.md b/docs/guide/migrating-ntpsec.md index 2fa5d69d9..4185061ee 100644 --- a/docs/guide/migrating-ntpsec.md +++ b/docs/guide/migrating-ntpsec.md @@ -76,7 +76,7 @@ The current version of ntpd-rs does not yet support local reference clocks, but The minimum number of time sources needed for time synchronization in ntpd-rs is configured through `minimum-agreeing-sources`: ```toml [synchronization] -mininum-agreeing-sources = +minimum-agreeing-sources = ``` If fewer agreeing source are available, no synchronization is performed and the clock will drift. This option is a combination of ntpd's `minclock` and `minsane`. Its default value is 3, the recommended value from a security perspective. In ntpd, a default of 3 is used for `minclock` and 1 for `minsane`. diff --git a/docs/guide/nts.md b/docs/guide/nts.md index 70a5b32b6..9c728b478 100644 --- a/docs/guide/nts.md +++ b/docs/guide/nts.md @@ -64,7 +64,7 @@ once to ensure that a third party cannot track its connection, and it receives a new cookie with each server response. These cookies are an opaque bag of bytes for the client, and the server can put -in them whatever it finds usefull for identifying the proper keys for that +in them whatever it finds useful for identifying the proper keys for that particular client. Cookies do however have to be unique, a cookie cannot be reused once a message with it was sent. If the client ever runs out of cookies (a cookie is lost whenever an NTP message or the response to that message got @@ -100,7 +100,7 @@ Once the NTS-KE server is setup the NTP server you have setup in your configuration will automatically start responding to valid NTS messages, there is no additional setup required. -Getting a certificate for your server can be a quite involved proces. We would +Getting a certificate for your server can be a quite involved process. We would recommend you use a [Let's Encrypt][1] ACME client for setting up a TLS certificate (similarly to how you would set this up for a webserver). Below you will find some examples using some popular clients. @@ -160,7 +160,7 @@ guide. Please read the [certbot documentation][3] for more details. Certbot automatically sets up a task that renews these certificates, because Let's Encrypt certificates are valid for only 90 days. The `--deploy-hook` -argument tells cerbot to restart the ntpd-rs daemon whenever a new certificate +argument tells certbot to restart the ntpd-rs daemon whenever a new certificate is issued, because ntpd-rs does not automatically reload the certificate files. We can now update our configuration with the paths of the generated certificate diff --git a/docs/guide/security-guidance.md b/docs/guide/security-guidance.md index 5ddc9d0e6..a64503e6c 100644 --- a/docs/guide/security-guidance.md +++ b/docs/guide/security-guidance.md @@ -13,7 +13,7 @@ Many of the measures against missteering increase the risk of unavailability and For instance, the risk of missteering is large if your system deals with public key cryptography. The security of the current web certificate system hinges on having a rough (<1day) consensus on what time it is. Similarly, the security and functioning of your applications may also be affected. A tradeoff that limits the risk of missteering is probably the correct choice. -On the other hand, a lack of synchronization can cause issues in a distributed system. Such systems require a small upper bound on the time difference between the machines they run on. When time synchronization fails the clocks can quickly drift outside of these bounds and the system may fail. Furthermore it may be most important that the machines are synchronized with each other, not necesarilly that they use the true time. Configuring ntpd-rs for maximum availability seems the best approach for this scenario. +On the other hand, a lack of synchronization can cause issues in a distributed system. Such systems require a small upper bound on the time difference between the machines they run on. When time synchronization fails the clocks can quickly drift outside of these bounds and the system may fail. Furthermore it may be most important that the machines are synchronized with each other, not necessarily that they use the true time. Configuring ntpd-rs for maximum availability seems the best approach for this scenario. Since there is no universally best solution to this tradeoff, you as the end user will have to consider which of these factors weighs more heavily, and adjust your configuration accordingly. diff --git a/ntp-proto/src/algorithm/kalman/config.rs b/ntp-proto/src/algorithm/kalman/config.rs index b6f8156b3..a336b817b 100644 --- a/ntp-proto/src/algorithm/kalman/config.rs +++ b/ntp-proto/src/algorithm/kalman/config.rs @@ -56,7 +56,7 @@ pub struct AlgorithmConfig { /// Maximum source uncertainty before we start disregarding it /// Note that this is combined uncertainty due to noise and - /// possible assymetry error (see also weights below). (seconds) + /// possible asymmetry error (see also weights below). (seconds) #[serde(default = "default_maximum_source_uncertainty")] pub maximum_source_uncertainty: f64, /// Weight of statistical uncertainty when constructing diff --git a/ntp-proto/src/algorithm/kalman/mod.rs b/ntp-proto/src/algorithm/kalman/mod.rs index f44e1866d..adb84991f 100644 --- a/ntp-proto/src/algorithm/kalman/mod.rs +++ b/ntp-proto/src/algorithm/kalman/mod.rs @@ -195,7 +195,7 @@ impl KalmanClockController { pub next_update: Option, } -// Note: this default implementation is neccessary since the +// Note: this default implementation is necessary since the // derive only works if SourceId is Default (which it isn't -// neccessarily) +// necessarily) impl Default for StateUpdate { fn default() -> Self { Self { @@ -60,7 +60,7 @@ pub trait TimeSyncController: Sized + Send + 'static { SourceMessage = Self::SourceMessage, >; - /// Create a new clock controller controling the given clock + /// Create a new clock controller controlling the given clock fn new( clock: Self::Clock, synchronization_config: SynchronizationConfig, diff --git a/ntp-proto/src/config.rs b/ntp-proto/src/config.rs index 335f36ef7..3f9c8d3fe 100644 --- a/ntp-proto/src/config.rs +++ b/ntp-proto/src/config.rs @@ -236,7 +236,7 @@ pub struct SynchronizationConfig { /// The maximum amount the system clock is allowed to change in a single go /// before we conclude something is seriously wrong. This is used to limit - /// the changes to the clock to reasonable ammounts, and stop issues with + /// the changes to the clock to reasonable amounts, and stop issues with /// remote servers from causing us to drift too far. /// /// Note that this is not used during startup. To limit system clock changes diff --git a/ntp-proto/src/identifiers.rs b/ntp-proto/src/identifiers.rs index 4f63779c0..6d1a813bf 100644 --- a/ntp-proto/src/identifiers.rs +++ b/ntp-proto/src/identifiers.rs @@ -91,7 +91,7 @@ mod tests { let b = ReferenceId::from_bytes(rep); assert_eq!(a, b); - // TODO: Generate and add a testcase for ipv6 adresses once + // TODO: Generate and add a testcase for ipv6 addresses once // we have access to an ipv6 network. } } diff --git a/ntp-proto/src/ipfilter.rs b/ntp-proto/src/ipfilter.rs index b779ab1ca..ea3385b7d 100644 --- a/ntp-proto/src/ipfilter.rs +++ b/ntp-proto/src/ipfilter.rs @@ -59,7 +59,7 @@ impl BitTree { // To calculate the child index we need to know how many symbols smaller // than our symbol are not decided here. We do this by generating the bitmap // of symbols neither in in or out, then masking out all symbols >=cur - // and finaly counting how many are left. + // and finally counting how many are left. let next_idx = node.child_offset + (!(node.inset | node.outset) & (cur - 1)).count_ones(); node = &self.nodes[next_idx as usize]; @@ -108,7 +108,7 @@ impl BitTree { match segment.first().copied() { // Probably empty, unless covered earlier, but we fix that later None => node.outset |= 1 << i, - // Definetly covered, mark all that is needed + // Definitely covered, mark all that is needed // Note that due to sorting order, len here // is guaranteed to be largest amongst all // parts of the segment diff --git a/ntp-proto/src/nts_pool_ke.rs b/ntp-proto/src/nts_pool_ke.rs index 67eed9798..0cfe5fad7 100644 --- a/ntp-proto/src/nts_pool_ke.rs +++ b/ntp-proto/src/nts_pool_ke.rs @@ -60,7 +60,7 @@ impl SupportedAlgorithmsDecoder { } } -/// Pool KE decoding records fron the client +/// Pool KE decoding records from the client #[derive(Debug, Default)] pub struct ClientToPoolDecoder { decoder: NtsRecordDecoder, diff --git a/ntp-proto/src/nts_record.rs b/ntp-proto/src/nts_record.rs index d4006ba83..de4f778c8 100644 --- a/ntp-proto/src/nts_record.rs +++ b/ntp-proto/src/nts_record.rs @@ -2236,7 +2236,7 @@ mod test { cookie_data: EXAMPLE_COOKIE_DATA.to_vec(), }; - // this fails. In theory it's allright if the protocol ID is not 0, + // this fails. In theory it's alright if the protocol ID is not 0, // but we do not support any. (we assume ntpv5 has the same behavior as ntpv4 here) let records = [ cookie.clone(), diff --git a/ntp-proto/src/packet/extension_fields.rs b/ntp-proto/src/packet/extension_fields.rs index ea553a0cc..abf69cf34 100644 --- a/ntp-proto/src/packet/extension_fields.rs +++ b/ntp-proto/src/packet/extension_fields.rs @@ -603,7 +603,7 @@ impl<'a> ExtensionFieldData<'a> { }; // the authenticated extension fields are always followed by the encrypted extension - // field. We don't (currently) encode a MAC, so the minimum size per RFC 7822 is 16 octecs + // field. We don't (currently) encode a MAC, so the minimum size per RFC 7822 is 16 octets let minimum_size = 16; for field in &self.authenticated { @@ -1059,7 +1059,7 @@ mod tests { let ef = ExtensionField::decode(raw, ExtensionHeaderVersion::V4).unwrap(); let ExtensionField::DraftIdentification(ref parsed) = ef else { - panic!("Unexpected extensionfield {ef:?}... expected DraftIdentification"); + panic!("Unexpected extension field {ef:?}... expected DraftIdentification"); }; assert_eq!(parsed, test_id); @@ -1134,7 +1134,7 @@ mod tests { .unwrap(); assert_eq!(w.len(), expected_size); - // NOTE: encryped fields do not have a minimum_size + // NOTE: encrypted fields do not have a minimum_size } #[test] @@ -1286,7 +1286,7 @@ mod tests { } #[test] - fn serialize_untrused_fields() { + fn serialize_untrusted_fields() { let cookie = ExtensionField::NtsCookie(Cow::Borrowed(&[0; 16])); let data = ExtensionFieldData { @@ -1312,7 +1312,7 @@ mod tests { } #[test] - fn serialize_untrused_fields_smaller_than_minimum() { + fn serialize_untrusted_fields_smaller_than_minimum() { let cookie = ExtensionField::NtsCookie(Cow::Borrowed(&[0; 4])); let data = ExtensionFieldData { @@ -1400,7 +1400,7 @@ mod tests { let n = cursor.position() as usize; let slice = &w.as_slice()[..n]; - // now use a differnt (valid) cipher for deserialization + // now use a different (valid) cipher for deserialization let c2s = [0; 32]; let cipher = AesSivCmac256::new(c2s.into()); diff --git a/ntp-proto/src/packet/mod.rs b/ntp-proto/src/packet/mod.rs index 140891e2b..0e032d3b8 100644 --- a/ntp-proto/src/packet/mod.rs +++ b/ntp-proto/src/packet/mod.rs @@ -767,7 +767,7 @@ impl<'a> NtpPacket<'a> { .into_iter() .filter(|ef| matches!(ef, ExtensionField::UniqueIdentifier(_))) .collect(), - // Ignore encrypted so as not to accidentaly leak anything + // Ignore encrypted so as not to accidentally leak anything untrusted: vec![], }, mac: None, @@ -841,7 +841,7 @@ impl<'a> NtpPacket<'a> { efdata: ExtensionFieldData { authenticated: vec![], encrypted: vec![], - // Ignore encrypted so as not to accidentaly leak anything + // Ignore encrypted so as not to accidentally leak anything untrusted: packet_from_client .efdata .untrusted @@ -858,7 +858,7 @@ impl<'a> NtpPacket<'a> { efdata: ExtensionFieldData { authenticated: vec![], encrypted: vec![], - // Ignore encrypted so as not to accidentaly leak anything + // Ignore encrypted so as not to accidentally leak anything untrusted: packet_from_client .efdata .untrusted @@ -925,7 +925,7 @@ impl<'a> NtpPacket<'a> { efdata: ExtensionFieldData { authenticated: vec![], encrypted: vec![], - // Ignore encrypted so as not to accidentaly leak anything + // Ignore encrypted so as not to accidentally leak anything untrusted: packet_from_client .efdata .untrusted @@ -942,7 +942,7 @@ impl<'a> NtpPacket<'a> { efdata: ExtensionFieldData { authenticated: vec![], encrypted: vec![], - // Ignore encrypted so as not to accidentaly leak anything + // Ignore encrypted so as not to accidentally leak anything untrusted: packet_from_client .efdata .untrusted diff --git a/ntp-proto/src/server.rs b/ntp-proto/src/server.rs index 6920d5234..b2bd98172 100644 --- a/ntp-proto/src/server.rs +++ b/ntp-proto/src/server.rs @@ -39,7 +39,7 @@ pub enum ServerResponse { NTSNak, /// Sent a deny response to client Deny, - /// Only for a concious choice to not respond, error conditions are separate + /// Only for a conscious choice to not respond, error conditions are separate Ignore, /// Accepted packet and provided time to requestor ProvideTime, @@ -289,13 +289,13 @@ impl Server { /// /// For this use case we want fast /// -/// - lookups: for each incomming IP we must check when it last checked in -/// - inserts: for each incomming IP we store that its most recent checkin is now +/// - lookups: for each incoming IP we must check when it last checked in +/// - inserts: for each incoming IP we store that its most recent check-in is now /// -/// Hence, this data structure is a vector, and we use a simple hash function to turn the incomming +/// Hence, this data structure is a vector, and we use a simple hash function to turn the incoming /// address into an index. Lookups and inserts are therefore O(1). /// -/// The likelyhood of hash collisions can be controlled by changing the size of the cache. Hash collisions +/// The likelihood of hash collisions can be controlled by changing the size of the cache. Hash collisions /// will happen, so this cache should not be relied on if perfect alerting is deemed critical. #[derive(Debug)] struct TimestampedCache { @@ -479,7 +479,7 @@ mod tests { } } - fn serialize_packet_unencryped(send_packet: &NtpPacket) -> Vec { + fn serialize_packet_unencrypted(send_packet: &NtpPacket) -> Vec { let mut buf = vec![0; 1024]; let mut cursor = Cursor::new(buf.as_mut_slice()); send_packet.serialize(&mut cursor, &NoCipher, None).unwrap(); @@ -527,7 +527,7 @@ mod tests { ); let (packet, id) = NtpPacket::poll_message(PollIntervalLimits::default().min); - let serialized = serialize_packet_unencryped(&packet); + let serialized = serialize_packet_unencrypted(&packet); let mut buf = [0; 48]; let response = server.handle( @@ -635,7 +635,7 @@ mod tests { ); let (packet, id) = NtpPacket::poll_message(PollIntervalLimits::default().min); - let serialized = serialize_packet_unencryped(&packet); + let serialized = serialize_packet_unencrypted(&packet); let mut buf = [0; 48]; let response = server.handle( @@ -743,7 +743,7 @@ mod tests { ); let (packet, id) = NtpPacket::poll_message(PollIntervalLimits::default().min); - let serialized = serialize_packet_unencryped(&packet); + let serialized = serialize_packet_unencrypted(&packet); let mut buf = [0; 48]; let response = server.handle( @@ -918,7 +918,7 @@ mod tests { ); let (packet, _) = NtpPacket::poll_message(PollIntervalLimits::default().min); - let mut serialized = serialize_packet_unencryped(&packet); + let mut serialized = serialize_packet_unencrypted(&packet); let mut buf = [0; 1]; let response = server.handle( @@ -1190,7 +1190,7 @@ mod tests { ); let (packet, _) = NtpPacket::poll_message(PollIntervalLimits::default().min); - let serialized = serialize_packet_unencryped(&packet); + let serialized = serialize_packet_unencrypted(&packet); let mut buf = [0; 1024]; let response = server.handle( @@ -1239,7 +1239,7 @@ mod tests { server.update_config(config.clone()); let (packet, id) = NtpPacket::poll_message(PollIntervalLimits::default().min); - let serialized = serialize_packet_unencryped(&packet); + let serialized = serialize_packet_unencrypted(&packet); let response = server.handle( "127.0.0.1".parse().unwrap(), NtpTimestamp::from_fixed_int(100), @@ -1289,7 +1289,7 @@ mod tests { ); let (packet, id) = NtpPacket::poll_message_v5(PollIntervalLimits::default().min); - let serialized = serialize_packet_unencryped(&packet); + let serialized = serialize_packet_unencrypted(&packet); let mut buf = [0; 1024]; let response = server.handle( diff --git a/ntp-proto/src/source.rs b/ntp-proto/src/source.rs index bd4e8713a..8908d26d2 100644 --- a/ntp-proto/src/source.rs +++ b/ntp-proto/src/source.rs @@ -58,7 +58,7 @@ impl std::fmt::Debug for SourceNtsData { pub struct NtpSource { nts: Option>, - // Poll interval used when sending last poll mesage. + // Poll interval used when sending last poll message. last_poll_interval: PollInterval, // The poll interval desired by the remove server. // Must be increased when the server sends the RATE kiss code. @@ -642,7 +642,7 @@ impl NtpSource { info!("Server does not support NTPv5, stopping the upgrade process"); self.protocol_version = ProtocolVersion::V4; } else { - debug!(tries_left, "Server did not yet responde with upgrade code"); + debug!(tries_left, "Server did not yet respond with upgrade code"); self.protocol_version = ProtocolVersion::V4UpgradingToV5 { tries_left }; }; } diff --git a/ntp-proto/src/time_types.rs b/ntp-proto/src/time_types.rs index 3d23d4d9a..5a35a0399 100644 --- a/ntp-proto/src/time_types.rs +++ b/ntp-proto/src/time_types.rs @@ -102,7 +102,7 @@ impl NtpTimestamp { // Around an era change, self can be near the maximum value // for NtpTimestamp and other near the minimum, and that must // be interpreted as self being before other (which it is due - // to wrapping in substraction of NtpTimestamp) + // to wrapping in subtraction of NtpTimestamp) self - other < NtpDuration::ZERO } @@ -152,7 +152,7 @@ impl Sub for NtpTimestamp { fn sub(self, rhs: Self) -> Self::Output { // In order to properly deal with ntp era changes, timestamps - // need to roll over. Doing a wrapping substract to a signed + // need to roll over. Doing a wrapping subtract to a signed // integer type always gives us the result as if the eras of // the timestamps were chosen to minimize the norm of the // difference, which is the desired behaviour @@ -297,7 +297,7 @@ impl NtpDuration { /// Get the number of seconds (first return value) and nanoseconds /// (second return value) representing the length of this duration. - /// The number of nanoseconds is guaranteed to be positiv and less + /// The number of nanoseconds is guaranteed to be positive and less /// than 10^9 pub const fn as_seconds_nanos(self) -> (i32, u32) { ( @@ -384,7 +384,7 @@ impl Add for NtpDuration { fn add(self, rhs: Self) -> Self::Output { // For duration, saturation is safer as that ensures - // addition or substraction of two big durations never + // addition or subtraction of two big durations never // unintentionally cancel, ensuring that filtering // can properly reject on the result. NtpDuration { @@ -396,7 +396,7 @@ impl Add for NtpDuration { impl AddAssign for NtpDuration { fn add_assign(&mut self, rhs: Self) { // For duration, saturation is safer as that ensures - // addition or substraction of two big durations never + // addition or subtraction of two big durations never // unintentionally cancel, ensuring that filtering // can properly reject on the result. self.duration = self.duration.saturating_add(rhs.duration); @@ -408,7 +408,7 @@ impl Sub for NtpDuration { fn sub(self, rhs: Self) -> Self::Output { // For duration, saturation is safer as that ensures - // addition or substraction of two big durations never + // addition or subtraction of two big durations never // unintentionally cancel, ensuring that filtering // can properly reject on the result. NtpDuration { @@ -420,7 +420,7 @@ impl Sub for NtpDuration { impl SubAssign for NtpDuration { fn sub_assign(&mut self, rhs: Self) { // For duration, saturation is safer as that ensures - // addition or substraction of two big durations never + // addition or subtraction of two big durations never // unintentionally cancel, ensuring that filtering // can properly reject on the result. self.duration = self.duration.saturating_sub(rhs.duration); @@ -444,7 +444,7 @@ macro_rules! ntp_duration_scalar_mul { fn mul(self, rhs: NtpDuration) -> NtpDuration { // For duration, saturation is safer as that ensures - // addition or substraction of two big durations never + // addition or subtraction of two big durations never // unintentionally cancel, ensuring that filtering // can properly reject on the result. NtpDuration { @@ -458,7 +458,7 @@ macro_rules! ntp_duration_scalar_mul { fn mul(self, rhs: $scalar_type) -> NtpDuration { // For duration, saturation is safer as that ensures - // addition or substraction of two big durations never + // addition or subtraction of two big durations never // unintentionally cancel, ensuring that filtering // can properly reject on the result. NtpDuration { @@ -470,7 +470,7 @@ macro_rules! ntp_duration_scalar_mul { impl MulAssign<$scalar_type> for NtpDuration { fn mul_assign(&mut self, rhs: $scalar_type) { // For duration, saturation is safer as that ensures - // addition or substraction of two big durations never + // addition or subtraction of two big durations never // unintentionally cancel, ensuring that filtering // can properly reject on the result. self.duration = self.duration.saturating_mul(rhs as i64); diff --git a/ntp-proto/src/tls_utils.rs b/ntp-proto/src/tls_utils.rs index 1bed50615..b57373f0d 100644 --- a/ntp-proto/src/tls_utils.rs +++ b/ntp-proto/src/tls_utils.rs @@ -1,5 +1,5 @@ /// The intent of this ClientCertVerifier is that it accepts any connections that are either -/// a.) not presenting a client certificicate +/// a.) not presenting a client certificate /// b.) are presenting a well-formed, but otherwise not checked (against a trust root) client certificate /// /// This is because RusTLS apparently doesn't accept every kind of self-signed certificate. diff --git a/ntpd/src/daemon/config/mod.rs b/ntpd/src/daemon/config/mod.rs index 7deb839e7..2b6237eab 100644 --- a/ntpd/src/daemon/config/mod.rs +++ b/ntpd/src/daemon/config/mod.rs @@ -99,7 +99,7 @@ impl CliArg { // split combined shorthand options for (n, char) in short_arg.trim_start_matches('-').chars().enumerate() { let flag = format!("-{char}"); - // convert option argument to seperate segment + // convert option argument to separate segment if takes_argument_short.contains(&char) { let rest = short_arg[(n + 2)..].trim().to_string(); // assignment syntax is not accepted for shorthand arguments diff --git a/ntpd/src/daemon/config/ntp_source.rs b/ntpd/src/daemon/config/ntp_source.rs index b932113a6..3e78e1f93 100644 --- a/ntpd/src/daemon/config/ntp_source.rs +++ b/ntpd/src/daemon/config/ntp_source.rs @@ -103,7 +103,7 @@ pub struct NormalizedAddress { pub(crate) server_name: String, pub(crate) port: u16, - /// Used to inject socket addrs into the DNS lookup result + /// Used to inject socket address into the DNS lookup result #[cfg(test)] hardcoded_dns_resolve: HardcodedDnsResolve, } diff --git a/ntpd/src/daemon/ntp_source.rs b/ntpd/src/daemon/ntp_source.rs index 1558afa6b..d47ad6bed 100644 --- a/ntpd/src/daemon/ntp_source.rs +++ b/ntpd/src/daemon/ntp_source.rs @@ -655,7 +655,7 @@ mod tests { handle.abort(); } - fn serialize_packet_unencryped(send_packet: &NtpPacket) -> [u8; 48] { + fn serialize_packet_unencrypted(send_packet: &NtpPacket) -> [u8; 48] { let mut buf = [0; 48]; let mut cursor = Cursor::new(buf.as_mut_slice()); send_packet.serialize(&mut cursor, &NoCipher, None).unwrap(); @@ -706,7 +706,7 @@ mod tests { &clock, ); - let serialized = serialize_packet_unencryped(&send_packet); + let serialized = serialize_packet_unencrypted(&send_packet); socket.send_to(&serialized, remote_addr).await.unwrap(); let msg = msg_recv.recv().await.unwrap(); @@ -741,7 +741,7 @@ mod tests { let rec_packet = NtpPacket::deserialize(&buf, &NoCipher).unwrap().0; let send_packet = NtpPacket::deny_response(rec_packet); - let serialized = serialize_packet_unencryped(&send_packet); + let serialized = serialize_packet_unencrypted(&send_packet); // Flush earlier messages while msg_recv.try_recv().is_ok() {} diff --git a/ntpd/src/daemon/observer.rs b/ntpd/src/daemon/observer.rs index 1d502f7ba..92b700847 100644 --- a/ntpd/src/daemon/observer.rs +++ b/ntpd/src/daemon/observer.rs @@ -328,7 +328,7 @@ mod tests { let mut reader = UnixStream::connect(path).await.unwrap(); // We do a small partial read of the data to test that whatever - // happens, the observer doesnt keep a lock alive on either of + // happens, the observer doesn't keep a lock alive on either of // of the RwLocks. let mut buf = [0_u8; 12]; let mut bufref: &mut [u8] = &mut buf; diff --git a/ntpd/src/daemon/server.rs b/ntpd/src/daemon/server.rs index 35d39622d..0e1475dfd 100644 --- a/ntpd/src/daemon/server.rs +++ b/ntpd/src/daemon/server.rs @@ -165,7 +165,7 @@ impl ServerTask { } }; - // system and keysetmay now be wildly out of date, ensure they are always updated. + // system and keyset may now be wildly out of date, ensure they are always updated. self.server .update_system(*self.system_receiver.borrow_and_update()); self.server @@ -280,7 +280,7 @@ mod tests { } } - fn serialize_packet_unencryped(send_packet: &NtpPacket) -> Vec { + fn serialize_packet_unencrypted(send_packet: &NtpPacket) -> Vec { let mut buf = vec![0; MAX_PACKET_SIZE]; let mut cursor = Cursor::new(buf.as_mut_slice()); send_packet.serialize(&mut cursor, &NoCipher, None).unwrap(); @@ -317,7 +317,7 @@ mod tests { let mut socket = socket.connect("127.0.0.1:9000".parse().unwrap()).unwrap(); let (packet, id) = NtpPacket::poll_message(PollIntervalLimits::default().min); - let serialized = serialize_packet_unencryped(&packet); + let serialized = serialize_packet_unencrypted(&packet); socket.send(&serialized).await.unwrap(); let mut buf = [0; 48]; diff --git a/ntpd/src/daemon/spawn/mod.rs b/ntpd/src/daemon/spawn/mod.rs index 3bcfff422..c60e09839 100644 --- a/ntpd/src/daemon/spawn/mod.rs +++ b/ntpd/src/daemon/spawn/mod.rs @@ -34,7 +34,7 @@ impl Default for SpawnerId { } /// Unique identifier for a source. -/// This soiurce id makes sure that even if the network address is the same +/// This source id makes sure that even if the network address is the same /// that we always know which specific spawned source we are talking about. #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash, Serialize, Deserialize)] pub struct SourceId(u64); @@ -164,10 +164,10 @@ pub trait Spawner { async fn handle_source_removed(&mut self, event: SourceRemovedEvent) -> Result<(), Self::Error>; - /// Event handler for when a source is succesfully registered in the system + /// Event handler for when a source is successfully registered in the system /// /// Every time the spawner sends a source to the system this handler will - /// eventually be called when the system has sucessfully registered the source + /// eventually be called when the system has successfully registered the source /// and will start polling it for ntp packets. /// /// This should just do bookkeeping, any adding of sources should be done diff --git a/ntpd/src/metrics/exporter.rs b/ntpd/src/metrics/exporter.rs index e09d3670b..998f1880f 100644 --- a/ntpd/src/metrics/exporter.rs +++ b/ntpd/src/metrics/exporter.rs @@ -256,13 +256,13 @@ async fn handle_connection( Err(e) => { tracing::warn!("hit an error: {e}"); - const ERROR_REPONSE: &str = concat!( + const ERROR_RESPONSE: &str = concat!( "HTTP/1.1 500 Internal Server Error\r\n", "content-type: text/plain\r\n", "content-length: 0\r\n\r\n", ); - stream.write_all(ERROR_REPONSE.as_bytes()).await?; + stream.write_all(ERROR_RESPONSE.as_bytes()).await?; } } Ok(()) diff --git a/ntpd/src/metrics/mod.rs b/ntpd/src/metrics/mod.rs index e042278a6..14544082e 100644 --- a/ntpd/src/metrics/mod.rs +++ b/ntpd/src/metrics/mod.rs @@ -226,7 +226,7 @@ pub fn format_state(w: &mut impl std::fmt::Write, state: &ObservableState) -> st format_metric( w, "ntp_source_unanswered_polls", - "Number of polls since the last succesful poll with a maximum of eight", + "Number of polls since the last successful poll with a maximum of eight", MetricType::Gauge, None, collect_sources!(state, |p| p.unanswered_polls), diff --git a/nts-pool-ke/src/cli.rs b/nts-pool-ke/src/cli.rs index a5c79f128..c3260797b 100644 --- a/nts-pool-ke/src/cli.rs +++ b/nts-pool-ke/src/cli.rs @@ -80,7 +80,7 @@ impl CliArg { // split combined shorthand options for (n, char) in short_arg.trim_start_matches('-').chars().enumerate() { let flag = format!("-{char}"); - // convert option argument to seperate segment + // convert option argument to separate segment if takes_argument_short.contains(&char) { let rest = short_arg[(n + 2)..].trim().to_string(); // assignment syntax is not accepted for shorthand arguments