typhoon-protocol 0.1.0

A sample implementation of TYPHOON protocol
Documentation
[package]
name = "typhoon-protocol"
version = "0.1.0"
edition = "2024"
license = "GPL-3.0-only"
description = "A sample implementation of TYPHOON protocol"
repository = "https://github.com/pseusys/TYPHOON"
readme = "README.md"
authors = [
    "Alexander Sergeev <aleksandr.sergeev.dm@gmail.com>"
]

[lib]
name = "typhoon"


[features]
default = ["fast_software", "server", "client", "tokio"]
fast_software = ["dep:chacha20"]
fast_hardware = ["dep:aes", "dep:ctr"]
full_software = ["dep:chacha20", "dep:chacha20poly1305"]
full_hardware = ["dep:aes", "dep:ctr", "dep:aes-gcm"]
server = ["dep:socket2"]
client = []
debug = ["client", "server"]
capture = []
async-std = ["dep:async-channel", "dep:async-executor", "dep:async-io", "dep:async-lock"]
tokio = ["dep:tokio"]


[dependencies]
aes = { version = "^0.8.4", optional = true }
aes-gcm = { version = "^0.10.3", features = ["std"], optional = true }
async-channel = { version = "^2.5.0", optional = true }
async-executor = { version = "^1.13.3", optional = true }
async-io = { version = "^2.6.0", optional = true }
async-lock = { version = "^3.4.2", optional = true }
arc-swap = "^1.7"
async-trait = "^0.1"
bitflags = "^2.10.0"
clap = { version = "^4.5", features = ["derive"], optional = true }
blake3 = "^1.8.3"
cfg-if = "^1.0.4"
crossbeam = "^0.8.4"
ctr = { version = "^0.9.2", optional = true }
chacha20 = { version = "^0.10.0", features = ["xchacha"], optional = true }
chacha20poly1305 = { version = "^0.10.1", features = ["std"], optional = true }
classic-mceliece-rust = { version = "^3.1.0", features = ["mceliece348864"] }
ed25519-dalek = "^2.2.0"
futures = "^0.3.31"
log = "^0.4.29"
rand = "^0.8.5"
subtle = "^2.6.1"
thiserror = "^2.0.18"
tokio = { version = "^1.47.1", features = ["net", "sync", "time", "rt", "rt-multi-thread", "macros"], optional = true }
rand_distr = "^0.4.3"
socket2 = { version = "^0.5", features = ["all"], optional = true }
weighted_rand = "^0.4.2"
x25519-dalek = { version = "^2.0.1", features = ["static_secrets"] }

[target.'cfg(target_os = "linux")'.dependencies]
libc = "^0.2"

[dev-dependencies]
criterion = { version = "^0.5", features = ["async_tokio"] }
env_logger = "^0.11"
rand_chacha = "^0.3"
tempfile = "^3.15"


[lints.clippy]
all      = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
# intentional in protocol/crypto byte manipulation
cast_possible_truncation   = "allow"
cast_sign_loss             = "allow"
cast_precision_loss        = "allow"
cast_lossless              = "allow"
# crate is not yet formally documented
missing_errors_doc         = "allow"
missing_panics_doc         = "allow"
doc_markdown               = "allow"
# internal library — #[must_use] on every getter is noise
must_use_candidate         = "allow"
# standard crypto/protocol abbreviations (esk, epk, spk, …)
similar_names              = "allow"
# protocol state-machine functions and constructors exceed defaults
too_many_lines             = "allow"
too_many_arguments         = "allow"
# unavoidable in protocol generics
type_complexity            = "allow"
# passing small types by ref is a style preference here
trivially_copy_pass_by_ref = "allow"
# `use super::*` is idiomatic in Rust test modules
wildcard_imports           = "allow"
# protocol enum variants are sized by design
large_enum_variant         = "allow"
# builder methods returning Self — caller is responsible for chaining
return_self_not_must_use   = "allow"
# API signature stability; callers expect owned values
needless_pass_by_value     = "allow"
# interior mutability through raw pointers in byte buffer traits
mut_from_ref               = "allow"
# crypto operations use large fixed-size stack arrays
large_stack_arrays         = "allow"
# exact equality checks in decoy statistical tests are intentional
float_cmp                  = "allow"
# free_ptr reconstructs a Vec with len == cap by design
same_length_and_capacity   = "allow"
# settings sub-module follows this naming convention
module_inception           = "allow"
# crypto structs intentionally redact sensitive fields from Debug
missing_fields_in_debug    = "allow"
# Result return type kept for forward compatibility
unnecessary_wraps          = "allow"
# FakeHeaderConfig is test-only, is_empty not needed
len_without_is_empty       = "allow"
# public async API methods kept async for consistency even without direct awaits
unused_async               = "allow"


[[test]]
name = "network"
path = "tests/network/main.rs"
required-features = ["client", "server", "tokio"]

[[bin]]
name = "typhoon-debug"
path = "src/bin/typhoon_debug.rs"
required-features = ["debug"]

[[bin]]
name = "typhoon-gen-key"
path = "src/bin/typhoon_gen_key.rs"
required-features = ["server", "clap"]

[[bench]]
name = "roundtrip"
path = "benches/roundtrip.rs"
harness = false
required-features = ["client", "server", "tokio"]

[[bench]]
name = "handshake"
path = "benches/handshake.rs"
harness = false
required-features = ["client", "server", "tokio"]


[[example]]
name = "hello_world"
path = "example/hello_world.rs"
required-features = ["client", "server"]

[[example]]
name = "debug_probe"
path = "example/debug_probe.rs"
required-features = ["debug"]

[[example]]
name = "multi_flow"
path = "example/multi_flow.rs"
required-features = ["client", "server"]

[[example]]
name = "long_session"
path = "example/long_session.rs"
required-features = ["client", "server"]

[[example]]
name = "multi_client"
path = "example/multi_client.rs"
required-features = ["client", "server"]

[[example]]
name = "heavy_traffic"
path = "example/heavy_traffic.rs"
required-features = ["client", "server"]

[[example]]
name = "use_case"
path = "example/use_case.rs"
required-features = ["client", "server"]

[[example]]
name = "mirror_decoy"
path = "example/mirror_decoy.rs"
required-features = ["client", "server"]

[[example]]
name = "flat_iat_decoy"
path = "example/flat_iat_decoy.rs"
required-features = ["client", "server"]


# Retain line-level debug symbols in release builds for flamegraph / perf profiling.
# Cargo ignores [profile] from dependency crates, so this has no effect on downstream users.
[profile.release]
debug = 1