mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-14 10:00:34 +00:00
Hysteria client: Fix sendThrough (#6063)
And fixes https://github.com/XTLS/Xray-core/issues/6046
This commit is contained in:
@@ -2,7 +2,6 @@ package internet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -12,32 +11,6 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func bindAddr(fd uintptr, ip []byte, port uint32) error {
|
||||
setReuseAddr(fd)
|
||||
setReusePort(fd)
|
||||
|
||||
var sockaddr syscall.Sockaddr
|
||||
|
||||
switch len(ip) {
|
||||
case net.IPv4len:
|
||||
a4 := &syscall.SockaddrInet4{
|
||||
Port: int(port),
|
||||
}
|
||||
copy(a4.Addr[:], ip)
|
||||
sockaddr = a4
|
||||
case net.IPv6len:
|
||||
a6 := &syscall.SockaddrInet6{
|
||||
Port: int(port),
|
||||
}
|
||||
copy(a6.Addr[:], ip)
|
||||
sockaddr = a6
|
||||
default:
|
||||
return errors.New("unexpected length of ip")
|
||||
}
|
||||
|
||||
return syscall.Bind(int(fd), sockaddr)
|
||||
}
|
||||
|
||||
// applyOutboundSocketOptions applies socket options for outbound connection.
|
||||
// note that unlike other part of Xray, this function needs network with speified network stack(tcp4/tcp6/udp4/udp6)
|
||||
func applyOutboundSocketOptions(network string, address string, fd uintptr, config *SocketConfig) error {
|
||||
|
||||
Reference in New Issue
Block a user