mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
move buildable to cfg common
This commit is contained in:
parent
b61d55c6a7
commit
41b54ff61e
@ -2,6 +2,7 @@ package conf
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
@ -32,7 +33,7 @@ func (v *BlackholeConfig) Build() (proto.Message, error) {
|
||||
if err != nil {
|
||||
return nil, newError("Config: Failed to parse Blackhole response config.").Base(err)
|
||||
}
|
||||
responseSettings, err := response.(Buildable).Build()
|
||||
responseSettings, err := response.(cfgcommon.Buildable).Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package conf_test
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"testing"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common/serial"
|
||||
@ -9,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func TestHTTPResponseJSON(t *testing.T) {
|
||||
creator := func() Buildable {
|
||||
creator := func() cfgcommon.Buildable {
|
||||
return new(BlackholeConfig)
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package conf
|
||||
package cfgcommon
|
||||
|
||||
import "github.com/golang/protobuf/proto"
|
||||
|
@ -1,6 +1,7 @@
|
||||
package conf_test
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"testing"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||
@ -9,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func TestDnsProxyConfig(t *testing.T) {
|
||||
creator := func() Buildable {
|
||||
creator := func() cfgcommon.Buildable {
|
||||
return new(DNSOutboundConfig)
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package conf_test
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"testing"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||
@ -9,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func TestDokodemoConfig(t *testing.T) {
|
||||
creator := func() Buildable {
|
||||
creator := func() cfgcommon.Buildable {
|
||||
return new(DokodemoConfig)
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package conf_test
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"testing"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||
@ -10,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestFreedomConfig(t *testing.T) {
|
||||
creator := func() Buildable {
|
||||
creator := func() cfgcommon.Buildable {
|
||||
return new(FreedomConfig)
|
||||
}
|
||||
|
||||
|
@ -2,15 +2,15 @@ package conf_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common"
|
||||
. "github.com/v2fly/v2ray-core/v4/infra/conf"
|
||||
)
|
||||
|
||||
func loadJSON(creator func() Buildable) func(string) (proto.Message, error) {
|
||||
func loadJSON(creator func() cfgcommon.Buildable) func(string) (proto.Message, error) {
|
||||
return func(s string) (proto.Message, error) {
|
||||
instance := creator()
|
||||
if err := json.Unmarshal([]byte(s), instance); err != nil {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package conf_test
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"testing"
|
||||
|
||||
. "github.com/v2fly/v2ray-core/v4/infra/conf"
|
||||
@ -8,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func TestHTTPServerConfig(t *testing.T) {
|
||||
creator := func() Buildable {
|
||||
creator := func() cfgcommon.Buildable {
|
||||
return new(HTTPServerConfig)
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package conf_test
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"testing"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/app/reverse"
|
||||
@ -8,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func TestReverseConfig(t *testing.T) {
|
||||
creator := func() conf.Buildable {
|
||||
creator := func() cfgcommon.Buildable {
|
||||
return new(conf.ReverseConfig)
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ func (r *BalancingRule) Build() (*router.BalancingRule, error) {
|
||||
return nil, newError("failed to parse to strategy config.").Base(err)
|
||||
}
|
||||
var ts proto.Message
|
||||
if builder, ok := rawConfig.(Buildable); ok {
|
||||
if builder, ok := rawConfig.(cfgcommon.Buildable); ok {
|
||||
ts, err = builder.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -1,6 +1,7 @@
|
||||
package conf_test
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"testing"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||
@ -11,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestShadowsocksServerConfigParsing(t *testing.T) {
|
||||
creator := func() Buildable {
|
||||
creator := func() cfgcommon.Buildable {
|
||||
return new(ShadowsocksServerConfig)
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package conf_test
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"testing"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||
@ -11,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSocksInboundConfig(t *testing.T) {
|
||||
creator := func() Buildable {
|
||||
creator := func() cfgcommon.Buildable {
|
||||
return new(SocksServerConfig)
|
||||
}
|
||||
|
||||
@ -50,7 +51,7 @@ func TestSocksInboundConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSocksOutboundConfig(t *testing.T) {
|
||||
creator := func() Buildable {
|
||||
creator := func() cfgcommon.Buildable {
|
||||
return new(SocksClientConfig)
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ func (c *KCPConfig) Build() (proto.Message, error) {
|
||||
if err != nil {
|
||||
return nil, newError("invalid mKCP header config.").Base(err).AtError()
|
||||
}
|
||||
ts, err := headerConfig.(Buildable).Build()
|
||||
ts, err := headerConfig.(cfgcommon.Buildable).Build()
|
||||
if err != nil {
|
||||
return nil, newError("invalid mKCP header config").Base(err).AtError()
|
||||
}
|
||||
@ -125,7 +125,7 @@ func (c *TCPConfig) Build() (proto.Message, error) {
|
||||
if err != nil {
|
||||
return nil, newError("invalid TCP header config").Base(err).AtError()
|
||||
}
|
||||
ts, err := headerConfig.(Buildable).Build()
|
||||
ts, err := headerConfig.(cfgcommon.Buildable).Build()
|
||||
if err != nil {
|
||||
return nil, newError("invalid TCP header config").Base(err).AtError()
|
||||
}
|
||||
@ -221,7 +221,7 @@ func (c *QUICConfig) Build() (proto.Message, error) {
|
||||
if err != nil {
|
||||
return nil, newError("invalid QUIC header config.").Base(err).AtError()
|
||||
}
|
||||
ts, err := headerConfig.(Buildable).Build()
|
||||
ts, err := headerConfig.(cfgcommon.Buildable).Build()
|
||||
if err != nil {
|
||||
return nil, newError("invalid QUIC header config").Base(err).AtError()
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ func (c *InboundDetourConfig) Build() (*core.InboundHandlerConfig, error) {
|
||||
if dokodemoConfig, ok := rawConfig.(*DokodemoConfig); ok {
|
||||
receiverSettings.ReceiveOriginalDestination = dokodemoConfig.Redirect
|
||||
}
|
||||
ts, err := rawConfig.(Buildable).Build()
|
||||
ts, err := rawConfig.(cfgcommon.Buildable).Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -297,7 +297,7 @@ func (c *OutboundDetourConfig) Build() (*core.OutboundHandlerConfig, error) {
|
||||
if err != nil {
|
||||
return nil, newError("failed to parse to outbound detour config.").Base(err)
|
||||
}
|
||||
ts, err := rawConfig.(Buildable).Build()
|
||||
ts, err := rawConfig.(cfgcommon.Buildable).Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package conf_test
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"testing"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||
@ -13,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestVLessOutbound(t *testing.T) {
|
||||
creator := func() Buildable {
|
||||
creator := func() cfgcommon.Buildable {
|
||||
return new(VLessOutboundConfig)
|
||||
}
|
||||
|
||||
@ -59,7 +60,7 @@ func TestVLessOutbound(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestVLessInbound(t *testing.T) {
|
||||
creator := func() Buildable {
|
||||
creator := func() cfgcommon.Buildable {
|
||||
return new(VLessInboundConfig)
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package conf_test
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
|
||||
"testing"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||
@ -13,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestVMessOutbound(t *testing.T) {
|
||||
creator := func() Buildable {
|
||||
creator := func() cfgcommon.Buildable {
|
||||
return new(VMessOutboundConfig)
|
||||
}
|
||||
|
||||
@ -63,7 +64,7 @@ func TestVMessOutbound(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestVMessInbound(t *testing.T) {
|
||||
creator := func() Buildable {
|
||||
creator := func() cfgcommon.Buildable {
|
||||
return new(VMessInboundConfig)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user