Expand description
§zks_wire
Network primitives for ZK Protocol - NAT traversal, STUN, and swarm networking.
This crate provides low-level networking primitives for the ZK Protocol:
- NAT Traversal: Hole punching and UPnP/NAT-PMP support
- STUN/TURN: ICE-like connection establishment
- Swarm Networking: Peer discovery and mesh formation
- Wire Protocol: Binary message framing and encryption
§Example
use zks_wire::{Swarm, StunClient, NatTraversal};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a swarm for peer discovery
let swarm = Swarm::new("my-network".to_string());
// Perform STUN to discover public address
let stun_client = StunClient::new("8.8.8.8:3478");
// let public_addr = stun_client.discover().await?;
// Enable NAT traversal
let nat = NatTraversal::new();
// nat.enable_upnp().await?;
Ok(())
}Re-exports§
pub use error::WireError;pub use error::Result;pub use nat::NatTraversal;pub use nat::NatType;pub use relay::RelayServer;pub use relay::RelayClient;pub use relay::RelayId;pub use relay::RelayConfig;pub use relay::RelayCredentials;pub use stun::StunClient;pub use stun::StunServer;pub use stun::IceCandidate;pub use swarm::Swarm;pub use swarm::Peer;pub use swarm::PeerId;pub use swarm::SwarmEvent;pub use circuit::SwarmCircuit;pub use circuit::CircuitBuilder;pub use wire::WireMessage;pub use wire::WireProtocol;pub use wire::MessageType;
Modules§
- circuit
- Swarm circuit implementation for onion routing in ZK Protocol
- error
- Error types for zks_wire crate
- nat
- NAT traversal functionality for ZK Protocol
- prelude
- Re-export commonly used types
- relay
- Relay server implementation for ZK Protocol
- stun
- STUN (Session Traversal Utilities for NAT) implementation for ZK Protocol
- swarm
- Swarm networking for peer discovery and mesh formation in ZK Protocol
- wire
- Wire protocol for ZK Protocol message framing and encryption