mirror of
https://github.com/jmcorgan/fips.git
synced 2026-10-30 07:37:36 +00:00
Move the root's noise module into fips-core's noise module. handshake.rs, replay.rs and session.rs move unchanged, and the tests move unchanged to core/src/noise/tests/mod.rs. The root's noise/mod.rs moves to core/src/noise/cipher.rs, keeping its module documentation, the protocol names, the error and role types and CipherState; in it the mod lines and the mod tests line go, the re-export block becomes one use of the parent module's sizes, the aead import names super::aead, open, take_cleared and clear_slot become pub, and the test-only key_bytes becomes pub(super), for the tests now beside it. fips-core's noise/mod.rs declares the submodules and re-exports their items, with open behind the test-hooks feature and take_cleared and clear_slot hidden from the docs. The root keeps every path through src/noise.rs, which re-exports the moved items and defines fips::noise::HandshakeState as HandshakeState<OsEntropy>. It also holds a compile-time check that AeadKey is ring's LessSafeKey, so a hosted build cannot silently fall back to the slower RustCrypto backend if the root's fips-core line loses its ring feature; on Windows, where the workers' paths are not built, that line is the only such check. The root re-exports that the files used while they were in the root (identity::secp, testutil::TestEntropy and entropy) go. fips-core gains hkdf and hmac, sha2's zeroize feature and zeroize's derive, which the handshake needs; the root drops hkdf and hmac, which no root code uses now. Cargo.lock gains no package.
119 lines
4.0 KiB
Rust
119 lines
4.0 KiB
Rust
//! FIPS: Free Internetworking Peering System
|
|
//!
|
|
//! A distributed, decentralized network routing protocol for mesh nodes
|
|
//! connecting over arbitrary transports.
|
|
|
|
// Name the `alloc` crate directly so the sans-IO protocol cores can spell their
|
|
// heap-type imports in `no_std`-forward form (`alloc::sync::Arc`,
|
|
// `alloc::collections::BTreeMap`). The crate remains `std`; this only reduces the
|
|
// distance to extracting the pure cores into a `no_std` crate later.
|
|
extern crate alloc;
|
|
|
|
pub mod cache;
|
|
pub mod config;
|
|
pub mod control;
|
|
pub(crate) mod dnsmsg;
|
|
#[cfg(target_os = "linux")]
|
|
pub mod gateway;
|
|
pub mod hosts;
|
|
pub mod identity;
|
|
// Declared before `node` (and named to sort there) because it carries
|
|
// `#[macro_use]`: the tick instrumentation macro must be in scope for the
|
|
// modules that follow.
|
|
#[macro_use]
|
|
pub(crate) mod instr;
|
|
pub mod ipv6tun;
|
|
pub mod mdns;
|
|
pub mod native;
|
|
pub mod node;
|
|
pub mod noise;
|
|
pub mod nostr;
|
|
#[cfg(test)]
|
|
mod packaging_tests;
|
|
pub mod peer;
|
|
pub mod perf_profile;
|
|
pub(crate) use fips_core::proto;
|
|
#[cfg(test)]
|
|
pub(crate) mod testutil;
|
|
mod time;
|
|
pub mod transport;
|
|
pub mod utils;
|
|
pub mod version;
|
|
|
|
// Re-export identity types
|
|
pub use identity::{
|
|
AuthChallenge, AuthResponse, Identity, IdentityError, Ipv6Address, NodeAddr, PeerIdentity,
|
|
decode_npub, decode_nsec, decode_secret, encode_npub, encode_nsec,
|
|
};
|
|
|
|
#[allow(deprecated)]
|
|
pub use identity::FipsAddress;
|
|
|
|
// Re-export config types
|
|
pub use config::{Config, ConfigError, IdentityConfig, NymConfig, TorConfig, UdpConfig};
|
|
pub use ipv6tun::config::{DnsConfig, TunConfig};
|
|
|
|
// Re-export nostr rendezvous handoff types
|
|
pub use nostr::{BootstrapHandoffResult, EstablishedTraversal, is_punch_packet};
|
|
|
|
// Re-export tree types (relocated from tree:: to proto::stp)
|
|
pub use proto::stp::{
|
|
CoordEntry, CoordError, ParentDeclaration, TreeCoordinate, TreeError, TreeState,
|
|
};
|
|
|
|
// Re-export bloom filter types (relocated from bloom:: to proto::bloom)
|
|
pub use proto::bloom::{BloomError, BloomFilter, BloomState};
|
|
|
|
// Re-export transport types
|
|
pub use transport::udp::UdpTransport;
|
|
pub use transport::{
|
|
DiscoveredPeer, Link, LinkDirection, LinkId, LinkState, LinkStats, PacketRx, PacketTx,
|
|
ReceivedPacket, Transport, TransportAddr, TransportError, TransportHandle, TransportId,
|
|
TransportState, TransportType, packet_channel,
|
|
};
|
|
|
|
// Re-export link-layer types (relocated from protocol:: to proto::link)
|
|
pub use proto::link::{LinkMessageType, SessionDatagram};
|
|
|
|
// Re-export the shared protocol error (relocated from protocol:: to proto::Error)
|
|
pub use proto::Error;
|
|
|
|
// Re-export FSP session wire types (relocated from protocol:: to proto::fsp)
|
|
pub use proto::fsp::{SessionAck, SessionFlags, SessionMessageType, SessionSetup};
|
|
|
|
// Re-export STP wire types (relocated from protocol:: to proto::stp)
|
|
pub use proto::stp::TreeAnnounce;
|
|
|
|
// Re-export bloom wire types (relocated from protocol:: to proto::bloom)
|
|
pub use proto::bloom::FilterAnnounce;
|
|
|
|
// Re-export discovery wire types (relocated from protocol:: to proto::lookup)
|
|
pub use proto::lookup::{LookupRequest, LookupResponse};
|
|
|
|
// Re-export the encapsulation overhead and path-MTU floors, which `proto` keeps
|
|
// crate-private
|
|
pub use proto::framing::FIPS_OVERHEAD;
|
|
pub use proto::mmp::{MIN_ACTIONABLE_PATH_MTU, MIN_REACTIVE_PATH_MTU};
|
|
|
|
// Re-export routing wire types (relocated from protocol:: to proto::routing)
|
|
pub use proto::routing::{
|
|
COORDS_REQUIRED_SIZE, CoordsRequired, MTU_EXCEEDED_SIZE, MtuExceeded, PathBroken,
|
|
};
|
|
|
|
// Re-export FMP link-framing wire type (relocated from protocol:: to proto::fmp)
|
|
pub use proto::fmp::HandshakeMessageType;
|
|
|
|
// Re-export cache types
|
|
pub use cache::{CacheEntry, CacheError, CacheStats, CoordCache};
|
|
|
|
// Re-export FMP tie-break helper and promotion result (relocated from peer:: to proto::fmp)
|
|
pub use proto::fmp::{PromotionResult, cross_connection_winner};
|
|
|
|
// Re-export peer types
|
|
pub use peer::{ActivePeer, ConnectivityState, PeerError};
|
|
|
|
// Re-export node types
|
|
#[cfg(unix)]
|
|
pub use node::AppOwnedUdpSocket;
|
|
pub use node::{NetmonTrigger, Node, NodeError, NodeState, UpdatePeersOutcome};
|