mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-04-14 17:49:15 -04:00
Lint: fix lint (#1427)
* Lint: replace golint with revive * Lint: fix lint
This commit is contained in:
@@ -32,5 +32,5 @@ func mapToJSON(tree *toml.Tree) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(bytes[:]), nil
|
||||
return string(bytes), nil
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
//go:generate go run github.com/v2fly/v2ray-core/v4/common/errors/errorgen
|
||||
|
||||
func loadJsonPb(data io.Reader) (*core.Config, error) {
|
||||
func loadJSONPB(data io.Reader) (*core.Config, error) {
|
||||
coreconf := &core.Config{}
|
||||
jsonpbloader := &jsonpb.Unmarshaler{AnyResolver: serial.GetResolver()}
|
||||
err := jsonpbloader.Unmarshal(data, coreconf)
|
||||
@@ -26,7 +26,7 @@ func loadJsonPb(data io.Reader) (*core.Config, error) {
|
||||
return coreconf, nil
|
||||
}
|
||||
|
||||
func dumpJsonPb(config proto.Message, w io.Writer) error {
|
||||
func dumpJSONPb(config proto.Message, w io.Writer) error {
|
||||
jsonpbdumper := &jsonpb.Marshaler{AnyResolver: serial.GetResolver()}
|
||||
err := jsonpbdumper.Marshal(w, config)
|
||||
if err != nil {
|
||||
@@ -35,8 +35,8 @@ func dumpJsonPb(config proto.Message, w io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func DumpJsonPb(config proto.Message, w io.Writer) error {
|
||||
return dumpJsonPb(config, w)
|
||||
func DumpJSONPb(config proto.Message, w io.Writer) error {
|
||||
return dumpJSONPb(config, w)
|
||||
}
|
||||
|
||||
const FormatProtobufJSONPB = "jsonpb"
|
||||
@@ -56,13 +56,13 @@ func init() {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return loadJsonPb(bytes.NewReader(data))
|
||||
return loadJSONPB(bytes.NewReader(data))
|
||||
case io.Reader:
|
||||
data, err := buf.ReadAllToBytes(v)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return loadJsonPb(bytes.NewReader(data))
|
||||
return loadJSONPB(bytes.NewReader(data))
|
||||
default:
|
||||
return nil, newError("unknow type")
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
core "github.com/v2fly/v2ray-core/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/common/errors"
|
||||
json_reader "github.com/v2fly/v2ray-core/v4/infra/conf/json"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
)
|
||||
|
||||
type offset struct {
|
||||
|
||||
@@ -139,7 +139,7 @@ var typeMap = map[routercommon.Domain_Type]dns.DomainMatchingType{
|
||||
}
|
||||
|
||||
// DNSConfig is a JSON serializable object for dns.Config.
|
||||
type DNSConfig struct {
|
||||
type DNSConfig struct { // nolint: revive
|
||||
Servers []*NameServerConfig `json:"servers"`
|
||||
Hosts map[string]*HostAddress `json:"hosts"`
|
||||
ClientIP *cfgcommon.Address `json:"clientIp"`
|
||||
@@ -216,7 +216,6 @@ func (c *DNSConfig) Build() (*dns.Config, error) {
|
||||
} else {
|
||||
return nil, newError("unable to create geo data loader ").Base(err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cfgEnv := cfgcommon.GetConfigureLoadingEnvironment(c.cfgctx)
|
||||
|
||||
@@ -14,7 +14,7 @@ func DefaultLogConfig() *log.Config {
|
||||
}
|
||||
}
|
||||
|
||||
type LogConfig struct {
|
||||
type LogConfig struct { // nolint: revive
|
||||
AccessLog string `json:"access"`
|
||||
ErrorLog string `json:"error"`
|
||||
LogLevel string `json:"loglevel"`
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
rule2 "github.com/v2fly/v2ray-core/v4/infra/conf/rule"
|
||||
)
|
||||
|
||||
type RouterRulesConfig struct {
|
||||
type RouterRulesConfig struct { // nolint: revive
|
||||
RuleList []json.RawMessage `json:"rules"`
|
||||
DomainStrategy string `json:"domainStrategy"`
|
||||
}
|
||||
@@ -82,7 +82,7 @@ func (r *BalancingRule) Build() (*router.BalancingRule, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
type RouterConfig struct {
|
||||
type RouterConfig struct { // nolint: revive
|
||||
Settings *RouterRulesConfig `json:"settings"` // Deprecated
|
||||
RuleList []json.RawMessage `json:"rules"`
|
||||
DomainStrategy *string `json:"domainStrategy"`
|
||||
|
||||
@@ -89,18 +89,18 @@ func (v *V2JsonProtobufFollower) Clear(descriptor protoreflect.FieldDescriptor)
|
||||
}
|
||||
|
||||
func (v *V2JsonProtobufFollower) Set(descriptor protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch descriptor.(type) {
|
||||
switch descriptor := descriptor.(type) {
|
||||
case V2JsonProtobufFollowerFieldDescriptor:
|
||||
v.Message.Set(descriptor.(V2JsonProtobufFollowerFieldDescriptor).FieldDescriptor, value)
|
||||
v.Message.Set(descriptor.FieldDescriptor, value)
|
||||
case *V2JsonProtobufFollowerFieldDescriptor:
|
||||
v.Message.Set(descriptor.(*V2JsonProtobufFollowerFieldDescriptor).FieldDescriptor, value)
|
||||
v.Message.Set(descriptor.FieldDescriptor, value)
|
||||
case *V2JsonProtobufAnyValueField:
|
||||
protodata := value.Message()
|
||||
bytesw, err := proto.MarshalOptions{AllowPartial: true}.Marshal(&V2JsonProtobufAnyValueFieldReturn{protodata})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
v.Message.Set(descriptor.(*V2JsonProtobufAnyValueField).FieldDescriptor, protoreflect.ValueOfBytes(bytesw))
|
||||
v.Message.Set(descriptor.FieldDescriptor, protoreflect.ValueOfBytes(bytesw))
|
||||
default:
|
||||
v.Message.Set(descriptor, value)
|
||||
}
|
||||
@@ -122,9 +122,7 @@ 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()
|
||||
|
||||
v2type := serial.V2TypeFromURL(url)
|
||||
instance, err := serial.GetInstance(v2type)
|
||||
if err != nil {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v4/common/serial"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/blackhole"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/dns"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/dokodemo"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v4/common/protocol"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/freedom"
|
||||
)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/http"
|
||||
)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/app/observatory"
|
||||
"github.com/v2fly/v2ray-core/v4/app/observatory/burst"
|
||||
"github.com/v2fly/v2ray-core/v4/app/observatory/multiObservatory"
|
||||
"github.com/v2fly/v2ray-core/v4/app/observatory/multiobservatory"
|
||||
"github.com/v2fly/v2ray-core/v4/common/serial"
|
||||
"github.com/v2fly/v2ray-core/v4/common/taggedfeatures"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/duration"
|
||||
@@ -32,11 +32,11 @@ type BurstObservatoryConfig struct {
|
||||
}
|
||||
|
||||
func (b BurstObservatoryConfig) Build() (proto.Message, error) {
|
||||
if result, err := b.HealthCheck.Build(); err == nil {
|
||||
result, err := b.HealthCheck.Build()
|
||||
if err == nil {
|
||||
return &burst.Config{SubjectSelector: b.SubjectSelector, PingConfig: result.(*burst.HealthPingConfig)}, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
type MultiObservatoryItem struct {
|
||||
@@ -50,7 +50,7 @@ type MultiObservatoryConfig struct {
|
||||
}
|
||||
|
||||
func (o *MultiObservatoryConfig) Build() (proto.Message, error) {
|
||||
ret := &multiObservatory.Config{Holders: &taggedfeatures.Config{Features: make(map[string]*anypb.Any)}}
|
||||
ret := &multiobservatory.Config{Holders: &taggedfeatures.Config{Features: make(map[string]*anypb.Any)}}
|
||||
for _, v := range o.Observers {
|
||||
switch v.MemberType {
|
||||
case "burst":
|
||||
@@ -64,7 +64,6 @@ func (o *MultiObservatoryConfig) Build() (proto.Message, error) {
|
||||
return nil, err
|
||||
}
|
||||
ret.Holders.Features[v.Tag] = serial.ToTypedMessage(burstObservatoryConfigPb)
|
||||
break
|
||||
case "default":
|
||||
fallthrough
|
||||
default:
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
)
|
||||
|
||||
func TestBufferSize(t *testing.T) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v4/app/reverse"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
)
|
||||
|
||||
func TestReverseConfig(t *testing.T) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v4/common/serial"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/shadowsocks"
|
||||
)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v4/common/serial"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/socks"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v4/common/serial"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/socketcfg"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/transport"
|
||||
"github.com/v2fly/v2ray-core/v4/transport/internet"
|
||||
"github.com/v2fly/v2ray-core/v4/transport/internet/headers/http"
|
||||
|
||||
@@ -471,7 +471,7 @@ func (c *Config) Build() (*core.Config, error) {
|
||||
" instead of allowing end user to enable it without special tool and knowledge.")
|
||||
sb := strings.Builder{}
|
||||
return nil, newError("Cannot load service").Base(developererr).Base(err).Base(newError(sb.String()))
|
||||
} else { // nolint: golint
|
||||
} else { // nolint: revive
|
||||
// Using a else here is required to keep msg in scope
|
||||
config.App = append(config.App, msg...)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
// Geo loaders
|
||||
_ "github.com/v2fly/v2ray-core/v4/infra/conf/geodata/memconservative"
|
||||
_ "github.com/v2fly/v2ray-core/v4/infra/conf/geodata/standard"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/blackhole"
|
||||
dns_proxy "github.com/v2fly/v2ray-core/v4/proxy/dns"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/freedom"
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v4/common/serial"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/vless"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/vless/inbound"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/vless/outbound"
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v4/common/serial"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
v4 "github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/vmess"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/vmess/inbound"
|
||||
"github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound"
|
||||
|
||||
@@ -11,16 +11,16 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v4/common/registry"
|
||||
)
|
||||
|
||||
func loadHeterogeneousConfigFromRawJson(interfaceType, name string, rawJson json.RawMessage) (proto.Message, error) {
|
||||
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 {
|
||||
rawJson = []byte("{}")
|
||||
if rawJSON == nil || len(rawJSON) == 0 {
|
||||
rawJSON = []byte("{}")
|
||||
}
|
||||
return registry.LoadImplementationByAlias(ctx, interfaceType, name, []byte(rawJson))
|
||||
return registry.LoadImplementationByAlias(ctx, interfaceType, name, []byte(rawJSON))
|
||||
}
|
||||
|
||||
// LoadHeterogeneousConfigFromRawJson private API
|
||||
func LoadHeterogeneousConfigFromRawJson(ctx context.Context, interfaceType, name string, rawJson json.RawMessage) (proto.Message, error) {
|
||||
return loadHeterogeneousConfigFromRawJson(interfaceType, name, rawJson)
|
||||
// LoadHeterogeneousConfigFromRawJSON private API
|
||||
func LoadHeterogeneousConfigFromRawJSON(ctx context.Context, interfaceType, name string, rawJSON json.RawMessage) (proto.Message, error) {
|
||||
return loadHeterogeneousConfigFromRawJSON(interfaceType, name, rawJSON)
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func (c InboundConfig) BuildV5(ctx context.Context) (proto.Message, error) {
|
||||
c.Settings = []byte("{}")
|
||||
}
|
||||
|
||||
inboundConfigPack, err := loadHeterogeneousConfigFromRawJson("inbound", c.Protocol, c.Settings)
|
||||
inboundConfigPack, err := loadHeterogeneousConfigFromRawJSON("inbound", c.Protocol, c.Settings)
|
||||
if err != nil {
|
||||
return nil, newError("unable to load inbound protocol config").Base(err)
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ func init() {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return loadJsonConfig(data)
|
||||
return loadJSONConfig(data)
|
||||
case io.Reader:
|
||||
data, err := buf.ReadAllToBytes(v)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return loadJsonConfig(data)
|
||||
return loadJSONConfig(data)
|
||||
default:
|
||||
return nil, newError("unknown type")
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ func (c OutboundConfig) BuildV5(ctx context.Context) (proto.Message, error) {
|
||||
c.Settings = []byte("{}")
|
||||
}
|
||||
|
||||
outboundConfigPack, err := loadHeterogeneousConfigFromRawJson("outbound", c.Protocol, c.Settings)
|
||||
outboundConfigPack, err := loadHeterogeneousConfigFromRawJSON("outbound", c.Protocol, c.Settings)
|
||||
if err != nil {
|
||||
return nil, newError("unable to load outbound protocol config").Base(err)
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ func (c RootConfig) BuildV5(ctx context.Context) (proto.Message, error) {
|
||||
|
||||
var logConfMsg *anypb.Any
|
||||
if c.LogConfig != nil {
|
||||
logConfMsgUnpacked, err := loadHeterogeneousConfigFromRawJson("service", "log", c.LogConfig)
|
||||
logConfMsgUnpacked, err := loadHeterogeneousConfigFromRawJSON("service", "log", c.LogConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -41,7 +41,7 @@ func (c RootConfig) BuildV5(ctx context.Context) (proto.Message, error) {
|
||||
config.App = append([]*anypb.Any{logConfMsg}, config.App...)
|
||||
|
||||
if c.RouterConfig != nil {
|
||||
routerConfig, err := loadHeterogeneousConfigFromRawJson("service", "router", c.RouterConfig)
|
||||
routerConfig, err := loadHeterogeneousConfigFromRawJSON("service", "router", c.RouterConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -49,7 +49,7 @@ func (c RootConfig) BuildV5(ctx context.Context) (proto.Message, error) {
|
||||
}
|
||||
|
||||
if c.DNSConfig != nil {
|
||||
dnsApp, err := loadHeterogeneousConfigFromRawJson("service", "dns", c.DNSConfig)
|
||||
dnsApp, err := loadHeterogeneousConfigFromRawJSON("service", "dns", c.DNSConfig)
|
||||
if err != nil {
|
||||
return nil, newError("failed to parse DNS config").Base(err)
|
||||
}
|
||||
@@ -73,7 +73,7 @@ func (c RootConfig) BuildV5(ctx context.Context) (proto.Message, error) {
|
||||
}
|
||||
|
||||
for serviceName, service := range c.Services {
|
||||
servicePackedConfig, err := loadHeterogeneousConfigFromRawJson("service", serviceName, service)
|
||||
servicePackedConfig, err := loadHeterogeneousConfigFromRawJSON("service", serviceName, service)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -82,7 +82,7 @@ func (c RootConfig) BuildV5(ctx context.Context) (proto.Message, error) {
|
||||
return config, nil
|
||||
}
|
||||
|
||||
func loadJsonConfig(data []byte) (*core.Config, error) {
|
||||
func loadJSONConfig(data []byte) (*core.Config, error) {
|
||||
rootConfig := &RootConfig{}
|
||||
|
||||
err := json.Unmarshal(data, rootConfig)
|
||||
|
||||
@@ -22,7 +22,7 @@ func (s StreamConfig) BuildV5(ctx context.Context) (proto.Message, error) {
|
||||
if s.TransportSettings == nil {
|
||||
s.TransportSettings = []byte("{}")
|
||||
}
|
||||
transportConfigPack, err := loadHeterogeneousConfigFromRawJson("transport", s.Transport, s.TransportSettings)
|
||||
transportConfigPack, err := loadHeterogeneousConfigFromRawJSON("transport", s.Transport, s.TransportSettings)
|
||||
if err != nil {
|
||||
return nil, newError("unable to load transport config").Base(err)
|
||||
}
|
||||
@@ -37,7 +37,7 @@ func (s StreamConfig) BuildV5(ctx context.Context) (proto.Message, error) {
|
||||
if s.SecuritySettings == nil {
|
||||
s.SecuritySettings = []byte("{}")
|
||||
}
|
||||
securityConfigPack, err := loadHeterogeneousConfigFromRawJson("security", s.Security, s.SecuritySettings)
|
||||
securityConfigPack, err := loadHeterogeneousConfigFromRawJSON("security", s.Security, s.SecuritySettings)
|
||||
if err != nil {
|
||||
return nil, newError("unable to load security config").Base(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user