mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-30 05:56:54 -05:00
Lint: update linter config & fix code style (#1089)
* Lint: update linter config * Fix: code style
This commit is contained in:
parent
841469bd17
commit
d7a202a705
6
.github/linters/.golangci.yml
vendored
6
.github/linters/.golangci.yml
vendored
@ -12,10 +12,12 @@ issues:
|
||||
|
||||
linters:
|
||||
enable:
|
||||
- asciicheck
|
||||
- bodyclose
|
||||
- depguard
|
||||
- gocritic
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- goimports
|
||||
- golint
|
||||
- goprintffuncname
|
||||
@ -37,3 +39,7 @@ linters:
|
||||
- deadcode
|
||||
- errcheck
|
||||
- unused
|
||||
|
||||
linters-settings:
|
||||
goimports:
|
||||
local-prefixes: github.com/v2fly/v2ray-core
|
||||
|
1
.github/workflows/linter.yml
vendored
1
.github/workflows/linter.yml
vendored
@ -16,6 +16,7 @@ on:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
if: github.repository == 'v2fly/v2ray-core'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go 1.x
|
||||
|
@ -154,7 +154,7 @@ func (p *StaticMuxPicker) PickAvailable() (*mux.ClientWorker, error) {
|
||||
return nil, newError("empty worker list")
|
||||
}
|
||||
|
||||
var minIdx = -1
|
||||
minIdx := -1
|
||||
var minConn uint32 = 9999
|
||||
for i, w := range p.workers {
|
||||
if w.draining {
|
||||
|
@ -26,7 +26,7 @@ func (ctx *ResolvableContext) GetTargetIPs() []net.IP {
|
||||
}
|
||||
|
||||
if domain := ctx.GetTargetDomain(); len(domain) != 0 {
|
||||
var lookupFunc = ctx.dnsClient.LookupIP
|
||||
lookupFunc := ctx.dnsClient.LookupIP
|
||||
ipOption := &dns.IPOption{
|
||||
IPv4Enable: true,
|
||||
IPv6Enable: true,
|
||||
|
@ -66,7 +66,7 @@ func (h *Handler) resolveIP(ctx context.Context, domain string, localAddr net.Ad
|
||||
newError("DNS client doesn't implement ClientWithIPOption")
|
||||
}
|
||||
|
||||
var lookupFunc = h.dns.LookupIP
|
||||
lookupFunc := h.dns.LookupIP
|
||||
if h.config.DomainStrategy == Config_USE_IP4 || (localAddr != nil && localAddr.Family().IsIPv4()) {
|
||||
if lookupIPv4, ok := h.dns.(dns.IPv4Lookup); ok {
|
||||
lookupFunc = lookupIPv4.LookupIPv4
|
||||
|
@ -39,7 +39,6 @@ func ReadTCPSession(user *protocol.MemoryUser, reader io.Reader) (*protocol.Requ
|
||||
behaviorSeed := crc32.ChecksumIEEE(hashkdf.Sum(nil))
|
||||
|
||||
drainer, err := drain.NewBehaviorSeedLimitedDrainer(int64(behaviorSeed), 16+38, 3266, 64)
|
||||
|
||||
if err != nil {
|
||||
return nil, nil, newError("failed to initialize drainer").Base(err)
|
||||
}
|
||||
@ -140,7 +139,6 @@ func ReadTCPResponse(user *protocol.MemoryUser, reader io.Reader) (buf.Reader, e
|
||||
behaviorSeed := crc32.ChecksumIEEE(hashkdf.Sum(nil))
|
||||
|
||||
drainer, err := drain.NewBehaviorSeedLimitedDrainer(int64(behaviorSeed), 16+38, 3266, 64)
|
||||
|
||||
if err != nil {
|
||||
return nil, newError("failed to initialize drainer").Base(err)
|
||||
}
|
||||
|
@ -5,11 +5,10 @@ import (
|
||||
"encoding/binary"
|
||||
"hash/fnv"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common/crypto"
|
||||
|
||||
"golang.org/x/crypto/sha3"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common"
|
||||
"github.com/v2fly/v2ray-core/v4/common/crypto"
|
||||
)
|
||||
|
||||
// Authenticate authenticates a byte array using Fnv hash.
|
||||
|
@ -13,8 +13,6 @@ import (
|
||||
"hash/fnv"
|
||||
"io"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common/drain"
|
||||
|
||||
"golang.org/x/crypto/chacha20poly1305"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common"
|
||||
@ -22,6 +20,7 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v4/common/buf"
|
||||
"github.com/v2fly/v2ray-core/v4/common/crypto"
|
||||
"github.com/v2fly/v2ray-core/v4/common/dice"
|
||||
"github.com/v2fly/v2ray-core/v4/common/drain"
|
||||
"github.com/v2fly/v2ray-core/v4/common/protocol"
|
||||
"github.com/v2fly/v2ray-core/v4/common/serial"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/vmess"
|
||||
|
@ -12,14 +12,13 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common/drain"
|
||||
|
||||
"golang.org/x/crypto/chacha20poly1305"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common"
|
||||
"github.com/v2fly/v2ray-core/v4/common/bitmask"
|
||||
"github.com/v2fly/v2ray-core/v4/common/buf"
|
||||
"github.com/v2fly/v2ray-core/v4/common/crypto"
|
||||
"github.com/v2fly/v2ray-core/v4/common/drain"
|
||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||
"github.com/v2fly/v2ray-core/v4/common/protocol"
|
||||
"github.com/v2fly/v2ray-core/v4/common/task"
|
||||
@ -141,7 +140,6 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.Request
|
||||
buffer := buf.New()
|
||||
|
||||
drainer, err := drain.NewBehaviorSeedLimitedDrainer(int64(s.userValidator.GetBehaviorSeed()), 16+38, 3266, 64)
|
||||
|
||||
if err != nil {
|
||||
return nil, newError("failed to initialize drainer").Base(err)
|
||||
}
|
||||
|
@ -8,13 +8,12 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
core "github.com/v2fly/v2ray-core/v4"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/backoff"
|
||||
"google.golang.org/grpc/connectivity"
|
||||
"google.golang.org/grpc/credentials"
|
||||
|
||||
core "github.com/v2fly/v2ray-core/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/common"
|
||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||
"github.com/v2fly/v2ray-core/v4/common/session"
|
||||
|
@ -9,10 +9,9 @@ import (
|
||||
"net/url"
|
||||
"sync"
|
||||
|
||||
core "github.com/v2fly/v2ray-core/v4"
|
||||
|
||||
"golang.org/x/net/http2"
|
||||
|
||||
core "github.com/v2fly/v2ray-core/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/common"
|
||||
"github.com/v2fly/v2ray-core/v4/common/buf"
|
||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||
|
Loading…
Reference in New Issue
Block a user