diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84b6dbfd..aedc71b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,12 @@ env: VERBOSE: 1 jobs: + spell-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: crate-ci/typos@master + build-ubuntu: runs-on: ubuntu-latest steps: diff --git a/pnet_base/src/macaddr.rs b/pnet_base/src/macaddr.rs index 1fd6fcef..83a5e7d5 100644 --- a/pnet_base/src/macaddr.rs +++ b/pnet_base/src/macaddr.rs @@ -310,7 +310,7 @@ mod tests { } #[test] - fn convertion() { + fn conversion() { let mac = MacAddr(0x12, 0x34, 0x56, 0x78, 0x90, 0xAB); let addr = [0x12, 0x34, 0x56, 0x78, 0x90, 0xAB]; diff --git a/pnet_datalink/src/bindings/bpf.rs b/pnet_datalink/src/bindings/bpf.rs index 0fee005b..de6ea89e 100644 --- a/pnet_datalink/src/bindings/bpf.rs +++ b/pnet_datalink/src/bindings/bpf.rs @@ -20,7 +20,7 @@ const IF_NAMESIZE: usize = 16; const IFNAMSIZ: usize = IF_NAMESIZE; const IOC_IN: libc::c_ulong = 0x80000000; const IOC_OUT: libc::c_ulong = 0x40000000; -const IOC_INOUT: libc::c_ulong = IOC_IN | IOC_OUT; +const IOC_INPUT: libc::c_ulong = IOC_IN | IOC_OUT; const IOCPARM_SHIFT: libc::c_ulong = 13; const IOCPARM_MASK: libc::c_ulong = (1 << (IOCPARM_SHIFT as usize)) - 1; @@ -45,7 +45,7 @@ pub const BIOCGDLT: libc::c_ulong = IOC_OUT | ((SIZEOF_C_UINT & IOCPARM_MASK) << 16) | (('B' as libc::c_ulong) << 8) | 106; pub const BIOCSBLEN: libc::c_ulong = - IOC_INOUT | ((SIZEOF_C_UINT & IOCPARM_MASK) << 16) | (('B' as libc::c_ulong) << 8) | 102; + IOC_INPUT | ((SIZEOF_C_UINT & IOCPARM_MASK) << 16) | (('B' as libc::c_ulong) << 8) | 102; pub const BIOCSHDRCMPLT: libc::c_ulong = IOC_IN | ((SIZEOF_C_UINT & IOCPARM_MASK) << 16) | (('B' as libc::c_ulong) << 8) | 117; pub const BIOCSRTIMEOUT: libc::c_ulong = diff --git a/pnet_datalink/src/bpf.rs b/pnet_datalink/src/bpf.rs index a64bfdcb..0dc04ab5 100644 --- a/pnet_datalink/src/bpf.rs +++ b/pnet_datalink/src/bpf.rs @@ -294,7 +294,7 @@ impl DataLinkSender for DataLinkSenderImpl { ) }; if ret == -1 { - // Error occured! + // Error occurred! return Some(Err(io::Error::last_os_error())); } else if ret == 0 { return Some(Err(io::Error::new(io::ErrorKind::TimedOut, "Timed out"))); @@ -339,7 +339,7 @@ impl DataLinkSender for DataLinkSenderImpl { ) }; if ret == -1 { - // Error occured! + // Error occurred! return Some(Err(io::Error::last_os_error())); } else if ret == 0 { return Some(Err(io::Error::new(io::ErrorKind::TimedOut, "Timed out"))); diff --git a/pnet_datalink/src/winpcap.rs b/pnet_datalink/src/winpcap.rs index 64415d2f..5fdb460f 100644 --- a/pnet_datalink/src/winpcap.rs +++ b/pnet_datalink/src/winpcap.rs @@ -343,7 +343,7 @@ pub fn interfaces() -> Vec { buf.resize(buflen as usize, 0); // Second call should now work with the correct buffer size. If not, this may be - // due to some privilege or other unforseen issue. + // due to some privilege or other unforeseen issue. if unsafe { winpcap::PacketGetAdapterNames(buf.as_mut_ptr() as *mut i8, &mut buflen) } == 0 { panic!("Unable to get interface list despite increasing buffer size"); diff --git a/pnet_sys/src/lib.rs b/pnet_sys/src/lib.rs index 125286a5..5582a67e 100644 --- a/pnet_sys/src/lib.rs +++ b/pnet_sys/src/lib.rs @@ -111,7 +111,7 @@ pub fn set_socket_receive_timeout(socket: CSocket, t: Duration) -> io::Result<() } } -/// Extracts and returns a timout for reading from the socket. +/// Extracts and returns a timeout for reading from the socket. #[cfg(unix)] pub fn get_socket_receive_timeout(socket: CSocket) -> io::Result { let ts = libc::timeval { diff --git a/src/lib.rs b/src/lib.rs index 4423b8e4..8abff094 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,7 +31,7 @@ //! //! ## Terminology //! -//! The documentation uses the following terms interchangably: +//! The documentation uses the following terms interchangeably: //! //! * Layer 2, datalink layer; //! * Layer 3, network layer; @@ -48,7 +48,7 @@ //! ### Ethernet echo server //! //! This (fairly useless) code implements an Ethernet echo server. Whenever a -//! packet is received on an interface, it echo's the packet back; reversing the +//! packet is received on an interface, it echoes the packet back; reversing the //! source and destination addresses. //! //! ```rust,ignore diff --git a/typos.toml b/typos.toml new file mode 100644 index 00000000..b4c8229e --- /dev/null +++ b/typos.toml @@ -0,0 +1,6 @@ +[default] +extend-ignore-identifiers-re = [ + "tolen", + "ND", + "SunNd", +]