blob: 548ab15a39b78d859621c5f4bf1bb626c2456202 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
package rudp
import "net"
type udpSrv struct {
net.Conn
}
func (us udpSrv) recvUDP() ([]byte, error) {
buf := make([]byte, maxUDPPktSize)
n, err := us.Read(buf)
return buf[:n], err
}
// Connect returns a Conn connected to conn.
func Connect(conn net.Conn) *Conn {
return newConn(udpSrv{conn}, PeerIDSrv, PeerIDNil)
}
|