Skip to content

Commit

Permalink
introducing the RDT protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
rkonfj committed May 22, 2024
1 parent bc42aed commit 568da58
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Another p2p network library in Go
- Full support for IPv4/IPv6 dual stack
- Easy-to-use library (net.PacketConn)
- **Transport layer security (curve25519 & chacha20poly1305 for end-to-end encryption)**
- [RDT](https://github.com/rkonfj/peerguard/tree/main/rdt) protocol for reliable data transfer
- Cross-platform compatibility (linux/windows/macOS/iOS/android)

## Get Started
Expand Down
44 changes: 44 additions & 0 deletions rdt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# RDT

a Reliable Data Transfer protocol.

### Example
**Server**
```go
packetConn, err := net.ListenPacket("udp", "192.168.3.99:22334")
if err != nil {
panic(err)
}
listener, err := rdt.Listen(packetConn)
if err != nil {
panic(err)
}

for {
conn, err := listener.Accept()
if err != nil {
panic(err)
}
handle(conn)
}
```
**Client**
```go
packetConn, err := net.ListenPacket("udp", "192.168.3.98:22335")
if err != nil {
panic(err)
}
listener, err := rdt.Listen(packetConn)
if err != nil {
panic(err)
}

conn, err := listener.OpenStream(&net.UDPAddr{
IP: net.ParseIP("192.168.3.99"),
Port: 22334,
})
if err != nil {
panic(err)
}
...
```

0 comments on commit 568da58

Please sign in to comment.