30 lines
667 B
Go
30 lines
667 B
Go
//go:build !linux
|
|
|
|
package transport
|
|
|
|
import "net"
|
|
|
|
type platformKCPPacketConn struct {
|
|
*kcpPacketConnBase
|
|
}
|
|
|
|
func newPlatformKCPPacketConn(conn *net.UDPConn, logger KCPPacketDebugLogger, nodeRole, nodeID string) (net.PacketConn, error) {
|
|
return &platformKCPPacketConn{
|
|
kcpPacketConnBase: &kcpPacketConnBase{
|
|
conn: conn,
|
|
logger: logger,
|
|
nodeRole: nodeRole,
|
|
nodeID: nodeID,
|
|
closed: make(chan struct{}),
|
|
},
|
|
}, nil
|
|
}
|
|
|
|
func (c *platformKCPPacketConn) ReadFrom(p []byte) (int, net.Addr, error) {
|
|
return c.conn.ReadFrom(p)
|
|
}
|
|
|
|
func (c *platformKCPPacketConn) WriteTo(p []byte, addr net.Addr) (int, error) {
|
|
return c.conn.WriteTo(p, addr)
|
|
}
|