Skip to content

Commit 55efac7

Browse files
committed
Reformat code
1 parent f57ec13 commit 55efac7

File tree

8 files changed

+28
-28
lines changed

8 files changed

+28
-28
lines changed

common/protocol/headers.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ package protocol
33
import (
44
"runtime"
55

6-
"golang.org/x/sys/cpu"
7-
86
"github.com/xtls/xray-core/common/bitmask"
97
"github.com/xtls/xray-core/common/net"
108
"github.com/xtls/xray-core/common/uuid"
9+
"golang.org/x/sys/cpu"
1110
)
1211

1312
// RequestCommand is a custom command in a proxy request.

infra/conf/transport_internet.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ type SocketConfig struct {
616616
TCPKeepAliveInterval int32 `json:"tcpKeepAliveInterval"`
617617
TCPKeepAliveIdle int32 `json:"tcpKeepAliveIdle"`
618618
TCPCongestion string `json:"tcpCongestion"`
619-
TCPWindowClamp int32 `json:"tcpWindowClamp"`
619+
TCPWindowClamp int32 `json:"tcpWindowClamp"`
620620
V6only bool `json:"v6only"`
621621
Interface string `json:"interface"`
622622
}
@@ -668,7 +668,7 @@ func (c *SocketConfig) Build() (*internet.SocketConfig, error) {
668668
TcpKeepAliveInterval: c.TCPKeepAliveInterval,
669669
TcpKeepAliveIdle: c.TCPKeepAliveIdle,
670670
TcpCongestion: c.TCPCongestion,
671-
TcpWindowClamp: c.TCPWindowClamp,
671+
TcpWindowClamp: c.TCPWindowClamp,
672672
V6Only: c.V6only,
673673
Interface: c.Interface,
674674
}, nil

proxy/vless/encoding/encoding.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ func XtlsPadding(b *buf.Buffer, command byte, userUUID *[]byte, longPadding bool
485485
}
486486
paddingLen = int32(l.Int64())
487487
}
488-
if paddingLen > buf.Size - 21 - contentLen {
488+
if paddingLen > buf.Size-21-contentLen {
489489
paddingLen = buf.Size - 21 - contentLen
490490
}
491491
newbuffer := buf.New()

proxy/vless/outbound/outbound.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
287287
counter = statConn.ReadCounter
288288
}
289289
err = encoding.XtlsRead(serverReader, clientWriter, timer, netConn, rawConn, input, rawInput, counter, ctx, account.ID.Bytes(),
290-
&numberOfPacketToFilter, &enableXtls, &isTLS12orAbove, &isTLS, &cipher, &remainingServerHello)
290+
&numberOfPacketToFilter, &enableXtls, &isTLS12orAbove, &isTLS, &cipher, &remainingServerHello)
291291
} else {
292292
// from serverReader.ReadMultiBuffer to clientWriter.WriteMultiBufer
293293
err = buf.Copy(serverReader, clientWriter, buf.UpdateActivity(timer))

transport/internet/headers/dns/dns.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ func NewDNS(ctx context.Context, config interface{}) (interface{}, error) {
3737
buf := make([]byte, 0x100)
3838

3939
off1, err := dns.PackDomainName(dns.Fqdn(config.(*Config).Domain), buf, 0, nil, false)
40-
4140
if err != nil {
4241
return nil, err
4342
}

transport/internet/kcp/listener.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ type ConnectionID struct {
2424
// Listener defines a server listening for connections
2525
type Listener struct {
2626
sync.Mutex
27-
sessions map[ConnectionID]*Connection
28-
hub *udp.Hub
29-
tlsConfig *gotls.Config
30-
config *Config
31-
reader PacketReader
32-
header internet.PacketHeader
33-
security cipher.AEAD
34-
addConn internet.ConnHandler
27+
sessions map[ConnectionID]*Connection
28+
hub *udp.Hub
29+
tlsConfig *gotls.Config
30+
config *Config
31+
reader PacketReader
32+
header internet.PacketHeader
33+
security cipher.AEAD
34+
addConn internet.ConnHandler
3535
}
3636

3737
func NewListener(ctx context.Context, address net.Address, port net.Port, streamSettings *internet.MemoryStreamConfig, addConn internet.ConnHandler) (*Listener, error) {

transport/internet/reality/reality.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,10 @@ func UClient(c net.Conn, config *Config, ctx context.Context, dest net.Destinati
240240
return uConn, nil
241241
}
242242

243-
var href = regexp.MustCompile(`href="([/h].*?)"`)
244-
var dot = []byte(".")
243+
var (
244+
href = regexp.MustCompile(`href="([/h].*?)"`)
245+
dot = []byte(".")
246+
)
245247

246248
var maps struct {
247249
sync.Mutex

transport/internet/sockopt_linux.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
4747
}
4848
}
4949

50-
if config.Interface != "" {
51-
if err := syscall.BindToDevice(int(fd), config.Interface); err != nil {
52-
return newError("failed to set Interface").Base(err)
53-
}
54-
}
50+
if config.Interface != "" {
51+
if err := syscall.BindToDevice(int(fd), config.Interface); err != nil {
52+
return newError("failed to set Interface").Base(err)
53+
}
54+
}
5555

5656
if isTCPSocket(network) {
5757
tfo := config.ParseTFOValue()
@@ -91,10 +91,10 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
9191
}
9292

9393
if config.TcpWindowClamp > 0 {
94-
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, syscall.TCP_WINDOW_CLAMP, int(config.TcpWindowClamp)); err != nil {
95-
return newError("failed to set TCP_WINDOW_CLAMP", err)
96-
}
97-
}
94+
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, syscall.TCP_WINDOW_CLAMP, int(config.TcpWindowClamp)); err != nil {
95+
return newError("failed to set TCP_WINDOW_CLAMP", err)
96+
}
97+
}
9898
}
9999

100100
if config.Tproxy.IsEnabled() {
@@ -148,8 +148,8 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
148148

149149
if config.TcpWindowClamp > 0 {
150150
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, syscall.TCP_WINDOW_CLAMP, int(config.TcpWindowClamp)); err != nil {
151-
return newError("failed to set TCP_WINDOW_CLAMP", err)
152-
}
151+
return newError("failed to set TCP_WINDOW_CLAMP", err)
152+
}
153153
}
154154
}
155155

0 commit comments

Comments
 (0)