优化:新增隧道时,不指定服务端口时,将自动生成端口号 优化:API返回ID, /client/add/, /index/addhost/,/index/add/ 优化:域名解析、隧道页面,增加[唯一验证密钥],方便搜查
38 lines
715 B
Go
38 lines
715 B
Go
//go:build windows
|
|
// +build windows
|
|
|
|
package nps_mux
|
|
|
|
import (
|
|
"net"
|
|
"os"
|
|
)
|
|
|
|
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 = 15 * 1024 * 1024
|
|
return
|
|
}
|
|
|
|
func getConnFd(c net.Conn) (fd *os.File, err error) {
|
|
switch c.(type) {
|
|
case *net.TCPConn:
|
|
//fd, err = c.(*net.TCPConn).File()
|
|
//if err != nil {
|
|
// return
|
|
//}
|
|
return
|
|
case *net.UDPConn:
|
|
//fd, err = c.(*net.UDPConn).File()
|
|
//if err != nil {
|
|
// return
|
|
//}
|
|
return
|
|
default:
|
|
return
|
|
}
|
|
}
|