mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-07 15:56:54 +00:00
fix mux kcp connection
This commit is contained in:
@@ -4,6 +4,7 @@ package mux
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/xtaci/kcp-go"
|
||||
"net"
|
||||
"os"
|
||||
)
|
||||
@@ -11,6 +12,7 @@ import (
|
||||
func sysGetSock(fd *os.File) (bufferSize int, err error) {
|
||||
// https://github.com/golang/sys/blob/master/windows/syscall_windows.go#L1184
|
||||
// not support, WTF???
|
||||
// Todo
|
||||
// return syscall.GetsockoptInt((syscall.Handle)(unsafe.Pointer(fd.Fd())), syscall.SOL_SOCKET, syscall.SO_RCVBUF)
|
||||
bufferSize = 10 * 1024 * 1024
|
||||
return
|
||||
@@ -30,6 +32,13 @@ func getConnFd(c net.Conn) (fd *os.File, err error) {
|
||||
// return
|
||||
//}
|
||||
return
|
||||
case *kcp.UDPSession:
|
||||
//fd, err = (*net.UDPConn)(unsafe.Pointer(c.(*kcp.UDPSession))).File()
|
||||
//if err != nil {
|
||||
// return
|
||||
//}
|
||||
// Todo
|
||||
return
|
||||
default:
|
||||
err = errors.New("mux:unknown conn type, only tcp or kcp")
|
||||
return
|
||||
|
Reference in New Issue
Block a user