mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
v1.0.0
This commit is contained in:
parent
47d23e9972
commit
c7f7c08ead
711 changed files with 82154 additions and 2 deletions
56
transport/internet/sockopt_windows.go
Normal file
56
transport/internet/sockopt_windows.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
package internet
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
const (
|
||||
TCP_FASTOPEN = 15
|
||||
)
|
||||
|
||||
func setTFO(fd syscall.Handle, settings SocketConfig_TCPFastOpenState) error {
|
||||
switch settings {
|
||||
case SocketConfig_Enable:
|
||||
if err := syscall.SetsockoptInt(fd, syscall.IPPROTO_TCP, TCP_FASTOPEN, 1); err != nil {
|
||||
return err
|
||||
}
|
||||
case SocketConfig_Disable:
|
||||
if err := syscall.SetsockoptInt(fd, syscall.IPPROTO_TCP, TCP_FASTOPEN, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func applyOutboundSocketOptions(network string, address string, fd uintptr, config *SocketConfig) error {
|
||||
if isTCPSocket(network) {
|
||||
if err := setTFO(syscall.Handle(fd), config.Tfo); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig) error {
|
||||
if isTCPSocket(network) {
|
||||
if err := setTFO(syscall.Handle(fd), config.Tfo); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func bindAddr(fd uintptr, ip []byte, port uint32) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func setReuseAddr(fd uintptr) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func setReusePort(fd uintptr) error {
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue