amaters-net
Network layer for AmateRS (Musubi - The Knot)
Overview
amaters-net provides the networking infrastructure for AmateRS, implementing the Musubi component. It handles client-server communication using gRPC over QUIC with mutual TLS (mTLS) for secure, high-performance data exchange.
Features
- gRPC Protocol: RPC communication for queries and operations
- QUIC Transport: HTTP/3 with multiplexing and 0-RTT
- mTLS: Mutual TLS for authenticated connections
- Connection Pooling: Efficient connection reuse
- Protocol Buffers: AmateRS Query Language (AQL) serialization
Architecture
Client ←→ [Musubi] ←→ Server
├── gRPC
├── QUIC (HTTP/3)
├── mTLS
└── Connection Pool
Protocol Definition
AmateRS Query Protocol (AQL)
service AmateRS {
rpc Execute(QueryRequest) returns (QueryResponse);
rpc ExecuteStream(stream QueryRequest) returns (stream QueryResponse);
}
message QueryRequest {
bytes query_bytes = 1; // Serialized AQL
bytes client_signature = 2;
}
message QueryResponse {
bytes result_bytes = 1;
bytes server_proof = 2; // Future: ZKP
}
Usage (Future)
use ;
// Client
let client = connect
.with_tls
.await?;
let query = QueryRequest ;
let response = client.execute.await?;
// Server
let server = bind
.with_tls
.serve
.await?;
Configuration
[]
= "0.0.0.0:7878"
= 1000
= 60000
= 10000
[]
= "/etc/amaters/server.crt"
= "/etc/amaters/server.key"
= "/etc/amaters/ca.crt"
[]
= 100
= 65536
Security
mTLS Authentication
- Server validates client certificates
- Client validates server certificates
- Mutual authentication prevents MITM
QUIC Benefits
- Encrypted by default (TLS 1.3)
- Connection migration support
- No head-of-line blocking
- 0-RTT reconnection
Protocol Security
- All queries encrypted in transit
- Server never sees plaintext (FHE)
- Optional ZK proofs for computation verification
Performance
Benchmarks (Target)
- Latency: < 5ms (local network)
- Throughput: > 100K queries/sec
- Connections: 10K+ concurrent clients
Optimization
- Connection pooling reduces handshake overhead
- QUIC multiplexing eliminates HOL blocking
- Zero-copy serialization with rkyv
Development Status
- 📋 Phase 1: Protocol design
- 📋 Phase 2: gRPC implementation
- 📋 Phase 3: QUIC transport
- 📋 Phase 4: mTLS authentication
- 📋 Phase 5: Connection pooling
Testing
# Run unit tests
# Integration tests with mock server
# Benchmarks
Dependencies
tonic- gRPC frameworkquinn- QUIC implementationrustls- TLS librarytokio- Async runtime
License
Licensed under MIT OR Apache-2.0
Authors
COOLJAPAN OU (Team KitaSan)