Skip to content

Commit 065e3b0

Browse files
committed
Fix linter configuration
1 parent 4d92911 commit 065e3b0

File tree

9 files changed

+22
-6
lines changed

9 files changed

+22
-6
lines changed

.golangci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ linters-settings:
2222

2323
run:
2424
go: "1.23"
25+
build-tags:
26+
- with_gvisor
27+
- with_quic
28+
- with_dhcp
29+
- with_wireguard
30+
- with_ech
31+
- with_utls
32+
- with_reality_server
33+
- with_acme
34+
- with_clash_api
2535

2636
issues:
2737
exclude-dirs:

cmd/sing-box/cmd_tools_fetch_http3.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func initializeHTTP3Client(instance *box.Box) error {
2121
return err
2222
}
2323
http3Client = &http.Client{
24-
Transport: &http3.RoundTripper{
24+
Transport: &http3.Transport{
2525
Dial: func(ctx context.Context, addr string, tlsCfg *tls.Config, cfg *quic.Config) (quic.EarlyConnection, error) {
2626
destination := M.ParseSocksaddr(addr)
2727
udpConn, dErr := dialer.DialContext(ctx, N.NetworkUDP, destination)

common/tls/ech_client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ type echConnWrapper struct {
6363

6464
func (c *echConnWrapper) ConnectionState() tls.ConnectionState {
6565
state := c.Conn.ConnectionState()
66+
//nolint:staticcheck
6667
return tls.ConnectionState{
6768
Version: state.Version,
6869
HandshakeComplete: state.HandshakeComplete,

common/tls/ech_keygen.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ func echKeygen(version uint16, serverName string, conf []myECHKeyConfig, suite [
147147
pair.rawConf = b
148148

149149
secBuf, err := sec.MarshalBinary()
150+
if err != nil {
151+
return nil, E.Cause(err, "serialize ECH private key")
152+
}
150153
sk := []byte{}
151154
sk = be.AppendUint16(sk, uint16(len(secBuf)))
152155
sk = append(sk, secBuf...)

common/tls/ech_quic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (c *echClientConfig) DialEarly(ctx context.Context, conn net.PacketConn, ad
2828
}
2929

3030
func (c *echClientConfig) CreateTransport(conn net.PacketConn, quicConnPtr *quic.EarlyConnection, serverAddr M.Socksaddr, quicConfig *quic.Config) http.RoundTripper {
31-
return &http3.RoundTripper{
31+
return &http3.Transport{
3232
TLSClientConfig: c.config,
3333
QUICConfig: quicConfig,
3434
Dial: func(ctx context.Context, addr string, tlsCfg *tls.Config, cfg *quic.Config) (quic.EarlyConnection, error) {

common/tls/reality_server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ type realityConnWrapper struct {
175175

176176
func (c *realityConnWrapper) ConnectionState() ConnectionState {
177177
state := c.Conn.ConnectionState()
178+
//nolint:staticcheck
178179
return tls.ConnectionState{
179180
Version: state.Version,
180181
HandshakeComplete: state.HandshakeComplete,

common/tls/utls_client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ type utlsConnWrapper struct {
6969

7070
func (c *utlsConnWrapper) ConnectionState() tls.ConnectionState {
7171
state := c.Conn.ConnectionState()
72+
//nolint:staticcheck
7273
return tls.ConnectionState{
7374
Version: state.Version,
7475
HandshakeComplete: state.HandshakeComplete,

inbound/hysteria.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ func NewHysteria(ctx context.Context, router adapter.Router, logger log.ContextL
6161
}
6262
if len(options.Down) > 0 {
6363
receiveBps, err = humanize.ParseBytes(options.Down)
64-
if receiveBps == 0 {
65-
return nil, E.New("invalid down speed format: ", options.Down)
64+
if err != nil {
65+
return nil, E.Cause(err, "invalid down speed format: ", options.Down)
6666
}
6767
} else {
6868
receiveBps = uint64(options.DownMbps) * hysteria.MbpsToBps

outbound/hysteria.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ func NewHysteria(ctx context.Context, router adapter.Router, logger log.ContextL
6363
}
6464
if len(options.Down) > 0 {
6565
receiveBps, err = humanize.ParseBytes(options.Down)
66-
if receiveBps == 0 {
67-
return nil, E.New("invalid down speed format: ", options.Down)
66+
if err != nil {
67+
return nil, E.Cause(err, "invalid down speed format: ", options.Down)
6868
}
6969
} else {
7070
receiveBps = uint64(options.DownMbps) * hysteria.MbpsToBps

0 commit comments

Comments
 (0)