diff --git a/infra/conf/serial/loader.go b/infra/conf/serial/loader.go index 78e02cf3b..6d1472753 100644 --- a/infra/conf/serial/loader.go +++ b/infra/conf/serial/loader.go @@ -3,11 +3,11 @@ package serial import ( "bytes" "encoding/json" + "github.com/v2fly/v2ray-core/v4/infra/conf/v4" "io" core "github.com/v2fly/v2ray-core/v4" "github.com/v2fly/v2ray-core/v4/common/errors" - "github.com/v2fly/v2ray-core/v4/infra/conf" json_reader "github.com/v2fly/v2ray-core/v4/infra/conf/json" ) @@ -40,8 +40,8 @@ func findOffset(b []byte, o int) *offset { // DecodeJSONConfig reads from reader and decode the config into *conf.Config // syntax error could be detected. -func DecodeJSONConfig(reader io.Reader) (*conf.Config, error) { - jsonConfig := &conf.Config{} +func DecodeJSONConfig(reader io.Reader) (*v4.Config, error) { + jsonConfig := &v4.Config{} err := DecodeJSON(reader, jsonConfig) if err != nil { return nil, err diff --git a/infra/conf/api.go b/infra/conf/v4/api.go similarity index 99% rename from infra/conf/api.go rename to infra/conf/v4/api.go index 17ac223ac..605991c7a 100644 --- a/infra/conf/api.go +++ b/infra/conf/v4/api.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "strings" diff --git a/infra/conf/blackhole.go b/infra/conf/v4/blackhole.go similarity index 99% rename from infra/conf/blackhole.go rename to infra/conf/v4/blackhole.go index 019681d6a..24db6441a 100644 --- a/infra/conf/blackhole.go +++ b/infra/conf/v4/blackhole.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "encoding/json" diff --git a/infra/conf/blackhole_test.go b/infra/conf/v4/blackhole_test.go similarity index 87% rename from infra/conf/blackhole_test.go rename to infra/conf/v4/blackhole_test.go index ebc30743f..068098609 100644 --- a/infra/conf/blackhole_test.go +++ b/infra/conf/v4/blackhole_test.go @@ -1,18 +1,18 @@ -package conf_test +package v4_test 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" "testing" "github.com/v2fly/v2ray-core/v4/common/serial" - . "github.com/v2fly/v2ray-core/v4/infra/conf" "github.com/v2fly/v2ray-core/v4/proxy/blackhole" ) func TestHTTPResponseJSON(t *testing.T) { creator := func() cfgcommon.Buildable { - return new(BlackholeConfig) + return new(v4.BlackholeConfig) } testassist.RunMultiTestCase(t, []testassist.TestCase{ diff --git a/infra/conf/browser_forwarder.go b/infra/conf/v4/browser_forwarder.go similarity index 97% rename from infra/conf/browser_forwarder.go rename to infra/conf/v4/browser_forwarder.go index 5cb618a46..80190bc79 100644 --- a/infra/conf/browser_forwarder.go +++ b/infra/conf/v4/browser_forwarder.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "strings" diff --git a/infra/conf/conf.go b/infra/conf/v4/conf.go similarity index 85% rename from infra/conf/conf.go rename to infra/conf/v4/conf.go index acbaa5812..3182412d0 100644 --- a/infra/conf/conf.go +++ b/infra/conf/v4/conf.go @@ -1,3 +1,3 @@ -package conf +package v4 //go:generate go run github.com/v2fly/v2ray-core/v4/common/errors/errorgen diff --git a/infra/conf/dns_proxy.go b/infra/conf/v4/dns_proxy.go similarity index 97% rename from infra/conf/dns_proxy.go rename to infra/conf/v4/dns_proxy.go index 6378abaf7..74a01c67a 100644 --- a/infra/conf/dns_proxy.go +++ b/infra/conf/v4/dns_proxy.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "github.com/golang/protobuf/proto" diff --git a/infra/conf/dns_proxy_test.go b/infra/conf/v4/dns_proxy_test.go similarity index 87% rename from infra/conf/dns_proxy_test.go rename to infra/conf/v4/dns_proxy_test.go index fac488987..b8ce44993 100644 --- a/infra/conf/dns_proxy_test.go +++ b/infra/conf/v4/dns_proxy_test.go @@ -1,18 +1,18 @@ -package conf_test +package v4_test 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" "testing" "github.com/v2fly/v2ray-core/v4/common/net" - . "github.com/v2fly/v2ray-core/v4/infra/conf" "github.com/v2fly/v2ray-core/v4/proxy/dns" ) func TestDnsProxyConfig(t *testing.T) { creator := func() cfgcommon.Buildable { - return new(DNSOutboundConfig) + return new(v4.DNSOutboundConfig) } testassist.RunMultiTestCase(t, []testassist.TestCase{ diff --git a/infra/conf/dokodemo.go b/infra/conf/v4/dokodemo.go similarity index 98% rename from infra/conf/dokodemo.go rename to infra/conf/v4/dokodemo.go index c891821d7..ca68e3b01 100644 --- a/infra/conf/dokodemo.go +++ b/infra/conf/v4/dokodemo.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "github.com/golang/protobuf/proto" diff --git a/infra/conf/dokodemo_test.go b/infra/conf/v4/dokodemo_test.go similarity index 90% rename from infra/conf/dokodemo_test.go rename to infra/conf/v4/dokodemo_test.go index c56c85c0d..d79459eab 100644 --- a/infra/conf/dokodemo_test.go +++ b/infra/conf/v4/dokodemo_test.go @@ -1,18 +1,18 @@ -package conf_test +package v4_test 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" "testing" "github.com/v2fly/v2ray-core/v4/common/net" - . "github.com/v2fly/v2ray-core/v4/infra/conf" "github.com/v2fly/v2ray-core/v4/proxy/dokodemo" ) func TestDokodemoConfig(t *testing.T) { creator := func() cfgcommon.Buildable { - return new(DokodemoConfig) + return new(v4.DokodemoConfig) } testassist.RunMultiTestCase(t, []testassist.TestCase{ diff --git a/infra/conf/errors.generated.go b/infra/conf/v4/errors.generated.go similarity index 94% rename from infra/conf/errors.generated.go rename to infra/conf/v4/errors.generated.go index be860e0a7..84e5e761e 100644 --- a/infra/conf/errors.generated.go +++ b/infra/conf/v4/errors.generated.go @@ -1,4 +1,4 @@ -package conf +package v4 import "github.com/v2fly/v2ray-core/v4/common/errors" diff --git a/infra/conf/fakedns.go b/infra/conf/v4/fakedns.go similarity index 99% rename from infra/conf/fakedns.go rename to infra/conf/v4/fakedns.go index 91698c2cf..b86c593f3 100644 --- a/infra/conf/fakedns.go +++ b/infra/conf/v4/fakedns.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "encoding/json" diff --git a/infra/conf/freedom.go b/infra/conf/v4/freedom.go similarity index 99% rename from infra/conf/freedom.go rename to infra/conf/v4/freedom.go index 87f31857a..62dbe419d 100644 --- a/infra/conf/freedom.go +++ b/infra/conf/v4/freedom.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "net" diff --git a/infra/conf/freedom_test.go b/infra/conf/v4/freedom_test.go similarity index 91% rename from infra/conf/freedom_test.go rename to infra/conf/v4/freedom_test.go index b8d1e80d4..39177a723 100644 --- a/infra/conf/freedom_test.go +++ b/infra/conf/v4/freedom_test.go @@ -1,19 +1,19 @@ -package conf_test +package v4_test 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" "testing" "github.com/v2fly/v2ray-core/v4/common/net" "github.com/v2fly/v2ray-core/v4/common/protocol" - . "github.com/v2fly/v2ray-core/v4/infra/conf" "github.com/v2fly/v2ray-core/v4/proxy/freedom" ) func TestFreedomConfig(t *testing.T) { creator := func() cfgcommon.Buildable { - return new(FreedomConfig) + return new(v4.FreedomConfig) } testassist.RunMultiTestCase(t, []testassist.TestCase{ diff --git a/infra/conf/gun.go b/infra/conf/v4/gun.go similarity index 95% rename from infra/conf/gun.go rename to infra/conf/v4/gun.go index 7f806c860..4a2be9aca 100644 --- a/infra/conf/gun.go +++ b/infra/conf/v4/gun.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "github.com/golang/protobuf/proto" diff --git a/infra/conf/http.go b/infra/conf/v4/http.go similarity index 99% rename from infra/conf/http.go rename to infra/conf/v4/http.go index 27683b847..c8352e874 100644 --- a/infra/conf/http.go +++ b/infra/conf/v4/http.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "encoding/json" diff --git a/infra/conf/http_test.go b/infra/conf/v4/http_test.go similarity index 88% rename from infra/conf/http_test.go rename to infra/conf/v4/http_test.go index fc096bfa5..15f14a6cd 100644 --- a/infra/conf/http_test.go +++ b/infra/conf/v4/http_test.go @@ -1,17 +1,17 @@ -package conf_test +package v4_test 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" "testing" - . "github.com/v2fly/v2ray-core/v4/infra/conf" "github.com/v2fly/v2ray-core/v4/proxy/http" ) func TestHTTPServerConfig(t *testing.T) { creator := func() cfgcommon.Buildable { - return new(HTTPServerConfig) + return new(v4.HTTPServerConfig) } testassist.RunMultiTestCase(t, []testassist.TestCase{ diff --git a/infra/conf/init.go b/infra/conf/v4/init.go similarity index 88% rename from infra/conf/init.go rename to infra/conf/v4/init.go index 519d9fb25..01a3d9d4d 100644 --- a/infra/conf/init.go +++ b/infra/conf/v4/init.go @@ -1,4 +1,4 @@ -package conf +package v4 func init() { RegisterConfigureFilePostProcessingStage("FakeDNS", &FakeDNSPostProcessingStage{}) diff --git a/infra/conf/lint.go b/infra/conf/v4/lint.go similarity index 98% rename from infra/conf/lint.go rename to infra/conf/v4/lint.go index 93da35d40..55727bd72 100644 --- a/infra/conf/lint.go +++ b/infra/conf/v4/lint.go @@ -1,4 +1,4 @@ -package conf +package v4 type ConfigureFilePostProcessingStage interface { Process(conf *Config) error diff --git a/infra/conf/loopback.go b/infra/conf/v4/loopback.go similarity index 95% rename from infra/conf/loopback.go rename to infra/conf/v4/loopback.go index 23723ed45..57b55a495 100644 --- a/infra/conf/loopback.go +++ b/infra/conf/v4/loopback.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "github.com/golang/protobuf/proto" diff --git a/infra/conf/observatory.go b/infra/conf/v4/observatory.go similarity index 99% rename from infra/conf/observatory.go rename to infra/conf/v4/observatory.go index 4cbe3405a..280685bc0 100644 --- a/infra/conf/observatory.go +++ b/infra/conf/v4/observatory.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "encoding/json" diff --git a/infra/conf/policy.go b/infra/conf/v4/policy.go similarity index 99% rename from infra/conf/policy.go rename to infra/conf/v4/policy.go index c5b2aea88..3419d4ddf 100644 --- a/infra/conf/policy.go +++ b/infra/conf/v4/policy.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "github.com/v2fly/v2ray-core/v4/app/policy" diff --git a/infra/conf/policy_test.go b/infra/conf/v4/policy_test.go similarity index 85% rename from infra/conf/policy_test.go rename to infra/conf/v4/policy_test.go index a7408623c..b711b2ce3 100644 --- a/infra/conf/policy_test.go +++ b/infra/conf/v4/policy_test.go @@ -1,10 +1,10 @@ -package conf_test +package v4_test import ( + "github.com/v2fly/v2ray-core/v4/infra/conf/v4" "testing" "github.com/v2fly/v2ray-core/v4/common" - . "github.com/v2fly/v2ray-core/v4/infra/conf" ) func TestBufferSize(t *testing.T) { @@ -28,7 +28,7 @@ func TestBufferSize(t *testing.T) { for _, c := range cases { bs := c.Input - pConf := Policy{ + pConf := v4.Policy{ BufferSize: &bs, } p, err := pConf.Build() diff --git a/infra/conf/reverse.go b/infra/conf/v4/reverse.go similarity index 98% rename from infra/conf/reverse.go rename to infra/conf/v4/reverse.go index 7a1d732c1..997a53a27 100644 --- a/infra/conf/reverse.go +++ b/infra/conf/v4/reverse.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "github.com/golang/protobuf/proto" diff --git a/infra/conf/reverse_test.go b/infra/conf/v4/reverse_test.go similarity index 90% rename from infra/conf/reverse_test.go rename to infra/conf/v4/reverse_test.go index 57271beb6..2da40daea 100644 --- a/infra/conf/reverse_test.go +++ b/infra/conf/v4/reverse_test.go @@ -1,17 +1,17 @@ -package conf_test +package v4_test 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" "testing" "github.com/v2fly/v2ray-core/v4/app/reverse" - "github.com/v2fly/v2ray-core/v4/infra/conf" ) func TestReverseConfig(t *testing.T) { creator := func() cfgcommon.Buildable { - return new(conf.ReverseConfig) + return new(v4.ReverseConfig) } testassist.RunMultiTestCase(t, []testassist.TestCase{ diff --git a/infra/conf/services.go b/infra/conf/v4/services.go similarity index 98% rename from infra/conf/services.go rename to infra/conf/v4/services.go index 5c0451eeb..a81d9d040 100644 --- a/infra/conf/services.go +++ b/infra/conf/v4/services.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "encoding/json" diff --git a/infra/conf/shadowsocks.go b/infra/conf/v4/shadowsocks.go similarity index 99% rename from infra/conf/shadowsocks.go rename to infra/conf/v4/shadowsocks.go index 677237e99..45d83dc1e 100644 --- a/infra/conf/shadowsocks.go +++ b/infra/conf/v4/shadowsocks.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "strings" diff --git a/infra/conf/shadowsocks_test.go b/infra/conf/v4/shadowsocks_test.go similarity index 89% rename from infra/conf/shadowsocks_test.go rename to infra/conf/v4/shadowsocks_test.go index dc057fe82..b8c7566b5 100644 --- a/infra/conf/shadowsocks_test.go +++ b/infra/conf/v4/shadowsocks_test.go @@ -1,20 +1,20 @@ -package conf_test +package v4_test 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" "testing" "github.com/v2fly/v2ray-core/v4/common/net" "github.com/v2fly/v2ray-core/v4/common/protocol" "github.com/v2fly/v2ray-core/v4/common/serial" - . "github.com/v2fly/v2ray-core/v4/infra/conf" "github.com/v2fly/v2ray-core/v4/proxy/shadowsocks" ) func TestShadowsocksServerConfigParsing(t *testing.T) { creator := func() cfgcommon.Buildable { - return new(ShadowsocksServerConfig) + return new(v4.ShadowsocksServerConfig) } testassist.RunMultiTestCase(t, []testassist.TestCase{ diff --git a/infra/conf/socks.go b/infra/conf/v4/socks.go similarity index 99% rename from infra/conf/socks.go rename to infra/conf/v4/socks.go index 5c3e3e5c6..1998414db 100644 --- a/infra/conf/socks.go +++ b/infra/conf/v4/socks.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "encoding/json" diff --git a/infra/conf/socks_test.go b/infra/conf/v4/socks_test.go similarity index 93% rename from infra/conf/socks_test.go rename to infra/conf/v4/socks_test.go index 122b06c9f..6e4d0d2f4 100644 --- a/infra/conf/socks_test.go +++ b/infra/conf/v4/socks_test.go @@ -1,20 +1,20 @@ -package conf_test +package v4_test 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" "testing" "github.com/v2fly/v2ray-core/v4/common/net" "github.com/v2fly/v2ray-core/v4/common/protocol" "github.com/v2fly/v2ray-core/v4/common/serial" - . "github.com/v2fly/v2ray-core/v4/infra/conf" "github.com/v2fly/v2ray-core/v4/proxy/socks" ) func TestSocksInboundConfig(t *testing.T) { creator := func() cfgcommon.Buildable { - return new(SocksServerConfig) + return new(v4.SocksServerConfig) } testassist.RunMultiTestCase(t, []testassist.TestCase{ @@ -53,7 +53,7 @@ func TestSocksInboundConfig(t *testing.T) { func TestSocksOutboundConfig(t *testing.T) { creator := func() cfgcommon.Buildable { - return new(SocksClientConfig) + return new(v4.SocksClientConfig) } testassist.RunMultiTestCase(t, []testassist.TestCase{ diff --git a/infra/conf/transport.go b/infra/conf/v4/transport.go similarity index 99% rename from infra/conf/transport.go rename to infra/conf/v4/transport.go index ffff9a5c2..1e58c20d3 100644 --- a/infra/conf/transport.go +++ b/infra/conf/v4/transport.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "github.com/v2fly/v2ray-core/v4/common/serial" diff --git a/infra/conf/transport_authenticators.go b/infra/conf/v4/transport_authenticators.go similarity index 99% rename from infra/conf/transport_authenticators.go rename to infra/conf/v4/transport_authenticators.go index 6134765cb..ba4fcddc9 100644 --- a/infra/conf/transport_authenticators.go +++ b/infra/conf/v4/transport_authenticators.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "sort" diff --git a/infra/conf/transport_internet.go b/infra/conf/v4/transport_internet.go similarity index 99% rename from infra/conf/transport_internet.go rename to infra/conf/v4/transport_internet.go index 13f1892a1..8439a309b 100644 --- a/infra/conf/transport_internet.go +++ b/infra/conf/v4/transport_internet.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "encoding/base64" diff --git a/infra/conf/transport_test.go b/infra/conf/v4/transport_test.go similarity index 96% rename from infra/conf/transport_test.go rename to infra/conf/v4/transport_test.go index 52fed7993..dc6667ee6 100644 --- a/infra/conf/transport_test.go +++ b/infra/conf/v4/transport_test.go @@ -1,15 +1,15 @@ -package conf_test +package v4_test import ( "encoding/json" "github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist" + "github.com/v2fly/v2ray-core/v4/infra/conf/v4" "testing" "github.com/golang/protobuf/proto" "github.com/v2fly/v2ray-core/v4/common/protocol" "github.com/v2fly/v2ray-core/v4/common/serial" - . "github.com/v2fly/v2ray-core/v4/infra/conf" "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" @@ -24,7 +24,7 @@ import ( func TestSocketConfig(t *testing.T) { createParser := func() func(string) (proto.Message, error) { return func(s string) (proto.Message, error) { - config := new(SocketConfig) + config := new(v4.SocketConfig) if err := json.Unmarshal([]byte(s), config); err != nil { return nil, err } @@ -50,7 +50,7 @@ func TestSocketConfig(t *testing.T) { func TestTransportConfig(t *testing.T) { createParser := func() func(string) (proto.Message, error) { return func(s string) (proto.Message, error) { - config := new(TransportConfig) + config := new(v4.TransportConfig) if err := json.Unmarshal([]byte(s), config); err != nil { return nil, err } diff --git a/infra/conf/trojan.go b/infra/conf/v4/trojan.go similarity index 99% rename from infra/conf/trojan.go rename to infra/conf/v4/trojan.go index 5ecf11d2c..99e92d98c 100644 --- a/infra/conf/trojan.go +++ b/infra/conf/v4/trojan.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "encoding/json" diff --git a/infra/conf/v2ray.go b/infra/conf/v4/v2ray.go similarity index 99% rename from infra/conf/v2ray.go rename to infra/conf/v4/v2ray.go index 80569c0db..e0ffa1854 100644 --- a/infra/conf/v2ray.go +++ b/infra/conf/v4/v2ray.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "encoding/json" diff --git a/infra/conf/v2ray_test.go b/infra/conf/v4/v2ray_test.go similarity index 98% rename from infra/conf/v2ray_test.go rename to infra/conf/v4/v2ray_test.go index f6bd90217..ecef0e16b 100644 --- a/infra/conf/v2ray_test.go +++ b/infra/conf/v4/v2ray_test.go @@ -1,8 +1,9 @@ -package conf_test +package v4_test import ( "encoding/json" "github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist" + "github.com/v2fly/v2ray-core/v4/infra/conf/v4" "reflect" "testing" @@ -18,7 +19,6 @@ import ( "github.com/v2fly/v2ray-core/v4/common/net" "github.com/v2fly/v2ray-core/v4/common/protocol" "github.com/v2fly/v2ray-core/v4/common/serial" - . "github.com/v2fly/v2ray-core/v4/infra/conf" "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" @@ -33,7 +33,7 @@ import ( func TestV2RayConfig(t *testing.T) { createParser := func() func(string) (proto.Message, error) { return func(s string) (proto.Message, error) { - config := new(Config) + config := new(v4.Config) if err := json.Unmarshal([]byte(s), config); err != nil { return nil, err } @@ -363,7 +363,7 @@ func TestMuxConfig_Build(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - m := &MuxConfig{} + m := &v4.MuxConfig{} common.Must(json.Unmarshal([]byte(tt.fields), m)) if got := m.Build(); !reflect.DeepEqual(got, tt.want) { t.Errorf("MuxConfig.Build() = %v, want %v", got, tt.want) diff --git a/infra/conf/vless.go b/infra/conf/v4/vless.go similarity index 99% rename from infra/conf/vless.go rename to infra/conf/v4/vless.go index 9967c8e1b..453c75ef6 100644 --- a/infra/conf/vless.go +++ b/infra/conf/v4/vless.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "encoding/json" diff --git a/infra/conf/vless_test.go b/infra/conf/v4/vless_test.go similarity index 95% rename from infra/conf/vless_test.go rename to infra/conf/v4/vless_test.go index 17eef0a49..dc14648ef 100644 --- a/infra/conf/vless_test.go +++ b/infra/conf/v4/vless_test.go @@ -1,14 +1,14 @@ -package conf_test +package v4_test 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" "testing" "github.com/v2fly/v2ray-core/v4/common/net" "github.com/v2fly/v2ray-core/v4/common/protocol" "github.com/v2fly/v2ray-core/v4/common/serial" - . "github.com/v2fly/v2ray-core/v4/infra/conf" "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" @@ -16,7 +16,7 @@ import ( func TestVLessOutbound(t *testing.T) { creator := func() cfgcommon.Buildable { - return new(VLessOutboundConfig) + return new(v4.VLessOutboundConfig) } testassist.RunMultiTestCase(t, []testassist.TestCase{ @@ -62,7 +62,7 @@ func TestVLessOutbound(t *testing.T) { func TestVLessInbound(t *testing.T) { creator := func() cfgcommon.Buildable { - return new(VLessInboundConfig) + return new(v4.VLessInboundConfig) } testassist.RunMultiTestCase(t, []testassist.TestCase{ diff --git a/infra/conf/vmess.go b/infra/conf/v4/vmess.go similarity index 99% rename from infra/conf/vmess.go rename to infra/conf/v4/vmess.go index c08cbef73..11b7181b5 100644 --- a/infra/conf/vmess.go +++ b/infra/conf/v4/vmess.go @@ -1,4 +1,4 @@ -package conf +package v4 import ( "encoding/json" diff --git a/infra/conf/vmess_test.go b/infra/conf/v4/vmess_test.go similarity index 94% rename from infra/conf/vmess_test.go rename to infra/conf/v4/vmess_test.go index 07af0e9fb..2a030845d 100644 --- a/infra/conf/vmess_test.go +++ b/infra/conf/v4/vmess_test.go @@ -1,14 +1,14 @@ -package conf_test +package v4_test 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" "testing" "github.com/v2fly/v2ray-core/v4/common/net" "github.com/v2fly/v2ray-core/v4/common/protocol" "github.com/v2fly/v2ray-core/v4/common/serial" - . "github.com/v2fly/v2ray-core/v4/infra/conf" "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" @@ -16,7 +16,7 @@ import ( func TestVMessOutbound(t *testing.T) { creator := func() cfgcommon.Buildable { - return new(VMessOutboundConfig) + return new(v4.VMessOutboundConfig) } testassist.RunMultiTestCase(t, []testassist.TestCase{ @@ -66,7 +66,7 @@ func TestVMessOutbound(t *testing.T) { func TestVMessInbound(t *testing.T) { creator := func() cfgcommon.Buildable { - return new(VMessInboundConfig) + return new(v4.VMessInboundConfig) } testassist.RunMultiTestCase(t, []testassist.TestCase{ diff --git a/main/commands/helpers/config_load.go b/main/commands/helpers/config_load.go index 691a2d4bd..131eed550 100644 --- a/main/commands/helpers/config_load.go +++ b/main/commands/helpers/config_load.go @@ -2,9 +2,9 @@ package helpers import ( "bytes" + "github.com/v2fly/v2ray-core/v4/infra/conf/v4" "os" - "github.com/v2fly/v2ray-core/v4/infra/conf" "github.com/v2fly/v2ray-core/v4/infra/conf/merge" "github.com/v2fly/v2ray-core/v4/infra/conf/mergers" "github.com/v2fly/v2ray-core/v4/infra/conf/serial" @@ -13,7 +13,7 @@ import ( // LoadConfig load config files to *conf.Config, it will: // - resolve folder to files // - try to read stdin if no file specified -func LoadConfig(files []string, format string, recursively bool) (*conf.Config, error) { +func LoadConfig(files []string, format string, recursively bool) (*v4.Config, error) { m, err := LoadConfigToMap(files, format, recursively) if err != nil { return nil, err