Reliable UDP transport protocol for Go
Sharpshooter is a reliable transport protocol built on UDP, implemented in Go. It provides TCP-like connection-oriented semantics without TCP's protocol fingerprint, making it suitable for bypassing protocol-based traffic detection and serving as a transport layer for P2P applications.
Features:
- TCP-like 3-way handshake
- ACK-based retransmission
- Adaptive sliding window congestion control
- Optional FEC (Forward Error Correction) via Reed-Solomon
- RTT/RTO auto-calibration
- Health check & timeout detection
- Implements
net.Conninterface - Zero external dependencies besides Reed-Solomon
go get github.com/soyum2222/sharpshooterl, _ := sharpshooter.Listen(":8858")
conn, _ := l.Accept()
// conn implements net.Conn — use Read/Write directlyconn, _ := sharpshooter.Dial("127.0.0.1:8858")
// Enable FEC (optional)
conn.(*sharpshooter.Sniper).OpenFec(10, 3)
conn.Write([]byte("hello"))More examples in the example/ directory.
| Method | Description |
|---|---|
Dial(addr) (net.Conn, error) |
Connect to a remote listener |
Listen(addr) (*headquarters, error) |
Start a UDP listener |
Accept() (net.Conn, error) |
Accept a new connection |
OpenFec(data, par) |
Enable FEC (e.g. OpenFec(10, 3) tolerates 30% loss) |
SetPackageSize(size) |
Set packet payload size |
SetSendWin(size) / SetRecWin(size) |
Set send/receive window |
OpenStaTraffic() |
Enable traffic statistics |
TrafficStatistics() |
Get traffic stats snapshot |
All standard net.Conn methods (Read, Write, Close, SetDeadline, etc.) are supported.
For protocol specification and detailed documentation, see docs/.
# Server (receive)
go run example/sharp_transfer.go -l 8858 -o output.dat
# Client (send)
go run example/sharp_transfer.go -addr 127.0.0.1:8858 -i input.dat
# Resume transfer
go run example/sharp_transfer.go -addr 127.0.0.1:8858 -i input.dat -o output.dat -c
# Compare with TCP
go run example/sharp_transfer.go -addr 127.0.0.1:8858 -i input.dat -t- sharpshooter-tunel — TCP ↔ Sharpshooter bridge