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

apply coding style

This commit is contained in:
Shelikhoo 2021-04-08 20:56:04 +01:00
parent 5a61749328
commit 459a914ab7
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316
8 changed files with 38 additions and 28 deletions

View File

@ -2,11 +2,13 @@ package command
import (
"context"
"google.golang.org/grpc"
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"
"google.golang.org/grpc"
)
type service struct {

View File

@ -1,13 +1,12 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.13.0
// protoc-gen-go v1.26.0
// protoc v3.15.6
// source: app/observatory/command/command.proto
package command
import (
proto "github.com/golang/protobuf/proto"
observatory "github.com/v2fly/v2ray-core/v4/app/observatory"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
@ -22,10 +21,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type GetOutboundStatusRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache

View File

@ -1,13 +1,12 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.13.0
// protoc-gen-go v1.26.0
// protoc v3.15.6
// source: app/observatory/config.proto
package observatory
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
@ -21,10 +20,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type ObservationResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache

View File

@ -4,7 +4,14 @@ package observatory
import (
"context"
"net"
"net/http"
"net/url"
"sync"
"time"
"github.com/golang/protobuf/proto"
core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/common"
v2net "github.com/v2fly/v2ray-core/v4/common/net"
@ -14,11 +21,6 @@ import (
"github.com/v2fly/v2ray-core/v4/features/extension"
"github.com/v2fly/v2ray-core/v4/features/outbound"
"github.com/v2fly/v2ray-core/v4/transport/internet/tagged"
"net"
"net/http"
"net/url"
"sync"
"time"
)
type Observer struct {

View File

@ -160,9 +160,21 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
}
func (br *BalancingRule) Build(ohm outbound.Manager) (*Balancer, error) {
return &Balancer{
selectors: br.OutboundSelector,
strategy: &RandomStrategy{},
ohm: ohm,
}, nil
switch br.Strategy {
case "leastPing":
return &Balancer{
selectors: br.OutboundSelector,
strategy: &LeastPingStrategy{},
ohm: ohm,
}, nil
case "random":
fallthrough
default:
return &Balancer{
selectors: br.OutboundSelector,
strategy: &RandomStrategy{},
ohm: ohm,
}, nil
}
}

View File

@ -1,9 +1,10 @@
package conf
import (
"strings"
"github.com/jhump/protoreflect/desc"
"github.com/jhump/protoreflect/dynamic"
"strings"
"github.com/v2fly/v2ray-core/v4/app/commander"
loggerservice "github.com/v2fly/v2ray-core/v4/app/log/command"

View File

@ -2,9 +2,11 @@ package conf
import (
"encoding/json"
"github.com/golang/protobuf/jsonpb"
"github.com/jhump/protoreflect/desc"
"github.com/jhump/protoreflect/dynamic"
"github.com/v2fly/v2ray-core/v4/common/serial"
)

View File

@ -2,12 +2,13 @@ package conf
import (
"encoding/json"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
"log"
"os"
"strings"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/app/dispatcher"
"github.com/v2fly/v2ray-core/v4/app/proxyman"