mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05:00
update coding style
This commit is contained in:
parent
cd86ba9f4a
commit
718d6f32bf
@ -5,10 +5,10 @@ package router
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/v2fly/v2ray-core/v4/features/routing"
|
|
||||||
|
|
||||||
"github.com/v2fly/v2ray-core/v4/features/extension"
|
"github.com/v2fly/v2ray-core/v4/features/extension"
|
||||||
"github.com/v2fly/v2ray-core/v4/features/outbound"
|
"github.com/v2fly/v2ray-core/v4/features/outbound"
|
||||||
|
"github.com/v2fly/v2ray-core/v4/features/routing"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BalancingStrategy interface {
|
type BalancingStrategy interface {
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
|
|
||||||
|
@ -5,12 +5,12 @@ package router
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/v2fly/v2ray-core/v4/features/routing"
|
|
||||||
|
|
||||||
core "github.com/v2fly/v2ray-core/v4"
|
core "github.com/v2fly/v2ray-core/v4"
|
||||||
"github.com/v2fly/v2ray-core/v4/app/observatory"
|
"github.com/v2fly/v2ray-core/v4/app/observatory"
|
||||||
"github.com/v2fly/v2ray-core/v4/common"
|
"github.com/v2fly/v2ray-core/v4/common"
|
||||||
"github.com/v2fly/v2ray-core/v4/features/extension"
|
"github.com/v2fly/v2ray-core/v4/features/extension"
|
||||||
|
"github.com/v2fly/v2ray-core/v4/features/routing"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LeastPingStrategy struct {
|
type LeastPingStrategy struct {
|
||||||
|
@ -3,7 +3,7 @@ package internal
|
|||||||
import "encoding/binary"
|
import "encoding/binary"
|
||||||
|
|
||||||
func ChaCha20Block(s *[16]uint32, out []byte, rounds int) {
|
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 {
|
for i := 0; i < rounds; i += 2 {
|
||||||
var x uint32
|
var x uint32
|
||||||
|
|
||||||
|
@ -2,8 +2,9 @@ package serial
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ToTypedMessage converts a proto Message into TypedMessage.
|
// ToTypedMessage converts a proto Message into TypedMessage.
|
||||||
|
@ -3,9 +3,10 @@ package conf
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
|
||||||
"github.com/v2fly/v2ray-core/v4/app/router"
|
"github.com/v2fly/v2ray-core/v4/app/router"
|
||||||
"github.com/v2fly/v2ray-core/v4/common/platform"
|
"github.com/v2fly/v2ray-core/v4/common/platform"
|
||||||
"github.com/v2fly/v2ray-core/v4/common/serial"
|
"github.com/v2fly/v2ray-core/v4/common/serial"
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
|
||||||
"github.com/v2fly/v2ray-core/v4/app/router"
|
"github.com/v2fly/v2ray-core/v4/app/router"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@ package jsonv4
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/all/api"
|
|
||||||
|
|
||||||
handlerService "github.com/v2fly/v2ray-core/v4/app/proxyman/command"
|
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/base"
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
|
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
|
||||||
)
|
)
|
||||||
@ -47,7 +47,7 @@ func executeAddInbounds(cmd *base.Command, args []string) {
|
|||||||
api.SetSharedFlags(cmd)
|
api.SetSharedFlags(cmd)
|
||||||
api.SetSharedConfigFlags(cmd)
|
api.SetSharedConfigFlags(cmd)
|
||||||
cmd.Flag.Parse(args)
|
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 {
|
if err != nil {
|
||||||
base.Fatalf("failed to load: %s", err)
|
base.Fatalf("failed to load: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@ package jsonv4
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/all/api"
|
|
||||||
|
|
||||||
handlerService "github.com/v2fly/v2ray-core/v4/app/proxyman/command"
|
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/base"
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
|
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
|
||||||
)
|
)
|
||||||
@ -57,7 +57,7 @@ func executeRemoveInbounds(cmd *base.Command, args []string) {
|
|||||||
if *isTags {
|
if *isTags {
|
||||||
tags = cmd.Flag.Args()
|
tags = cmd.Flag.Args()
|
||||||
} else {
|
} 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 {
|
if err != nil {
|
||||||
base.Fatalf("failed to load: %s", err)
|
base.Fatalf("failed to load: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -8,5 +8,4 @@ func init() {
|
|||||||
cmdAddOutbounds,
|
cmdAddOutbounds,
|
||||||
cmdRemoveInbounds,
|
cmdRemoveInbounds,
|
||||||
cmdRemoveOutbounds)
|
cmdRemoveOutbounds)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@ package jsonv4
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/all/api"
|
|
||||||
|
|
||||||
handlerService "github.com/v2fly/v2ray-core/v4/app/proxyman/command"
|
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/base"
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
|
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
|
||||||
)
|
)
|
||||||
@ -47,7 +47,7 @@ func executeAddOutbounds(cmd *base.Command, args []string) {
|
|||||||
api.SetSharedFlags(cmd)
|
api.SetSharedFlags(cmd)
|
||||||
api.SetSharedConfigFlags(cmd)
|
api.SetSharedConfigFlags(cmd)
|
||||||
cmd.Flag.Parse(args)
|
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 {
|
if err != nil {
|
||||||
base.Fatalf("failed to load: %s", err)
|
base.Fatalf("failed to load: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@ package jsonv4
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/all/api"
|
|
||||||
|
|
||||||
handlerService "github.com/v2fly/v2ray-core/v4/app/proxyman/command"
|
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/base"
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
|
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
|
||||||
)
|
)
|
||||||
@ -57,7 +57,7 @@ func executeRemoveOutbounds(cmd *base.Command, args []string) {
|
|||||||
if *isTags {
|
if *isTags {
|
||||||
tags = cmd.Flag.Args()
|
tags = cmd.Flag.Args()
|
||||||
} else {
|
} 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 {
|
if err != nil {
|
||||||
base.Fatalf("failed to load: %s", err)
|
base.Fatalf("failed to load: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -8,21 +8,21 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/base"
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
core "github.com/v2fly/v2ray-core/v4"
|
core "github.com/v2fly/v2ray-core/v4"
|
||||||
|
"github.com/v2fly/v2ray-core/v4/main/commands/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
apiServerAddrPtr string
|
apiServerAddrPtr string
|
||||||
apiTimeout int
|
apiTimeout int
|
||||||
apiJSON bool
|
apiJSON bool
|
||||||
// ApiConfigFormat is an internal variable
|
// APIConfigFormat is an internal variable
|
||||||
ApiConfigFormat string
|
APIConfigFormat string
|
||||||
// ApiConfigRecursively is an internal variable
|
// APIConfigRecursively is an internal variable
|
||||||
ApiConfigRecursively bool
|
APIConfigRecursively bool
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetSharedFlags is an internal API
|
// SetSharedFlags is an internal API
|
||||||
@ -44,8 +44,8 @@ func SetSharedConfigFlags(cmd *base.Command) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setSharedConfigFlags(cmd *base.Command) {
|
func setSharedConfigFlags(cmd *base.Command) {
|
||||||
cmd.Flag.StringVar(&ApiConfigFormat, "format", core.FormatAuto, "")
|
cmd.Flag.StringVar(&APIConfigFormat, "format", core.FormatAuto, "")
|
||||||
cmd.Flag.BoolVar(&ApiConfigRecursively, "r", false, "")
|
cmd.Flag.BoolVar(&APIConfigRecursively, "r", false, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSharedFlags is an internal API
|
// SetSharedFlags is an internal API
|
||||||
|
@ -3,18 +3,18 @@ package jsonv4
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/pelletier/go-toml"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/pelletier/go-toml"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
"gopkg.in/yaml.v2"
|
||||||
|
|
||||||
core "github.com/v2fly/v2ray-core/v4"
|
core "github.com/v2fly/v2ray-core/v4"
|
||||||
"github.com/v2fly/v2ray-core/v4/infra/conf/merge"
|
"github.com/v2fly/v2ray-core/v4/infra/conf/merge"
|
||||||
"github.com/v2fly/v2ray-core/v4/infra/conf/serial"
|
"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/base"
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
|
"github.com/v2fly/v2ray-core/v4/main/commands/helpers"
|
||||||
"gopkg.in/yaml.v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var cmdConvert = &base.Command{
|
var cmdConvert = &base.Command{
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/v2fly/VSign/signerVerify"
|
"github.com/v2fly/VSign/signerVerify"
|
||||||
|
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/base"
|
"github.com/v2fly/v2ray-core/v4/main/commands/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"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/cmdarg"
|
||||||
"github.com/v2fly/v2ray-core/v4/common/platform"
|
"github.com/v2fly/v2ray-core/v4/common/platform"
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/base"
|
"github.com/v2fly/v2ray-core/v4/main/commands/base"
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/v2fly/v2ray-core/v4"
|
core "github.com/v2fly/v2ray-core/v4"
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/base"
|
"github.com/v2fly/v2ray-core/v4/main/commands/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package commands
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/v2fly/v2ray-core/v4"
|
core "github.com/v2fly/v2ray-core/v4"
|
||||||
"github.com/v2fly/v2ray-core/v4/main/commands/base"
|
"github.com/v2fly/v2ray-core/v4/main/commands/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user