Skip to content

Repository files navigation

FastLink

High-performance P2P networking protocol suite


🚀 Project Introduction

FastLink is a high-performance P2P networking protocol suite providing:

  • Mother Protocol: Unified abstraction layer, time synchronization, NAT parameter library
  • P2P Protocol: Enhanced NAT traversal with BirthdayPunch algorithm, connection state machine
  • Server Protocol: Five-dimensional weighted intelligent routing
  • Swift Tunnel: Anti-DPI obfuscated transport
  • Games Protocol: Low-latency game networking
  • Aztec Protocol: Enterprise-grade distributed Mesh networking
  • Chat Protocol: Zero-server end-to-end encrypted messaging

🏃 Quick Start

# Clone repository
git clone https://github.com/StarsailsClover/FastLink.git
cd FastLink
# Build project
cargo build --release
# Run tests
cargo test# Run CLI
cargo run --bin fastlink-cli

🏗️ Project Structure

FastLink/
├── apps/fastlink-cli/ # CLI application
├── core/ # Core libraries
│ ├── mother-protocol/ # Mother protocol
│ ├── libfastcrypto/ # Crypto library
│ ├── libcommon/ # Common components
│ ├── libomnilink/ # P2P omnilink (NAT traversal)
│ ├── libfasttransport/ # Transport layer
│ ├── libfastdht/ # DHT
│ ├── libantidpi/ # Anti-DPI
│ └── libnetworktest/ # Network testing
├── protocols/ # Protocol implementations
│ ├── fastlink-p2p/ # P2P protocol
│ ├── fastlink-server/ # Server protocol
│ ├── fastlink-swift/ # Swift tunnel
│ ├── fastlink-games/ # Game networking
│ ├── fastlink-aztec/ # Enterprise Mesh
│ └── fastlink-chat/ # Encrypted messaging
└── tools/ # Testing and debugging tools

🔥 Core Features

🎂 BirthdayPunch NAT Traversal (NEW)

Multi-strategy NAT traversal with intelligent fallback:

StrategyNAT TypeSuccess RateDescription
DirectOpen100%Direct connection
STUNFull/Restricted Cone>90%Standard hole punching
BirthdayPunchSymmetric~60%Port prediction via birthday paradox
TURNAll types99%Relay fallback

Key improvements:

  • BirthdayPunch Algorithm: Based on birthday paradox, predicts NAT port allocation
  • Adaptive Strategy Selection: Automatically chooses best method based on detected NAT type
  • Symmetric NAT Support: Improved from <50% to ~60% success rate
  • TURN Fallback: Guaranteed connectivity when direct methods fail

How BirthdayPunch Works

1. Detect NAT type via STUN servers
2. If Symmetric NAT detected:
- Analyze port allocation pattern (sequential/random/delta)
- Generate predicted port candidates using birthday paradox
- Attempt connection to predicted ports
3. If all methods fail, fall back to TURN relay

📊 NAT Traversal Success Rates

NAT TypeBest StrategyExpected Success
Open InternetDirect100%
Full ConeSTUN>95%
Restricted ConeSTUN>90%
Port RestrictedSTUN/BirthdayPunch>85%
SymmetricBirthdayPunch~60%

Note: Actual success depends on ISP and router configuration

Five-Dimensional Weighted Routing

W = 0.4·Latency + 0.3·Loss + 0.1·Hops + 0.15·ISP + 0.05·Geo

6-State Connection State Machine

Idle → Detect → PreMap → Punch → Connected/Disconnected
↓ ↓ ↓
Role Swap Failure Report

🛠️ Technical Stack

ComponentTechnologyPurpose
CoreRust + TokioAsync runtime
Cryptox25519-dalek, ed25519-dalekKey exchange & signatures
EncryptionChaCha20-Poly1305AEAD symmetric encryption
HashBlake3Fast cryptographic hashing
NATSTUN/TURN + BirthdayPunchNAT traversal
DHTKademlia variantPeer discovery

📦 Installation

Requirements

  • Rust 1.75+
  • Cargo

Build

git clone https://github.com/StarsailsClover/FastLink.git
cd FastLink
cargo build --release

Run

# CLI help
cargo run --bin fastlink-cli -- --help
# Start P2P node
cargo run --bin fastlink-cli -- node start
# Run tests
cargo test --workspace

🤝 Contributing

Issues and Pull Requests are welcome!


📜 License

MIT OR Apache-2.0


📧 Contact

Email: sailshuang@gmail.com
GitHub: @StarsailsClover


🙏 Acknowledgments

  • BirthdayPunch algorithm inspired by academic research on NAT traversal
  • STUN/TURN protocols from RFC 5389/5766
  • ICE framework from RFC 5245

About

FLN | A new-generation network protocol architecture with full support for countering complex network environments and advanced obfuscation.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages