mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-04-14 01:29:17 -04:00
Chore: format code to fix lint (#1426)
This commit is contained in:
@@ -70,6 +70,7 @@ security = 'tls'
|
||||
json.Unmarshal(bs, &m)
|
||||
assertResult(t, m, expected)
|
||||
}
|
||||
|
||||
func TestTOMLToJSON_ValueTypes(t *testing.T) {
|
||||
input := `
|
||||
boolean = [ true, false, true, false ]
|
||||
|
||||
@@ -67,6 +67,7 @@ outbounds:
|
||||
json.Unmarshal(bs, &m)
|
||||
assertResult(t, m, expected)
|
||||
}
|
||||
|
||||
func TestYMLToJSON_ValueTypes(t *testing.T) {
|
||||
input := `
|
||||
boolean:
|
||||
|
||||
@@ -193,6 +193,7 @@ func TestMergeTagDeep(t *testing.T) {
|
||||
}
|
||||
assertResult(t, m, expected)
|
||||
}
|
||||
|
||||
func assertResult(t *testing.T, value []byte, expected string) {
|
||||
v := make(map[string]interface{})
|
||||
err := serial.DecodeJSON(bytes.NewReader(value), &v)
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
package merge
|
||||
|
||||
const priorityKey string = "_priority"
|
||||
const tagKey string = "_tag"
|
||||
const (
|
||||
priorityKey string = "_priority"
|
||||
tagKey string = "_tag"
|
||||
)
|
||||
|
||||
// ApplyRules applies merge rules according to _tag, _priority fields, and remove them
|
||||
func ApplyRules(m map[string]interface{}) error {
|
||||
|
||||
@@ -204,7 +204,6 @@ func (c *DNSConfig) BuildV5(ctx context.Context) (*dns.Config, error) {
|
||||
|
||||
// Build implements Buildable
|
||||
func (c *DNSConfig) Build() (*dns.Config, error) {
|
||||
|
||||
if c.cfgctx == nil {
|
||||
c.cfgctx = cfgcommon.NewConfigureLoadingContext(context.Background())
|
||||
|
||||
|
||||
@@ -15,16 +15,13 @@ const (
|
||||
strategyLeastPing string = "leastping"
|
||||
)
|
||||
|
||||
var (
|
||||
strategyConfigLoader = loader.NewJSONConfigLoader(loader.ConfigCreatorCache{
|
||||
strategyRandom: func() interface{} { return new(strategyEmptyConfig) },
|
||||
strategyLeastLoad: func() interface{} { return new(strategyLeastLoadConfig) },
|
||||
strategyLeastPing: func() interface{} { return new(strategyLeastPingConfig) },
|
||||
}, "type", "settings")
|
||||
)
|
||||
var strategyConfigLoader = loader.NewJSONConfigLoader(loader.ConfigCreatorCache{
|
||||
strategyRandom: func() interface{} { return new(strategyEmptyConfig) },
|
||||
strategyLeastLoad: func() interface{} { return new(strategyLeastLoadConfig) },
|
||||
strategyLeastPing: func() interface{} { return new(strategyLeastPingConfig) },
|
||||
}, "type", "settings")
|
||||
|
||||
type strategyEmptyConfig struct {
|
||||
}
|
||||
type strategyEmptyConfig struct{}
|
||||
|
||||
func (v *strategyEmptyConfig) Build() (proto.Message, error) {
|
||||
return nil, nil
|
||||
|
||||
@@ -33,7 +33,6 @@ func (v *V2JsonProtobufFollower) Range(f func(protoreflect.FieldDescriptor, prot
|
||||
name := descriptor.FullName()
|
||||
fullname := v.Message.Descriptor().FullName()
|
||||
if fullname == "google.protobuf.Any" {
|
||||
|
||||
switch name {
|
||||
case "google.protobuf.Any.type_url":
|
||||
fd := V2JsonProtobufAnyTypeFieldDescriptor{descriptor}
|
||||
@@ -58,7 +57,6 @@ func (v *V2JsonProtobufFollower) Range(f func(protoreflect.FieldDescriptor, prot
|
||||
default:
|
||||
panic("unexpected any value")
|
||||
}
|
||||
|
||||
}
|
||||
return followValue(descriptor, value, f)
|
||||
})
|
||||
@@ -106,7 +104,6 @@ func (v *V2JsonProtobufFollower) Set(descriptor protoreflect.FieldDescriptor, va
|
||||
default:
|
||||
v.Message.Set(descriptor, value)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (v *V2JsonProtobufFollower) Mutable(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
@@ -124,7 +121,6 @@ func (v *V2JsonProtobufFollower) Mutable(descriptor protoreflect.FieldDescriptor
|
||||
}
|
||||
|
||||
func (v *V2JsonProtobufFollower) NewField(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
|
||||
if _, ok := descriptor.(*V2JsonProtobufAnyValueField); ok {
|
||||
|
||||
url := v.Message.Get(v.Message.Descriptor().Fields().ByName("type_url")).String()
|
||||
|
||||
@@ -54,6 +54,7 @@ type V2JsonProtobufAnyTypeFieldDescriptor struct {
|
||||
func (v V2JsonProtobufAnyTypeFieldDescriptor) JSONName() string {
|
||||
return "type"
|
||||
}
|
||||
|
||||
func (v V2JsonProtobufAnyTypeFieldDescriptor) TextName() string {
|
||||
return "type"
|
||||
}
|
||||
@@ -70,6 +71,7 @@ func (v *V2JsonProtobufAnyValueField) Kind() protoreflect.Kind {
|
||||
func (v *V2JsonProtobufAnyValueField) JSONName() string {
|
||||
return v.name
|
||||
}
|
||||
|
||||
func (v *V2JsonProtobufAnyValueField) TextName() string {
|
||||
return v.name
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user