1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00

Lint: add nolint flags to avoid lint

This commit is contained in:
秋のかえで 2022-08-19 20:05:50 +08:00
parent 9ae51c1f15
commit a788be738e
No known key found for this signature in database
GPG Key ID: E343534293081E5D
3 changed files with 22 additions and 22 deletions

View File

@ -21,7 +21,7 @@ func BenchmarkRoll20(b *testing.B) {
func BenchmarkIntn1(b *testing.B) {
for i := 0; i < b.N; i++ {
rand.Intn(1)
rand.Intn(1) //nolint:staticcheck
}
}

View File

@ -65,14 +65,14 @@ type status struct {
func (s *status) RelayStream(conn io.ReadWriteCloser, ctx context.Context) { //nolint:revive
}
func (s *status) Connection(conn gonet.Conn, connctx context.Context) context.Context { //nolint:revive
S_S2CTraffic := make(chan server.UDPServerTxToClientTraffic, 8) //nolint:revive
S_S2CDataTraffic := make(chan server.UDPServerTxToClientDataTraffic, 8) //nolint:revive
S_C2STraffic := make(chan server.UDPServerRxFromClientTraffic, 8) //nolint:revive
func (s *status) Connection(conn gonet.Conn, connctx context.Context) context.Context { //nolint:revive,stylecheck
S_S2CTraffic := make(chan server.UDPServerTxToClientTraffic, 8) //nolint:revive,stylecheck
S_S2CDataTraffic := make(chan server.UDPServerTxToClientDataTraffic, 8) //nolint:revive,stylecheck
S_C2STraffic := make(chan server.UDPServerRxFromClientTraffic, 8) //nolint:revive,stylecheck
S_S2CTraffic2 := make(chan interfaces.TrafficWithChannelTag, 8) //nolint:revive
S_S2CDataTraffic2 := make(chan interfaces.TrafficWithChannelTag, 8) //nolint:revive
S_C2STraffic2 := make(chan interfaces.TrafficWithChannelTag, 8) //nolint:revive
S_S2CTraffic2 := make(chan interfaces.TrafficWithChannelTag, 8) //nolint:revive,stylecheck
S_S2CDataTraffic2 := make(chan interfaces.TrafficWithChannelTag, 8) //nolint:revive,stylecheck
S_C2STraffic2 := make(chan interfaces.TrafficWithChannelTag, 8) //nolint:revive,stylecheck
go func(ctx context.Context) {
for {
@ -120,7 +120,7 @@ func (s *status) Connection(conn gonet.Conn, connctx context.Context) context.Co
return connctx
}
func createStatusFromConfig(config *UDPProtocolConfig) (*status, error) {
func createStatusFromConfig(config *UDPProtocolConfig) (*status, error) { //nolint:unparam
s := &status{ctx: context.Background(), config: config}
s.password = []byte(config.Password)

View File

@ -116,28 +116,28 @@ type status struct {
access sync.Mutex
}
func createStatusFromConfig(config *UDPProtocolConfig) (*status, error) {
func createStatusFromConfig(config *UDPProtocolConfig) (*status, error) { //nolint:unparam
s := &status{password: []byte(config.Password)}
ctx := context.Background()
s.msgbus = ibus.NewMessageBus()
ctx = context.WithValue(ctx, interfaces.ExtraOptionsMessageBus, s.msgbus) //nolint:revive
ctx = context.WithValue(ctx, interfaces.ExtraOptionsMessageBus, s.msgbus) //nolint:revive,staticcheck
ctx = context.WithValue(ctx, interfaces.ExtraOptionsDisableAutoQuitForClient, true) //nolint:revive
ctx = context.WithValue(ctx, interfaces.ExtraOptionsDisableAutoQuitForClient, true) //nolint:revive,staticcheck
if config.EnableFec {
ctx = context.WithValue(ctx, interfaces.ExtraOptionsUDPFECEnabled, true) //nolint:revive
ctx = context.WithValue(ctx, interfaces.ExtraOptionsUDPFECEnabled, true) //nolint:revive,staticcheck
}
if config.ScramblePacket {
ctx = context.WithValue(ctx, interfaces.ExtraOptionsUDPShouldMask, true) //nolint:revive
ctx = context.WithValue(ctx, interfaces.ExtraOptionsUDPShouldMask, true) //nolint:revive,staticcheck
}
ctx = context.WithValue(ctx, interfaces.ExtraOptionsUDPMask, string(s.password)) //nolint:revive
ctx = context.WithValue(ctx, interfaces.ExtraOptionsUDPMask, string(s.password)) //nolint:revive,staticcheck
if config.HandshakeMaskingPaddingSize != 0 {
ctxv := &interfaces.ExtraOptionsUsePacketArmorValue{PacketArmorPaddingTo: int(config.HandshakeMaskingPaddingSize), UsePacketArmor: true}
ctx = context.WithValue(ctx, interfaces.ExtraOptionsUsePacketArmor, ctxv) //nolint:revive
ctx = context.WithValue(ctx, interfaces.ExtraOptionsUsePacketArmor, ctxv) //nolint:revive,staticcheck
}
destinationString := fmt.Sprintf("%v:%v", config.Address.AsAddress().String(), config.Port)
@ -157,13 +157,13 @@ func enableInterface(s *status) error {
return newError("unable to connect to remote").Base(err)
}
C_C2STraffic := make(chan client2.UDPClientTxToServerTraffic, 8) //nolint:revive
C_C2SDataTraffic := make(chan client2.UDPClientTxToServerDataTraffic, 8) //nolint:revive
C_S2CTraffic := make(chan client2.UDPClientRxFromServerTraffic, 8) //nolint:revive
C_C2STraffic := make(chan client2.UDPClientTxToServerTraffic, 8) //nolint:revive,stylecheck
C_C2SDataTraffic := make(chan client2.UDPClientTxToServerDataTraffic, 8) //nolint:revive,stylecheck
C_S2CTraffic := make(chan client2.UDPClientRxFromServerTraffic, 8) //nolint:revive,stylecheck
C_C2STraffic2 := make(chan interfaces.TrafficWithChannelTag, 8) //nolint:revive
C_C2SDataTraffic2 := make(chan interfaces.TrafficWithChannelTag, 8) //nolint:revive
C_S2CTraffic2 := make(chan interfaces.TrafficWithChannelTag, 8) //nolint:revive
C_C2STraffic2 := make(chan interfaces.TrafficWithChannelTag, 8) //nolint:revive,stylecheck
C_C2SDataTraffic2 := make(chan interfaces.TrafficWithChannelTag, 8) //nolint:revive,stylecheck
C_S2CTraffic2 := make(chan interfaces.TrafficWithChannelTag, 8) //nolint:revive,stylecheck
go func(ctx context.Context) {
for {