mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
Reformat code
This commit is contained in:
parent
f57ec13880
commit
55efac7236
8 changed files with 28 additions and 28 deletions
|
@ -37,7 +37,6 @@ func NewDNS(ctx context.Context, config interface{}) (interface{}, error) {
|
|||
buf := make([]byte, 0x100)
|
||||
|
||||
off1, err := dns.PackDomainName(dns.Fqdn(config.(*Config).Domain), buf, 0, nil, false)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -24,14 +24,14 @@ type ConnectionID struct {
|
|||
// Listener defines a server listening for connections
|
||||
type Listener struct {
|
||||
sync.Mutex
|
||||
sessions map[ConnectionID]*Connection
|
||||
hub *udp.Hub
|
||||
tlsConfig *gotls.Config
|
||||
config *Config
|
||||
reader PacketReader
|
||||
header internet.PacketHeader
|
||||
security cipher.AEAD
|
||||
addConn internet.ConnHandler
|
||||
sessions map[ConnectionID]*Connection
|
||||
hub *udp.Hub
|
||||
tlsConfig *gotls.Config
|
||||
config *Config
|
||||
reader PacketReader
|
||||
header internet.PacketHeader
|
||||
security cipher.AEAD
|
||||
addConn internet.ConnHandler
|
||||
}
|
||||
|
||||
func NewListener(ctx context.Context, address net.Address, port net.Port, streamSettings *internet.MemoryStreamConfig, addConn internet.ConnHandler) (*Listener, error) {
|
||||
|
|
|
@ -240,8 +240,10 @@ func UClient(c net.Conn, config *Config, ctx context.Context, dest net.Destinati
|
|||
return uConn, nil
|
||||
}
|
||||
|
||||
var href = regexp.MustCompile(`href="([/h].*?)"`)
|
||||
var dot = []byte(".")
|
||||
var (
|
||||
href = regexp.MustCompile(`href="([/h].*?)"`)
|
||||
dot = []byte(".")
|
||||
)
|
||||
|
||||
var maps struct {
|
||||
sync.Mutex
|
||||
|
|
|
@ -47,11 +47,11 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
|||
}
|
||||
}
|
||||
|
||||
if config.Interface != "" {
|
||||
if err := syscall.BindToDevice(int(fd), config.Interface); err != nil {
|
||||
return newError("failed to set Interface").Base(err)
|
||||
}
|
||||
}
|
||||
if config.Interface != "" {
|
||||
if err := syscall.BindToDevice(int(fd), config.Interface); err != nil {
|
||||
return newError("failed to set Interface").Base(err)
|
||||
}
|
||||
}
|
||||
|
||||
if isTCPSocket(network) {
|
||||
tfo := config.ParseTFOValue()
|
||||
|
@ -91,10 +91,10 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
|||
}
|
||||
|
||||
if config.TcpWindowClamp > 0 {
|
||||
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, syscall.TCP_WINDOW_CLAMP, int(config.TcpWindowClamp)); err != nil {
|
||||
return newError("failed to set TCP_WINDOW_CLAMP", err)
|
||||
}
|
||||
}
|
||||
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, syscall.TCP_WINDOW_CLAMP, int(config.TcpWindowClamp)); err != nil {
|
||||
return newError("failed to set TCP_WINDOW_CLAMP", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if config.Tproxy.IsEnabled() {
|
||||
|
@ -148,8 +148,8 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
|
|||
|
||||
if config.TcpWindowClamp > 0 {
|
||||
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, syscall.TCP_WINDOW_CLAMP, int(config.TcpWindowClamp)); err != nil {
|
||||
return newError("failed to set TCP_WINDOW_CLAMP", err)
|
||||
}
|
||||
return newError("failed to set TCP_WINDOW_CLAMP", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue