update coding style

This commit is contained in:
Shelikhoo 2021-06-05 00:42:53 +01:00
parent cd86ba9f4a
commit 718d6f32bf
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316
20 changed files with 31 additions and 29 deletions

View File

@ -302,7 +302,7 @@ func sniffer(ctx context.Context, cReader *cachedReader, metadataOnly bool) (Sni
return contentResult, contentErr
}
//TODO Pending removal for tagged connection
// TODO Pending removal for tagged connection
func (d *DefaultDispatcher) targetedDispatch(ctx context.Context, link *transport.Link, tag string) {
handler := d.ohm.GetHandler(tag)
if handler == nil {

View File

@ -5,10 +5,10 @@ package router
import (
"context"
"github.com/v2fly/v2ray-core/v4/features/routing"
"github.com/v2fly/v2ray-core/v4/features/extension"
"github.com/v2fly/v2ray-core/v4/features/outbound"
"github.com/v2fly/v2ray-core/v4/features/routing"
)
type BalancingStrategy interface {

View File

@ -7,7 +7,6 @@ import (
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

View File

@ -5,12 +5,12 @@ package router
import (
"context"
"github.com/v2fly/v2ray-core/v4/features/routing"
core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/app/observatory"
"github.com/v2fly/v2ray-core/v4/common"
"github.com/v2fly/v2ray-core/v4/features/extension"
"github.com/v2fly/v2ray-core/v4/features/routing"
)
type LeastPingStrategy struct {

View File

@ -3,7 +3,7 @@ package internal
import "encoding/binary"
func ChaCha20Block(s *[16]uint32, out []byte, rounds int) {
x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15 := s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11], s[12], s[13], s[14], s[15]
var x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15 = s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11], s[12], s[13], s[14], s[15]
for i := 0; i < rounds; i += 2 {
var x uint32

View File

@ -38,7 +38,7 @@ func (err *Error) pkgPath() string {
return ""
}
path := reflect.TypeOf(err.pathObj).PkgPath()
//TODO update required on release
// TODO update required on release
path = strings.TrimPrefix(path, "github.com/v2fly/v2ray-core/v4/")
path = strings.TrimPrefix(path, "github.com/v2fly/v2ray-core/v4")
return path

View File

@ -2,8 +2,9 @@ package serial
import (
"errors"
"github.com/golang/protobuf/proto"
"reflect"
"github.com/golang/protobuf/proto"
)
// ToTypedMessage converts a proto Message into TypedMessage.

View File

@ -3,9 +3,10 @@ package conf
import (
"context"
"encoding/json"
"github.com/golang/protobuf/proto"
"strings"
"github.com/golang/protobuf/proto"
"github.com/v2fly/v2ray-core/v4/app/router"
"github.com/v2fly/v2ray-core/v4/common/platform"
"github.com/v2fly/v2ray-core/v4/common/serial"

View File

@ -4,6 +4,7 @@ import (
"time"
"github.com/golang/protobuf/proto"
"github.com/v2fly/v2ray-core/v4/app/router"
)

View File

@ -2,9 +2,9 @@ package jsonv4
import (
"fmt"
"github.com/v2fly/v2ray-core/v4/main/commands/all/api"
handlerService "github.com/v2fly/v2ray-core/v4/app/proxyman/command"
"github.com/v2fly/v2ray-core/v4/main/commands/all/api"
"github.com/v2fly/v2ray-core/v4/main/commands/base"
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
)
@ -47,7 +47,7 @@ func executeAddInbounds(cmd *base.Command, args []string) {
api.SetSharedFlags(cmd)
api.SetSharedConfigFlags(cmd)
cmd.Flag.Parse(args)
c, err := helpers.LoadConfig(cmd.Flag.Args(), api.ApiConfigFormat, api.ApiConfigRecursively)
c, err := helpers.LoadConfig(cmd.Flag.Args(), api.APIConfigFormat, api.APIConfigRecursively)
if err != nil {
base.Fatalf("failed to load: %s", err)
}

View File

@ -2,9 +2,9 @@ package jsonv4
import (
"fmt"
"github.com/v2fly/v2ray-core/v4/main/commands/all/api"
handlerService "github.com/v2fly/v2ray-core/v4/app/proxyman/command"
"github.com/v2fly/v2ray-core/v4/main/commands/all/api"
"github.com/v2fly/v2ray-core/v4/main/commands/base"
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
)
@ -57,7 +57,7 @@ func executeRemoveInbounds(cmd *base.Command, args []string) {
if *isTags {
tags = cmd.Flag.Args()
} else {
c, err := helpers.LoadConfig(cmd.Flag.Args(), api.ApiConfigFormat, api.ApiConfigRecursively)
c, err := helpers.LoadConfig(cmd.Flag.Args(), api.APIConfigFormat, api.APIConfigRecursively)
if err != nil {
base.Fatalf("failed to load: %s", err)
}

View File

@ -8,5 +8,4 @@ func init() {
cmdAddOutbounds,
cmdRemoveInbounds,
cmdRemoveOutbounds)
}

View File

@ -2,9 +2,9 @@ package jsonv4
import (
"fmt"
"github.com/v2fly/v2ray-core/v4/main/commands/all/api"
handlerService "github.com/v2fly/v2ray-core/v4/app/proxyman/command"
"github.com/v2fly/v2ray-core/v4/main/commands/all/api"
"github.com/v2fly/v2ray-core/v4/main/commands/base"
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
)
@ -47,7 +47,7 @@ func executeAddOutbounds(cmd *base.Command, args []string) {
api.SetSharedFlags(cmd)
api.SetSharedConfigFlags(cmd)
cmd.Flag.Parse(args)
c, err := helpers.LoadConfig(cmd.Flag.Args(), api.ApiConfigFormat, api.ApiConfigRecursively)
c, err := helpers.LoadConfig(cmd.Flag.Args(), api.APIConfigFormat, api.APIConfigRecursively)
if err != nil {
base.Fatalf("failed to load: %s", err)
}

View File

@ -2,9 +2,9 @@ package jsonv4
import (
"fmt"
"github.com/v2fly/v2ray-core/v4/main/commands/all/api"
handlerService "github.com/v2fly/v2ray-core/v4/app/proxyman/command"
"github.com/v2fly/v2ray-core/v4/main/commands/all/api"
"github.com/v2fly/v2ray-core/v4/main/commands/base"
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
)
@ -57,7 +57,7 @@ func executeRemoveOutbounds(cmd *base.Command, args []string) {
if *isTags {
tags = cmd.Flag.Args()
} else {
c, err := helpers.LoadConfig(cmd.Flag.Args(), api.ApiConfigFormat, api.ApiConfigRecursively)
c, err := helpers.LoadConfig(cmd.Flag.Args(), api.APIConfigFormat, api.APIConfigRecursively)
if err != nil {
base.Fatalf("failed to load: %s", err)
}

View File

@ -8,21 +8,21 @@ import (
"strings"
"time"
"github.com/v2fly/v2ray-core/v4/main/commands/base"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/main/commands/base"
)
var (
apiServerAddrPtr string
apiTimeout int
apiJSON bool
// ApiConfigFormat is an internal variable
ApiConfigFormat string
// ApiConfigRecursively is an internal variable
ApiConfigRecursively bool
// APIConfigFormat is an internal variable
APIConfigFormat string
// APIConfigRecursively is an internal variable
APIConfigRecursively bool
)
// SetSharedFlags is an internal API
@ -44,8 +44,8 @@ func SetSharedConfigFlags(cmd *base.Command) {
}
func setSharedConfigFlags(cmd *base.Command) {
cmd.Flag.StringVar(&ApiConfigFormat, "format", core.FormatAuto, "")
cmd.Flag.BoolVar(&ApiConfigRecursively, "r", false, "")
cmd.Flag.StringVar(&APIConfigFormat, "format", core.FormatAuto, "")
cmd.Flag.BoolVar(&APIConfigRecursively, "r", false, "")
}
// SetSharedFlags is an internal API

View File

@ -3,18 +3,18 @@ package jsonv4
import (
"bytes"
"encoding/json"
"github.com/pelletier/go-toml"
"os"
"strings"
"github.com/pelletier/go-toml"
"google.golang.org/protobuf/proto"
"gopkg.in/yaml.v2"
core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/infra/conf/merge"
"github.com/v2fly/v2ray-core/v4/infra/conf/serial"
"github.com/v2fly/v2ray-core/v4/main/commands/base"
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
"gopkg.in/yaml.v2"
)
var cmdConvert = &base.Command{

View File

@ -4,6 +4,7 @@ import (
"os"
"github.com/v2fly/VSign/signerVerify"
"github.com/v2fly/v2ray-core/v4/main/commands/base"
)

View File

@ -11,7 +11,7 @@ import (
"strings"
"syscall"
"github.com/v2fly/v2ray-core/v4"
core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/common/cmdarg"
"github.com/v2fly/v2ray-core/v4/common/platform"
"github.com/v2fly/v2ray-core/v4/main/commands/base"

View File

@ -4,7 +4,7 @@ import (
"fmt"
"log"
"github.com/v2fly/v2ray-core/v4"
core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/main/commands/base"
)

View File

@ -3,7 +3,7 @@ package commands
import (
"fmt"
"github.com/v2fly/v2ray-core/v4"
core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/main/commands/base"
)