Expand description
Β§Synapse: Neural Communi/// This means you can send messages using simple, human-readable names, and Synapseation Network
A revolutionary neural communication network for AI entities, distributed systems, and modern applications with federated identity management, dual trust systems, and privacy-respecting discovery.
Β§π What Makes Synapse Special?
Synapse transforms how entities communicate by providing:
- π§ Neural Identity: Contextual participant discovery with natural language
- π Federated Network: Cross-organizational communication and trust
- β‘ Intelligent Routing: Multi-speed communication with smart transport selection
- π Privacy First: Advanced privacy controls with stealth and unlisted modes
- π€ AI-Native: Designed for AI-to-AI and human-to-AI interaction
- ποΈ Dual Trust: Entity-to-entity and blockchain-verified network trust
- βοΈ Blockchain Trust: Staking, verification, and decay mechanisms
Β§π― The Neural Identity System
One of Synapseβs most powerful features is its contextual identity system:
Simple Name β Global ID β Network Discovery β Smart Transport Selection
"Alice" β alice@ai-lab.example.com β 192.168.1.100:8080 β TCP (real-time)
"Claude" β claude@anthropic.com β [external] β Email (reliable)
"LocalBot" β bot@localhost β 127.0.0.1:9090 β UDP (fast local)
This means you can send messages using simple, human-readable names, and Synapse automatically figures out:
- Where the recipient is located (email address, IP, domain)
- How to reach them (direct connection, relay, email)
- What transport to use (TCP for speed, email for reliability)
- What security to apply (encryption level, authentication)
Β§ποΈ Architecture Overview
Synapse operates on multiple intelligent layers:
Β§Layer 1: Message Layer
- Simple message types: Direct, Broadcast, Conversation, Notification
- Automatic serialization and security wrapping
- Metadata handling and routing information
Β§Layer 2: Identity Resolution
- Local Names:
"Alice"
,"Bob"
,"MyAI"
(human-friendly) - Global IDs:
"alice@company.com"
(globally unique) - Network Addresses: IP addresses, ports, service endpoints
- Capability Discovery: What transports and features each peer supports
Β§Layer 3: Multi-Transport Intelligence
- Real-time Transports: TCP, UDP, WebSocket for <100ms messaging
- Local Discovery: mDNS, LAN scanning, Bluetooth for peer finding
- Email Backbone: SMTP/IMAP for reliable, federated communication
- NAT Traversal: STUN/TURN/UPnP for firewall penetration
Β§Layer 4: Email Server Integration
- Full Server Mode: Run your own SMTP/IMAP when externally accessible
- Relay Mode: Outgoing only when behind firewall/NAT
- External Provider: Fall back to Gmail, Outlook, etc. when restricted
Β§π Quick Start Example
use message_routing_system::*;
#[tokio::main]
async fn main() -> Result<()> {
// Initialize with your identity
let config = Config::default();
let router = EnhancedSynapseRouter::new(config, "MyBot@example.com".to_string()).await?;
// Register some contacts (or use auto-discovery)
router.register_peer("Alice", "alice@ai-lab.example.com").await?;
// Start all services
router.start().await?;
// Send messages using simple names!
router.send_message_smart(
"Alice", // Just the name
"Hello from Synapse!", // Your message
MessageType::Direct, // Type of communication
SecurityLevel::Authenticated, // Security level
MessageUrgency::Interactive, // Speed vs reliability preference
).await?;
Ok(())
}
Β§ποΈ Advanced Features
Β§Automatic Transport Selection
Synapse intelligently chooses the best transport based on:
- Message urgency: Real-time vs. reliable delivery
- Network conditions: Latency, bandwidth, connectivity
- Security requirements: Encryption levels, authentication
- Peer capabilities: What transports the recipient supports
// Real-time collaboration (prefers TCP/UDP)
router.send_message_smart(
"AI-Partner",
"Quick question about the algorithm...",
MessageType::Conversation,
SecurityLevel::Public,
MessageUrgency::RealTime, // <100ms preferred
).await?;
// Reliable file sharing (uses email for guaranteed delivery)
router.send_file_with_urgency(
"ResearchTeam",
"important_results.pdf",
MessageUrgency::Background, // Reliability over speed
).await?;
Β§Email Server Capabilities
When your system is externally accessible, EMRP can run a full email server:
let router = EnhancedSynapseRouter::new(config, "bot@mydomain.com".to_string()).await?;
if router.is_running_email_server() {
// You can receive emails directly at bot@mydomain.com
// Other EMRP systems can send messages to your domain
// Supports both EMRP messages and standard emails
println!("π Running full email infrastructure");
} else {
// Falls back to external providers (Gmail, etc.)
println!("π Using external email services");
}
Β§Security by Design
All messages are automatically secured:
- π PGP Encryption: Messages encrypted with recipientβs public key
- βοΈ Digital Signatures: Verify sender authenticity
- π‘οΈ TLS Transport: Encrypted connections for real-time transports
- π Automatic Key Management: Keys generated and distributed automatically
Β§π Module Overview
router_enhanced
: Main interface - start here for most use casesidentity
: Name resolution and identity managementtransport
: Multi-transport layer and intelligent routingemail_server
: SMTP/IMAP server implementationtypes
: Core message types and data structurescrypto
: Encryption, signatures, and key managementconfig
: Configuration and setup
Β§π― Use Cases
Β§AI & Machine Learning
- Multi-agent AI systems coordinating in real-time
- AI-human collaboration with natural addressing
- Federated learning with secure model sharing
- Research collaboration between AI entities worldwide
Β§Enterprise & Distributed Systems
- Microservice communication with email-based service discovery
- Cross-organization messaging leveraging existing email infrastructure
- Reliable async processing with email-based job queuing
- Legacy system integration through email gateways
Β§IoT & Edge Computing
- Device-to-cloud communication using email when internet is limited
- Peer-to-peer IoT networks with automatic discovery
- Edge AI coordination across distributed deployments
- Resilient communication in unstable network conditions
Β§π§ Getting Started
- Add to Cargo.toml:
message_routing_system = "0.1.0"
- See examples:
cargo run --example email_integration_test
- Read the docs: Full API documentation and guides
- Join the community: Contribute and get support
The combination of emailβs universal reach with modern real-time transports creates a communication system thatβs both globally federated and performance-optimized - perfect for the AI-driven future.
Re-exportsΒ§
pub use crypto::CryptoManager;
pub use email::EmailTransport;
pub use transport::Transport;
pub use transport::TransportSelector;
pub use transport::HybridConnection;
pub use transport::TransportMetrics;
pub use transport::NatMethod;
pub use transport::providers::TransportProvider;
pub use transport::providers::ProductionTransportProvider;
pub use transport::providers::TestTransportProvider;
pub use transport::providers::MockTransport;
pub use config::Config;
pub use error::SynapseError;
pub use transport::TransportRoute;
pub use transport::abstraction::MessageUrgency;
pub use router::SynapseRouter;
pub use router_enhanced::EnhancedSynapseRouter;
pub use transport::router::MultiTransportRouter;
pub use synapse::SynapseNode;
pub use synapse::SynapseConfig;
pub use synapse::models::ParticipantProfile;
pub use synapse::models::EntityType;
pub use synapse::models::DiscoverabilityLevel;
pub use synapse::api;
pub use synapse::blockchain;
pub use synapse::models;
pub use synapse::services;
pub use synapse::storage;
pub use types::*;
ModulesΒ§
- auth_
integration - Synapse Authentication Integration
- circuit_
breaker - Circuit Breaker Infrastructure for Synapse
- config
- Configuration management for EMRP
- connectivity
- Network connectivity enhancements for EMRP
- crypto
- Cryptographic operations for EMRP
- Email transport layer for EMRP
- email_
server - Synapse Email Server Implementation
- error
- Error types for the Synapse system
- headers
- Standard email headers for Synapse
- identity
- Identity Management and Name Resolution
- monitoring
- Enhanced Metrics and Monitoring System for Synapse
- router
- Main Synapse router implementation
- router_
enhanced - Enhanced Synapse Router - Your Gateway to Intelligent Communication
- streaming
- Real-time streaming support for EMRP
- synapse
- transport
- Multi-transport layer for EMRP
- types
- Core Types and Message Structures for EMRP
MacrosΒ§
ConstantsΒ§
- PROTOCOL_
VERSION - Current protocol version
FunctionsΒ§
- init_
logging - Initialize the Synapse system with logging (not available on WASM)