mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-17 14:57:44 -05:00
Fix lint
This commit is contained in:
parent
ebee459f1f
commit
fc6ae4d4e7
2
.github/linters/.golangci.yml
vendored
2
.github/linters/.golangci.yml
vendored
@ -2,6 +2,8 @@ run:
|
||||
timeout: 5m
|
||||
skip-files:
|
||||
- generated.*
|
||||
- .*_test.go
|
||||
- proxy/vlite/*
|
||||
|
||||
issues:
|
||||
new: true
|
||||
|
@ -4,11 +4,13 @@ package command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
|
||||
core "github.com/v2fly/v2ray-core/v5"
|
||||
"github.com/v2fly/v2ray-core/v5/app/log"
|
||||
"github.com/v2fly/v2ray-core/v5/common"
|
||||
cmlog "github.com/v2fly/v2ray-core/v5/common/log"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// LoggerServer is the implemention of LoggerService
|
||||
|
@ -7,7 +7,7 @@ const (
|
||||
)
|
||||
|
||||
func ContextWithEnvironment(ctx context.Context, environment interface{}) context.Context {
|
||||
return context.WithValue(ctx, environmentKey, environment) //nolint: revive
|
||||
return context.WithValue(ctx, environmentKey, environment) //nolint: revive,staticcheck
|
||||
}
|
||||
|
||||
func EnvironmentFromContext(ctx context.Context) interface{} {
|
||||
|
@ -216,9 +216,9 @@ func (ac *ACAutomatonMatcherGroup) MatchAny(input string) bool {
|
||||
}
|
||||
|
||||
// Letter-Digit-Hyphen (LDH) subset (https://tools.ietf.org/html/rfc952):
|
||||
// * Letters A to Z (no distinction is made between uppercase and lowercase)
|
||||
// * Digits 0 to 9
|
||||
// * Hyphens(-) and Periods(.)
|
||||
// - Letters A to Z (no distinction is made between uppercase and lowercase)
|
||||
// - Digits 0 to 9
|
||||
// - Hyphens(-) and Periods(.)
|
||||
//
|
||||
// If for future the strmatcher are used for other scenarios than domain,
|
||||
// we could add a new Charset interface to represent variable charsets.
|
||||
|
@ -15,7 +15,7 @@ const (
|
||||
)
|
||||
|
||||
// Matcher is the interface to determine a string matches a pattern.
|
||||
// * This is a basic matcher to represent a certain kind of match semantic(full, substr, domain or regex).
|
||||
// - This is a basic matcher to represent a certain kind of match semantic(full, substr, domain or regex).
|
||||
type Matcher interface {
|
||||
// Type returns the matcher's type.
|
||||
Type() Type
|
||||
@ -34,8 +34,8 @@ type Matcher interface {
|
||||
|
||||
// MatcherGroup is an advanced type of matcher to accept a bunch of basic Matchers (of certain type, not all matcher types).
|
||||
// For example:
|
||||
// * FullMatcherGroup accepts FullMatcher and uses a hash table to facilitate lookup.
|
||||
// * DomainMatcherGroup accepts DomainMatcher and uses a trie to optimize both memory consumption and lookup speed.
|
||||
// - FullMatcherGroup accepts FullMatcher and uses a hash table to facilitate lookup.
|
||||
// - DomainMatcherGroup accepts DomainMatcher and uses a trie to optimize both memory consumption and lookup speed.
|
||||
type MatcherGroup interface {
|
||||
// Match returns all matched matchers with their corresponding values.
|
||||
Match(input string) []uint32
|
||||
@ -46,9 +46,9 @@ type MatcherGroup interface {
|
||||
|
||||
// IndexMatcher is a general type of matcher thats accepts all kinds of basic matchers.
|
||||
// It should:
|
||||
// * Accept all Matcher types with no exception.
|
||||
// * Optimize string matching with a combination of MatcherGroups.
|
||||
// * Obey certain priority order specification when returning matched Matchers.
|
||||
// - Accept all Matcher types with no exception.
|
||||
// - Optimize string matching with a combination of MatcherGroups.
|
||||
// - Obey certain priority order specification when returning matched Matchers.
|
||||
type IndexMatcher interface {
|
||||
// Size returns number of matchers added to IndexMatcher.
|
||||
Size() uint32
|
||||
|
@ -26,7 +26,8 @@ func MustFromContext(ctx context.Context) *Instance {
|
||||
return v
|
||||
}
|
||||
|
||||
/* toContext returns ctx from the given context, or creates an Instance if the context doesn't find that.
|
||||
/*
|
||||
toContext returns ctx from the given context, or creates an Instance if the context doesn't find that.
|
||||
|
||||
It is unsupported to use this function to create a context that is suitable to invoke V2Ray's internal component
|
||||
in third party code, you shouldn't use //go:linkname to alias of this function into your own package and
|
||||
@ -34,7 +35,6 @@ use this function in your third party code.
|
||||
|
||||
For third party code, usage enabled by creating a context to interact with V2Ray's internal component is unsupported,
|
||||
and may break at any time.
|
||||
|
||||
*/
|
||||
func toContext(ctx context.Context, v *Instance) context.Context {
|
||||
if FromContext(ctx) != v {
|
||||
@ -43,7 +43,8 @@ func toContext(ctx context.Context, v *Instance) context.Context {
|
||||
return ctx
|
||||
}
|
||||
|
||||
/*ToBackgroundDetachedContext create a detached context from another context
|
||||
/*
|
||||
ToBackgroundDetachedContext create a detached context from another context
|
||||
Internal API
|
||||
*/
|
||||
func ToBackgroundDetachedContext(ctx context.Context) context.Context {
|
||||
|
@ -11,7 +11,6 @@ Merge Rules:
|
||||
- Simple values (string, number, boolean) are overwritten, others are merged
|
||||
- Elements with same "tag" (or "_tag") in an array will be merged
|
||||
- Add "_priority" property to array elements will help sort the
|
||||
|
||||
*/
|
||||
package merge
|
||||
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
func loadHeterogeneousConfigFromRawJSON(interfaceType, name string, rawJSON json.RawMessage) (proto.Message, error) {
|
||||
fsdef := envimpl.NewDefaultFileSystemDefaultImpl()
|
||||
ctx := envctx.ContextWithEnvironment(context.TODO(), fsdef)
|
||||
if rawJSON == nil || len(rawJSON) == 0 {
|
||||
if len(rawJSON) == 0 {
|
||||
rawJSON = []byte("{}")
|
||||
}
|
||||
return registry.LoadImplementationByAlias(ctx, interfaceType, name, []byte(rawJSON))
|
||||
|
@ -6,6 +6,8 @@ import (
|
||||
"context"
|
||||
"crypto/hmac"
|
||||
"crypto/sha256"
|
||||
"hash/crc64"
|
||||
|
||||
core "github.com/v2fly/v2ray-core/v5"
|
||||
"github.com/v2fly/v2ray-core/v5/common"
|
||||
"github.com/v2fly/v2ray-core/v5/common/buf"
|
||||
@ -23,7 +25,6 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v5/proxy/vmess/encoding"
|
||||
"github.com/v2fly/v2ray-core/v5/transport"
|
||||
"github.com/v2fly/v2ray-core/v5/transport/internet"
|
||||
"hash/crc64"
|
||||
)
|
||||
|
||||
// Handler is an outbound connection handler for VMess protocol.
|
||||
|
@ -252,7 +252,9 @@ func (v *TimedUserValidator) BurnTaintFuse(userHash []byte) error {
|
||||
return ErrNotFound
|
||||
}
|
||||
|
||||
/* ShouldShowLegacyWarn will return whether a Legacy Warning should be shown
|
||||
/*
|
||||
ShouldShowLegacyWarn will return whether a Legacy Warning should be shown
|
||||
|
||||
Not guaranteed to only return true once for every inbound, but it is okay.
|
||||
*/
|
||||
func (v *TimedUserValidator) ShouldShowLegacyWarn() bool {
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Package kcp - A Fast and Reliable ARQ Protocol
|
||||
//
|
||||
// Acknowledgement:
|
||||
//
|
||||
// skywind3000@github for inventing the KCP protocol
|
||||
// xtaci@github for translating to Golang
|
||||
package kcp
|
||||
|
@ -10,12 +10,16 @@ import (
|
||||
|
||||
const SystemDNS = "8.8.8.8:53"
|
||||
|
||||
/* DNSResolverFunc
|
||||
/*
|
||||
DNSResolverFunc
|
||||
|
||||
This is a temporary API and is subject to removal at any time.
|
||||
*/
|
||||
type DNSResolverFunc func() *net.Resolver
|
||||
|
||||
/* NewDNSResolver
|
||||
/*
|
||||
NewDNSResolver
|
||||
|
||||
This is a temporary API and is subject to removal at any time.
|
||||
*/
|
||||
var NewDNSResolver DNSResolverFunc = func() *net.Resolver {
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*Package websocket implements Websocket transport
|
||||
/*
|
||||
Package websocket implements Websocket transport
|
||||
|
||||
Websocket transport implements an HTTP(S) compliable, surveillance proof transport method with plausible deniability.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user