feat:KCP协议
This commit is contained in:
29
cmd/internal/transport/kcp_packet_conn_other.go
Normal file
29
cmd/internal/transport/kcp_packet_conn_other.go
Normal file
@@ -0,0 +1,29 @@
|
||||
//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)
|
||||
}
|
||||
Reference in New Issue
Block a user