diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d027f93ccf..6442633b93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -213,6 +213,20 @@ jobs: - name: clippy check (default features) run: cargo clippy --workspace --all-targets + check_typos: + timeout-minutes: 30 + name: Checking typos + runs-on: ubuntu-latest + env: + RUSTC_WRAPPER: "sccache" + SCCACHE_GHA_ENABLED: "on" + steps: + - uses: actions/checkout@v4 + - uses: taiki-e/install-action@v2 + with: + tool: typos-cli + - run: typos + msrv: if: "github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')" timeout-minutes: 30 diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000000..7e3b220d66 --- /dev/null +++ b/.typos.toml @@ -0,0 +1,25 @@ +[files] +# We can't change the `CHANGELOG` without changing old commit message +extend-exclude = [ + "CHANGELOG_old.md", + "CHANGELOG.md" +] + +[default] +extend-ignore-re = [ + # Line ignore with trailing `// spellchecker:disable-line` + "(?Rm)^.*(#|//)\\s*spellchecker:disable-line$", + + # Abbreviations + "UPnP", + + # Library name + "tung", + + # Hex + "ba", +] + +[default.extend-words] +# Library name +ratatui = "ratatui" diff --git a/iroh-blobs/src/downloader.rs b/iroh-blobs/src/downloader.rs index b0f605fe4e..2f8e3bc7db 100644 --- a/iroh-blobs/src/downloader.rs +++ b/iroh-blobs/src/downloader.rs @@ -87,7 +87,7 @@ pub trait Dialer: Stream)> + Un pub enum FailureAction { /// The request was cancelled by us. AllIntentsDropped, - /// An error ocurred that prevents the request from being retried at all. + /// An error occurred that prevents the request from being retried at all. AbortRequest(anyhow::Error), /// An error occurred that suggests the node should not be used in general. DropPeer(anyhow::Error), diff --git a/iroh-blobs/src/export.rs b/iroh-blobs/src/export.rs index cdbda28881..38008251ba 100644 --- a/iroh-blobs/src/export.rs +++ b/iroh-blobs/src/export.rs @@ -37,7 +37,7 @@ pub async fn export( } } -/// Export all entries of a collection, recursively, to files on the local fileystem. +/// Export all entries of a collection, recursively, to files on the local filesystem. pub async fn export_collection( db: &D, hash: Hash, @@ -55,7 +55,7 @@ pub async fn export_collection( Ok(()) } -/// Export a single blob to a file on the local fileystem. +/// Export a single blob to a file on the local filesystem. pub async fn export_blob( db: &D, hash: Hash, diff --git a/iroh-blobs/src/store/bao_file.rs b/iroh-blobs/src/store/bao_file.rs index 388b85ac60..962a7240b7 100644 --- a/iroh-blobs/src/store/bao_file.rs +++ b/iroh-blobs/src/store/bao_file.rs @@ -275,7 +275,7 @@ impl Default for BaoFileStorage { impl BaoFileStorage { /// Take the storage out, leaving an empty storage in its place. /// - /// Be careful to put somethign back in its place, or you will lose data. + /// Be careful to put something back in its place, or you will lose data. #[cfg(feature = "fs-store")] pub fn take(&mut self) -> Self { std::mem::take(self) diff --git a/iroh-blobs/src/store/traits.rs b/iroh-blobs/src/store/traits.rs index 2a91d1c0f3..762e511cd3 100644 --- a/iroh-blobs/src/store/traits.rs +++ b/iroh-blobs/src/store/traits.rs @@ -131,7 +131,7 @@ pub trait BaoBatchWriter { /// Write a batch of bao content items to the underlying storage. /// /// The batch is guaranteed to be sorted as data is received from the network. - /// So leafs will be sorted by offset, and parents will be sorted by pre order + /// So leaves will be sorted by offset, and parents will be sorted by pre order /// traversal offset. There is no guarantee that they will be consecutive /// though. /// diff --git a/iroh-dns-server/examples/publish.rs b/iroh-dns-server/examples/publish.rs index cb31dc3112..c7cb0337a5 100644 --- a/iroh-dns-server/examples/publish.rs +++ b/iroh-dns-server/examples/publish.rs @@ -58,7 +58,7 @@ async fn main() -> Result<()> { s } Err(_) => { - bail!("Environtment variable IROH_SECRET is not set. To create a new secret, use the --create option.") + bail!("Environment variable IROH_SECRET is not set. To create a new secret, use the --create option.") } }; diff --git a/iroh-dns-server/src/http/doh/extract.rs b/iroh-dns-server/src/http/doh/extract.rs index 819791c563..8973d5da3c 100644 --- a/iroh-dns-server/src/http/doh/extract.rs +++ b/iroh-dns-server/src/http/doh/extract.rs @@ -80,7 +80,7 @@ pub struct DnsQuery { /// Privacy setting for how your IP address is forwarded to authoritative nameservers #[allow(dead_code)] pub edns_client_subnet: Option, - /// Some url-safe random characters to pad your messages for privacy (to avoid being fingerprinted by encrytped message length) + /// Some url-safe random characters to pad your messages for privacy (to avoid being fingerprinted by encrypted message length) #[allow(dead_code)] pub random_padding: Option, /// Whether to provide answers for all records up to the root diff --git a/iroh-docs/src/engine.rs b/iroh-docs/src/engine.rs index 205667191c..986137fff7 100644 --- a/iroh-docs/src/engine.rs +++ b/iroh-docs/src/engine.rs @@ -379,7 +379,7 @@ impl DefaultAuthorStorage { } } -/// Peristent default author for a docs engine. +/// Persistent default author for a docs engine. #[derive(Debug)] pub struct DefaultAuthor { value: RwLock, diff --git a/iroh-docs/src/store/fs.rs b/iroh-docs/src/store/fs.rs index 981143ca86..5efe1719b0 100644 --- a/iroh-docs/src/store/fs.rs +++ b/iroh-docs/src/store/fs.rs @@ -343,7 +343,7 @@ impl Store { }) } - /// Delte an author. + /// Delete an author. pub fn delete_author(&mut self, author: AuthorId) -> Result<()> { self.modify(|tables| { tables.authors.remove(author.as_bytes())?; @@ -881,7 +881,7 @@ impl Iterator for ParentIterator { /// a database snapshot open until it is dropped. /// /// Also, this represents a snapshot of the database at the time of creation. -/// It nees a copy of a redb::ReadOnlyTable to be self-contained. +/// It needs a copy of a redb::ReadOnlyTable to be self-contained. #[derive(derive_more::Debug)] pub struct ContentHashesIterator { #[debug(skip)] diff --git a/iroh-gossip/examples/chat.rs b/iroh-gossip/examples/chat.rs index f9bf38863f..a2c29dfe4e 100644 --- a/iroh-gossip/examples/chat.rs +++ b/iroh-gossip/examples/chat.rs @@ -90,7 +90,7 @@ async fn main() -> anyhow::Result<()> { }; println!("> our secret key: {secret_key}"); - // confgure our relay map + // configure our relay map let relay_mode = match (args.no_relay, args.relay) { (false, None) => RelayMode::Default, (false, Some(url)) => RelayMode::Custom(RelayMap::from_url(url)), diff --git a/iroh-net/src/bin/iroh-relay.rs b/iroh-net/src/bin/iroh-relay.rs index 45e076e66c..30a91b4e89 100644 --- a/iroh-net/src/bin/iroh-relay.rs +++ b/iroh-net/src/bin/iroh-relay.rs @@ -182,7 +182,7 @@ impl Default for Config { /// Defaults for fields from [`Config`]. /// /// These are the defaults that serde will fill in. Other defaults depends on each other -/// and can not immediately be substituded by serde. +/// and can not immediately be substituted by serde. mod cfg_defaults { pub(crate) fn enable_relay() -> bool { true diff --git a/iroh-net/src/discovery.rs b/iroh-net/src/discovery.rs index 60be8bd3ea..9fbea2b45e 100644 --- a/iroh-net/src/discovery.rs +++ b/iroh-net/src/discovery.rs @@ -60,7 +60,7 @@ pub struct DiscoveryItem { /// /// Must be microseconds since the unix epoch. pub last_updated: Option, - /// The adress info for the node being resolved. + /// The address info for the node being resolved. pub addr_info: AddrInfo, } diff --git a/iroh-net/src/discovery/pkarr_publish.rs b/iroh-net/src/discovery/pkarr_publish.rs index 41bc676bbb..50d20de748 100644 --- a/iroh-net/src/discovery/pkarr_publish.rs +++ b/iroh-net/src/discovery/pkarr_publish.rs @@ -129,20 +129,20 @@ struct PublisherService { impl PublisherService { async fn run(self) { - let mut failed_attemps = 0; + let mut failed_attempts = 0; let republish = tokio::time::sleep(Duration::MAX); tokio::pin!(republish); loop { if let Some(info) = self.watcher.get() { if let Err(err) = self.publish_current(info).await { warn!(?err, url = %self.pkarr_client.pkarr_relay_url , "Failed to publish to pkarr"); - failed_attemps += 1; + failed_attempts += 1; // Retry after increasing timeout republish .as_mut() - .reset(Instant::now() + Duration::from_secs(failed_attemps)); + .reset(Instant::now() + Duration::from_secs(failed_attempts)); } else { - failed_attemps = 0; + failed_attempts = 0; // Republish after fixed interval republish .as_mut() diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index 3ed8d9c175..3bdb2f0664 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -717,7 +717,7 @@ impl Endpoint { /// /// Then [`Endpoint`] stores some information about all the other iroh-net nodes it has /// information about. This includes information about the relay server in use, any - /// known direct addresses, when there was last any conact with this node and what kind + /// known direct addresses, when there was last any contact with this node and what kind /// of connection this was. pub fn connection_info(&self, node_id: NodeId) -> Option { self.msock.connection_info(node_id) @@ -1038,7 +1038,7 @@ fn try_send_rtt_msg(conn: &quinn::Connection, magic_ep: &Endpoint) { } } -/// Read a proxy url from the environemnt, in this order +/// Read a proxy url from the environment, in this order /// /// - `HTTP_PROXY` /// - `http_proxy` diff --git a/iroh-net/src/lib.rs b/iroh-net/src/lib.rs index 8e54ac70e2..aa61010185 100644 --- a/iroh-net/src/lib.rs +++ b/iroh-net/src/lib.rs @@ -98,7 +98,7 @@ //! //! The [`DnsDiscovery`] service is a discovery service which will publish the [`RelayUrl`] //! and direct addresses to a service publishing those as DNS records. To connect it looks -//! up the [`NodeId`] in the DNS system to find the adressing details. This enables +//! up the [`NodeId`] in the DNS system to find the addressing details. This enables //! connecting using only the [`NodeId`] which is often more convenient and resilient. //! //! diff --git a/iroh-net/src/magicsock.rs b/iroh-net/src/magicsock.rs index d660070ffd..f26eaefdd8 100644 --- a/iroh-net/src/magicsock.rs +++ b/iroh-net/src/magicsock.rs @@ -1556,7 +1556,7 @@ impl Stream for DirectAddrsStream { if discovered.is_empty() { // When we start up we might initially have empty local endpoints as // the magic socket has not yet figured this out. Later on this set - // should never be emtpy. However even if it was the magicsock + // should never be empty. However even if it was the magicsock // would be in a state not very useable so skipping those events is // probably fine. // To make sure we install the right waker we loop rather than @@ -2646,7 +2646,7 @@ pub enum DirectAddrType { /// /// When possible an iroh-net node will perform STUN to discover which is the address /// from which it sends data on the public internet. This can be different from locally - /// bound addresses when the node is on a local network wich performs NAT or similar. + /// bound addresses when the node is on a local network which performs NAT or similar. Stun, /// An address assigned by the router using port mapping. /// @@ -2913,7 +2913,7 @@ mod tests { // TODO: ensure panics in this function are reported ok assert!( stats.path.lost_packets < 10, - "[reciever] should not loose many packets", + "[receiver] should not loose many packets", ); info!("close"); @@ -3494,7 +3494,7 @@ mod tests { mk_transmit(b"hello world", Some(5)), mk_transmit(b"!", None) ]), - mk_expected(["hello", " worl", "d", "!"]) + mk_expected(["hello", " worl", "d", "!"]) // spellchecker:disable-line ); // split that results in 1 packet assert_eq!( diff --git a/iroh-net/src/magicsock/node_map.rs b/iroh-net/src/magicsock/node_map.rs index 89037450b0..5ea864b433 100644 --- a/iroh-net/src/magicsock/node_map.rs +++ b/iroh-net/src/magicsock/node_map.rs @@ -238,7 +238,7 @@ impl NodeMap { /// Returns a stream of [`ConnectionType`]. /// /// Sends the current [`ConnectionType`] whenever any changes to the - /// connection type for `public_key` has occured. + /// connection type for `public_key` has occurred. /// /// # Errors /// @@ -472,7 +472,7 @@ impl NodeMapInner { /// Returns a stream of [`ConnectionType`]. /// /// Sends the current [`ConnectionType`] whenever any changes to the - /// connection type for `public_key` has occured. + /// connection type for `public_key` has occurred. /// /// # Errors /// diff --git a/iroh-net/src/magicsock/node_map/node_state.rs b/iroh-net/src/magicsock/node_map/node_state.rs index 6883c727b2..7bbfe5c014 100644 --- a/iroh-net/src/magicsock/node_map/node_state.rs +++ b/iroh-net/src/magicsock/node_map/node_state.rs @@ -726,7 +726,7 @@ impl NodeState { best_addr::State::Empty | best_addr::State::Outdated(_) ) { // We also need to send a ping to make this path available to us as well. This - // is always sent togehter with a pong. So in the worst case the pong gets lost + // is always sent together with a pong. So in the worst case the pong gets lost // and this ping does not. In that case we ping-pong until both sides have // received at least one pong. Once both sides have received one pong they both // have a best_addr and this ping will stop being sent. @@ -934,7 +934,7 @@ impl NodeState { st.last_ping = None; if !call_me_maybe_ipps.contains(ipp) { // TODO: This seems like a weird way to signal that the endpoint no longer - // thinks it has this IpPort as an avaialable path. + // thinks it has this IpPort as an available path. if st.recent_pong.is_some() { debug!(path=?ipp ,"clearing recent pong"); st.recent_pong = None; diff --git a/iroh-net/src/netcheck/reportgen.rs b/iroh-net/src/netcheck/reportgen.rs index b683d500a1..959319e204 100644 --- a/iroh-net/src/netcheck/reportgen.rs +++ b/iroh-net/src/netcheck/reportgen.rs @@ -1321,7 +1321,7 @@ mod tests { // sudo sysctl net.ipv4.ping_group_range="1234 1234" // // Note that this does not survive a reboot usually, commonly you need to edit - // /etc/sysctl.conf or /etc/sysctl.d/* to persist this accross reboots. + // /etc/sysctl.conf or /etc/sysctl.d/* to persist this across reboots. // // TODO: Not sure what about IPv6 pings using sysctl. #[tokio::test] diff --git a/iroh-net/src/relay/codec.rs b/iroh-net/src/relay/codec.rs index a63d88ab20..f7b34defdc 100644 --- a/iroh-net/src/relay/codec.rs +++ b/iroh-net/src/relay/codec.rs @@ -31,7 +31,7 @@ pub(super) const PER_CLIENT_READ_QUEUE_DEPTH: usize = 512; /// ProtocolVersion is bumped whenever there's a wire-incompatible change. /// - version 1 (zero on wire): consistent box headers, in use by employee dev nodes a bit /// - version 2: received packets have src addrs in FrameType::RecvPacket at beginning -/// NOTE: we are techincally running a modified version of the protocol. +/// NOTE: we are technically running a modified version of the protocol. /// `FrameType::PeerPresent`, `FrameType::WatchConn`, `FrameType::ClosePeer`, have been removed. /// The server will error on that connection if a client sends one of these frames. /// We have split with the DERP protocol significantly starting with our relay protocol 3 diff --git a/iroh-net/src/util/chain.rs b/iroh-net/src/util/chain.rs index f4b683f541..f5f8c58457 100644 --- a/iroh-net/src/util/chain.rs +++ b/iroh-net/src/util/chain.rs @@ -1,4 +1,4 @@ -//! IO utilitiy to chain `AsyncRead`s together. +//! IO utility to chain `AsyncRead`s together. // Based on tokios chain implementation, that doesn't make the concrete type public. diff --git a/iroh/src/node.rs b/iroh/src/node.rs index 406b962573..04313f3e78 100644 --- a/iroh/src/node.rs +++ b/iroh/src/node.rs @@ -141,7 +141,7 @@ impl Node { &self.inner.client } - /// Returns a referenc to the used `LocalPoolHandle`. + /// Returns a reference to the used `LocalPoolHandle`. pub fn local_pool_handle(&self) -> &LocalPoolHandle { &self.inner.rt } diff --git a/iroh/src/rpc_protocol.rs b/iroh/src/rpc_protocol.rs index 8334590a11..4e7d5a6068 100644 --- a/iroh/src/rpc_protocol.rs +++ b/iroh/src/rpc_protocol.rs @@ -112,7 +112,7 @@ impl ServerStreamingMsg for BlobDownloadRequest { type Response = BlobDownloadResponse; } -/// Progress resposne for [`BlobDownloadRequest`] +/// Progress response for [`BlobDownloadRequest`] #[derive(Debug, Clone, Serialize, Deserialize, derive_more::From, derive_more::Into)] pub struct BlobDownloadResponse(pub DownloadProgress); @@ -143,7 +143,7 @@ impl ServerStreamingMsg for BlobExportRequest { type Response = BlobExportResponse; } -/// Progress resposne for [`BlobExportRequest`] +/// Progress response for [`BlobExportRequest`] #[derive(Debug, Clone, Serialize, Deserialize, derive_more::From, derive_more::Into)] pub struct BlobExportResponse(pub ExportProgress); @@ -953,7 +953,7 @@ pub struct BlobReadAtRequest { pub hash: Hash, /// Offset to start reading at pub offset: u64, - /// Lenghth of the data to get + /// Length of the data to get pub len: Option, }