Browse Source

move v4 configure support to own directory

Shelikhoo 4 years ago
parent
commit
add375390e
42 changed files with 76 additions and 76 deletions
  1. 3 3
      infra/conf/serial/loader.go
  2. 1 1
      infra/conf/v4/api.go
  3. 1 1
      infra/conf/v4/blackhole.go
  4. 3 3
      infra/conf/v4/blackhole_test.go
  5. 1 1
      infra/conf/v4/browser_forwarder.go
  6. 1 1
      infra/conf/v4/conf.go
  7. 1 1
      infra/conf/v4/dns_proxy.go
  8. 3 3
      infra/conf/v4/dns_proxy_test.go
  9. 1 1
      infra/conf/v4/dokodemo.go
  10. 3 3
      infra/conf/v4/dokodemo_test.go
  11. 1 1
      infra/conf/v4/errors.generated.go
  12. 1 1
      infra/conf/v4/fakedns.go
  13. 1 1
      infra/conf/v4/freedom.go
  14. 3 3
      infra/conf/v4/freedom_test.go
  15. 1 1
      infra/conf/v4/gun.go
  16. 1 1
      infra/conf/v4/http.go
  17. 3 3
      infra/conf/v4/http_test.go
  18. 1 1
      infra/conf/v4/init.go
  19. 1 1
      infra/conf/v4/lint.go
  20. 1 1
      infra/conf/v4/loopback.go
  21. 1 1
      infra/conf/v4/observatory.go
  22. 1 1
      infra/conf/v4/policy.go
  23. 3 3
      infra/conf/v4/policy_test.go
  24. 1 1
      infra/conf/v4/reverse.go
  25. 3 3
      infra/conf/v4/reverse_test.go
  26. 1 1
      infra/conf/v4/services.go
  27. 1 1
      infra/conf/v4/shadowsocks.go
  28. 3 3
      infra/conf/v4/shadowsocks_test.go
  29. 1 1
      infra/conf/v4/socks.go
  30. 4 4
      infra/conf/v4/socks_test.go
  31. 1 1
      infra/conf/v4/transport.go
  32. 1 1
      infra/conf/v4/transport_authenticators.go
  33. 1 1
      infra/conf/v4/transport_internet.go
  34. 4 4
      infra/conf/v4/transport_test.go
  35. 1 1
      infra/conf/v4/trojan.go
  36. 1 1
      infra/conf/v4/v2ray.go
  37. 4 4
      infra/conf/v4/v2ray_test.go
  38. 1 1
      infra/conf/v4/vless.go
  39. 4 4
      infra/conf/v4/vless_test.go
  40. 1 1
      infra/conf/v4/vmess.go
  41. 4 4
      infra/conf/v4/vmess_test.go
  42. 2 2
      main/commands/helpers/config_load.go

+ 3 - 3
infra/conf/serial/loader.go

@@ -3,11 +3,11 @@ package serial
 import (
 import (
 	"bytes"
 	"bytes"
 	"encoding/json"
 	"encoding/json"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"io"
 	"io"
 
 
 	core "github.com/v2fly/v2ray-core/v4"
 	core "github.com/v2fly/v2ray-core/v4"
 	"github.com/v2fly/v2ray-core/v4/common/errors"
 	"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"
 	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
 // DecodeJSONConfig reads from reader and decode the config into *conf.Config
 // syntax error could be detected.
 // 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)
 	err := DecodeJSON(reader, jsonConfig)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err

+ 1 - 1
infra/conf/api.go → infra/conf/v4/api.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"strings"
 	"strings"

+ 1 - 1
infra/conf/blackhole.go → infra/conf/v4/blackhole.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"

+ 3 - 3
infra/conf/blackhole_test.go → infra/conf/v4/blackhole_test.go

@@ -1,18 +1,18 @@
-package conf_test
+package v4_test
 
 
 import (
 import (
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
 	"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/cfgcommon/testassist"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"testing"
 	"testing"
 
 
 	"github.com/v2fly/v2ray-core/v4/common/serial"
 	"github.com/v2fly/v2ray-core/v4/common/serial"
-	. "github.com/v2fly/v2ray-core/v4/infra/conf"
 	"github.com/v2fly/v2ray-core/v4/proxy/blackhole"
 	"github.com/v2fly/v2ray-core/v4/proxy/blackhole"
 )
 )
 
 
 func TestHTTPResponseJSON(t *testing.T) {
 func TestHTTPResponseJSON(t *testing.T) {
 	creator := func() cfgcommon.Buildable {
 	creator := func() cfgcommon.Buildable {
-		return new(BlackholeConfig)
+		return new(v4.BlackholeConfig)
 	}
 	}
 
 
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
 	testassist.RunMultiTestCase(t, []testassist.TestCase{

+ 1 - 1
infra/conf/browser_forwarder.go → infra/conf/v4/browser_forwarder.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"strings"
 	"strings"

+ 1 - 1
infra/conf/conf.go → 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
 //go:generate go run github.com/v2fly/v2ray-core/v4/common/errors/errorgen

+ 1 - 1
infra/conf/dns_proxy.go → infra/conf/v4/dns_proxy.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"github.com/golang/protobuf/proto"
 	"github.com/golang/protobuf/proto"

+ 3 - 3
infra/conf/dns_proxy_test.go → infra/conf/v4/dns_proxy_test.go

@@ -1,18 +1,18 @@
-package conf_test
+package v4_test
 
 
 import (
 import (
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
 	"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/cfgcommon/testassist"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"testing"
 	"testing"
 
 
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/net"
-	. "github.com/v2fly/v2ray-core/v4/infra/conf"
 	"github.com/v2fly/v2ray-core/v4/proxy/dns"
 	"github.com/v2fly/v2ray-core/v4/proxy/dns"
 )
 )
 
 
 func TestDnsProxyConfig(t *testing.T) {
 func TestDnsProxyConfig(t *testing.T) {
 	creator := func() cfgcommon.Buildable {
 	creator := func() cfgcommon.Buildable {
-		return new(DNSOutboundConfig)
+		return new(v4.DNSOutboundConfig)
 	}
 	}
 
 
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
 	testassist.RunMultiTestCase(t, []testassist.TestCase{

+ 1 - 1
infra/conf/dokodemo.go → infra/conf/v4/dokodemo.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"github.com/golang/protobuf/proto"
 	"github.com/golang/protobuf/proto"

+ 3 - 3
infra/conf/dokodemo_test.go → infra/conf/v4/dokodemo_test.go

@@ -1,18 +1,18 @@
-package conf_test
+package v4_test
 
 
 import (
 import (
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
 	"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/cfgcommon/testassist"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"testing"
 	"testing"
 
 
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/net"
-	. "github.com/v2fly/v2ray-core/v4/infra/conf"
 	"github.com/v2fly/v2ray-core/v4/proxy/dokodemo"
 	"github.com/v2fly/v2ray-core/v4/proxy/dokodemo"
 )
 )
 
 
 func TestDokodemoConfig(t *testing.T) {
 func TestDokodemoConfig(t *testing.T) {
 	creator := func() cfgcommon.Buildable {
 	creator := func() cfgcommon.Buildable {
-		return new(DokodemoConfig)
+		return new(v4.DokodemoConfig)
 	}
 	}
 
 
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
 	testassist.RunMultiTestCase(t, []testassist.TestCase{

+ 1 - 1
infra/conf/errors.generated.go → infra/conf/v4/errors.generated.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import "github.com/v2fly/v2ray-core/v4/common/errors"
 import "github.com/v2fly/v2ray-core/v4/common/errors"
 
 

+ 1 - 1
infra/conf/fakedns.go → infra/conf/v4/fakedns.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"

+ 1 - 1
infra/conf/freedom.go → infra/conf/v4/freedom.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"net"
 	"net"

+ 3 - 3
infra/conf/freedom_test.go → infra/conf/v4/freedom_test.go

@@ -1,19 +1,19 @@
-package conf_test
+package v4_test
 
 
 import (
 import (
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
 	"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/cfgcommon/testassist"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"testing"
 	"testing"
 
 
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
-	. "github.com/v2fly/v2ray-core/v4/infra/conf"
 	"github.com/v2fly/v2ray-core/v4/proxy/freedom"
 	"github.com/v2fly/v2ray-core/v4/proxy/freedom"
 )
 )
 
 
 func TestFreedomConfig(t *testing.T) {
 func TestFreedomConfig(t *testing.T) {
 	creator := func() cfgcommon.Buildable {
 	creator := func() cfgcommon.Buildable {
-		return new(FreedomConfig)
+		return new(v4.FreedomConfig)
 	}
 	}
 
 
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
 	testassist.RunMultiTestCase(t, []testassist.TestCase{

+ 1 - 1
infra/conf/gun.go → infra/conf/v4/gun.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"github.com/golang/protobuf/proto"
 	"github.com/golang/protobuf/proto"

+ 1 - 1
infra/conf/http.go → infra/conf/v4/http.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"

+ 3 - 3
infra/conf/http_test.go → infra/conf/v4/http_test.go

@@ -1,17 +1,17 @@
-package conf_test
+package v4_test
 
 
 import (
 import (
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
 	"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/cfgcommon/testassist"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"testing"
 	"testing"
 
 
-	. "github.com/v2fly/v2ray-core/v4/infra/conf"
 	"github.com/v2fly/v2ray-core/v4/proxy/http"
 	"github.com/v2fly/v2ray-core/v4/proxy/http"
 )
 )
 
 
 func TestHTTPServerConfig(t *testing.T) {
 func TestHTTPServerConfig(t *testing.T) {
 	creator := func() cfgcommon.Buildable {
 	creator := func() cfgcommon.Buildable {
-		return new(HTTPServerConfig)
+		return new(v4.HTTPServerConfig)
 	}
 	}
 
 
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
 	testassist.RunMultiTestCase(t, []testassist.TestCase{

+ 1 - 1
infra/conf/init.go → infra/conf/v4/init.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 func init() {
 func init() {
 	RegisterConfigureFilePostProcessingStage("FakeDNS", &FakeDNSPostProcessingStage{})
 	RegisterConfigureFilePostProcessingStage("FakeDNS", &FakeDNSPostProcessingStage{})

+ 1 - 1
infra/conf/lint.go → infra/conf/v4/lint.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 type ConfigureFilePostProcessingStage interface {
 type ConfigureFilePostProcessingStage interface {
 	Process(conf *Config) error
 	Process(conf *Config) error

+ 1 - 1
infra/conf/loopback.go → infra/conf/v4/loopback.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"github.com/golang/protobuf/proto"
 	"github.com/golang/protobuf/proto"

+ 1 - 1
infra/conf/observatory.go → infra/conf/v4/observatory.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"

+ 1 - 1
infra/conf/policy.go → infra/conf/v4/policy.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"github.com/v2fly/v2ray-core/v4/app/policy"
 	"github.com/v2fly/v2ray-core/v4/app/policy"

+ 3 - 3
infra/conf/policy_test.go → infra/conf/v4/policy_test.go

@@ -1,10 +1,10 @@
-package conf_test
+package v4_test
 
 
 import (
 import (
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"testing"
 	"testing"
 
 
 	"github.com/v2fly/v2ray-core/v4/common"
 	"github.com/v2fly/v2ray-core/v4/common"
-	. "github.com/v2fly/v2ray-core/v4/infra/conf"
 )
 )
 
 
 func TestBufferSize(t *testing.T) {
 func TestBufferSize(t *testing.T) {
@@ -28,7 +28,7 @@ func TestBufferSize(t *testing.T) {
 
 
 	for _, c := range cases {
 	for _, c := range cases {
 		bs := c.Input
 		bs := c.Input
-		pConf := Policy{
+		pConf := v4.Policy{
 			BufferSize: &bs,
 			BufferSize: &bs,
 		}
 		}
 		p, err := pConf.Build()
 		p, err := pConf.Build()

+ 1 - 1
infra/conf/reverse.go → infra/conf/v4/reverse.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"github.com/golang/protobuf/proto"
 	"github.com/golang/protobuf/proto"

+ 3 - 3
infra/conf/reverse_test.go → infra/conf/v4/reverse_test.go

@@ -1,17 +1,17 @@
-package conf_test
+package v4_test
 
 
 import (
 import (
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
 	"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/cfgcommon/testassist"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"testing"
 	"testing"
 
 
 	"github.com/v2fly/v2ray-core/v4/app/reverse"
 	"github.com/v2fly/v2ray-core/v4/app/reverse"
-	"github.com/v2fly/v2ray-core/v4/infra/conf"
 )
 )
 
 
 func TestReverseConfig(t *testing.T) {
 func TestReverseConfig(t *testing.T) {
 	creator := func() cfgcommon.Buildable {
 	creator := func() cfgcommon.Buildable {
-		return new(conf.ReverseConfig)
+		return new(v4.ReverseConfig)
 	}
 	}
 
 
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
 	testassist.RunMultiTestCase(t, []testassist.TestCase{

+ 1 - 1
infra/conf/services.go → infra/conf/v4/services.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"

+ 1 - 1
infra/conf/shadowsocks.go → infra/conf/v4/shadowsocks.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"strings"
 	"strings"

+ 3 - 3
infra/conf/shadowsocks_test.go → infra/conf/v4/shadowsocks_test.go

@@ -1,20 +1,20 @@
-package conf_test
+package v4_test
 
 
 import (
 import (
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
 	"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/cfgcommon/testassist"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"testing"
 	"testing"
 
 
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
 	"github.com/v2fly/v2ray-core/v4/common/serial"
 	"github.com/v2fly/v2ray-core/v4/common/serial"
-	. "github.com/v2fly/v2ray-core/v4/infra/conf"
 	"github.com/v2fly/v2ray-core/v4/proxy/shadowsocks"
 	"github.com/v2fly/v2ray-core/v4/proxy/shadowsocks"
 )
 )
 
 
 func TestShadowsocksServerConfigParsing(t *testing.T) {
 func TestShadowsocksServerConfigParsing(t *testing.T) {
 	creator := func() cfgcommon.Buildable {
 	creator := func() cfgcommon.Buildable {
-		return new(ShadowsocksServerConfig)
+		return new(v4.ShadowsocksServerConfig)
 	}
 	}
 
 
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
 	testassist.RunMultiTestCase(t, []testassist.TestCase{

+ 1 - 1
infra/conf/socks.go → infra/conf/v4/socks.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"

+ 4 - 4
infra/conf/socks_test.go → infra/conf/v4/socks_test.go

@@ -1,20 +1,20 @@
-package conf_test
+package v4_test
 
 
 import (
 import (
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
 	"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/cfgcommon/testassist"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"testing"
 	"testing"
 
 
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
 	"github.com/v2fly/v2ray-core/v4/common/serial"
 	"github.com/v2fly/v2ray-core/v4/common/serial"
-	. "github.com/v2fly/v2ray-core/v4/infra/conf"
 	"github.com/v2fly/v2ray-core/v4/proxy/socks"
 	"github.com/v2fly/v2ray-core/v4/proxy/socks"
 )
 )
 
 
 func TestSocksInboundConfig(t *testing.T) {
 func TestSocksInboundConfig(t *testing.T) {
 	creator := func() cfgcommon.Buildable {
 	creator := func() cfgcommon.Buildable {
-		return new(SocksServerConfig)
+		return new(v4.SocksServerConfig)
 	}
 	}
 
 
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
@@ -53,7 +53,7 @@ func TestSocksInboundConfig(t *testing.T) {
 
 
 func TestSocksOutboundConfig(t *testing.T) {
 func TestSocksOutboundConfig(t *testing.T) {
 	creator := func() cfgcommon.Buildable {
 	creator := func() cfgcommon.Buildable {
-		return new(SocksClientConfig)
+		return new(v4.SocksClientConfig)
 	}
 	}
 
 
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
 	testassist.RunMultiTestCase(t, []testassist.TestCase{

+ 1 - 1
infra/conf/transport.go → infra/conf/v4/transport.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"github.com/v2fly/v2ray-core/v4/common/serial"
 	"github.com/v2fly/v2ray-core/v4/common/serial"

+ 1 - 1
infra/conf/transport_authenticators.go → infra/conf/v4/transport_authenticators.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"sort"
 	"sort"

+ 1 - 1
infra/conf/transport_internet.go → infra/conf/v4/transport_internet.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"encoding/base64"
 	"encoding/base64"

+ 4 - 4
infra/conf/transport_test.go → infra/conf/v4/transport_test.go

@@ -1,15 +1,15 @@
-package conf_test
+package v4_test
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"testing"
 	"testing"
 
 
 	"github.com/golang/protobuf/proto"
 	"github.com/golang/protobuf/proto"
 
 
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
 	"github.com/v2fly/v2ray-core/v4/common/serial"
 	"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"
 	"github.com/v2fly/v2ray-core/v4/transport/internet"
 	"github.com/v2fly/v2ray-core/v4/transport/internet"
 	"github.com/v2fly/v2ray-core/v4/transport/internet/headers/http"
 	"github.com/v2fly/v2ray-core/v4/transport/internet/headers/http"
@@ -24,7 +24,7 @@ import (
 func TestSocketConfig(t *testing.T) {
 func TestSocketConfig(t *testing.T) {
 	createParser := func() func(string) (proto.Message, error) {
 	createParser := func() func(string) (proto.Message, error) {
 		return func(s 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 {
 			if err := json.Unmarshal([]byte(s), config); err != nil {
 				return nil, err
 				return nil, err
 			}
 			}
@@ -50,7 +50,7 @@ func TestSocketConfig(t *testing.T) {
 func TestTransportConfig(t *testing.T) {
 func TestTransportConfig(t *testing.T) {
 	createParser := func() func(string) (proto.Message, error) {
 	createParser := func() func(string) (proto.Message, error) {
 		return func(s 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 {
 			if err := json.Unmarshal([]byte(s), config); err != nil {
 				return nil, err
 				return nil, err
 			}
 			}

+ 1 - 1
infra/conf/trojan.go → infra/conf/v4/trojan.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"

+ 1 - 1
infra/conf/v2ray.go → infra/conf/v4/v2ray.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"

+ 4 - 4
infra/conf/v2ray_test.go → infra/conf/v4/v2ray_test.go

@@ -1,8 +1,9 @@
-package conf_test
+package v4_test
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"reflect"
 	"reflect"
 	"testing"
 	"testing"
 
 
@@ -18,7 +19,6 @@ import (
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
 	"github.com/v2fly/v2ray-core/v4/common/serial"
 	"github.com/v2fly/v2ray-core/v4/common/serial"
-	. "github.com/v2fly/v2ray-core/v4/infra/conf"
 	"github.com/v2fly/v2ray-core/v4/proxy/blackhole"
 	"github.com/v2fly/v2ray-core/v4/proxy/blackhole"
 	dns_proxy "github.com/v2fly/v2ray-core/v4/proxy/dns"
 	dns_proxy "github.com/v2fly/v2ray-core/v4/proxy/dns"
 	"github.com/v2fly/v2ray-core/v4/proxy/freedom"
 	"github.com/v2fly/v2ray-core/v4/proxy/freedom"
@@ -33,7 +33,7 @@ import (
 func TestV2RayConfig(t *testing.T) {
 func TestV2RayConfig(t *testing.T) {
 	createParser := func() func(string) (proto.Message, error) {
 	createParser := func() func(string) (proto.Message, error) {
 		return func(s 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 {
 			if err := json.Unmarshal([]byte(s), config); err != nil {
 				return nil, err
 				return nil, err
 			}
 			}
@@ -363,7 +363,7 @@ func TestMuxConfig_Build(t *testing.T) {
 	}
 	}
 	for _, tt := range tests {
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
 		t.Run(tt.name, func(t *testing.T) {
-			m := &MuxConfig{}
+			m := &v4.MuxConfig{}
 			common.Must(json.Unmarshal([]byte(tt.fields), m))
 			common.Must(json.Unmarshal([]byte(tt.fields), m))
 			if got := m.Build(); !reflect.DeepEqual(got, tt.want) {
 			if got := m.Build(); !reflect.DeepEqual(got, tt.want) {
 				t.Errorf("MuxConfig.Build() = %v, want %v", got, tt.want)
 				t.Errorf("MuxConfig.Build() = %v, want %v", got, tt.want)

+ 1 - 1
infra/conf/vless.go → infra/conf/v4/vless.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"

+ 4 - 4
infra/conf/vless_test.go → infra/conf/v4/vless_test.go

@@ -1,14 +1,14 @@
-package conf_test
+package v4_test
 
 
 import (
 import (
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
 	"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/cfgcommon/testassist"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"testing"
 	"testing"
 
 
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
 	"github.com/v2fly/v2ray-core/v4/common/serial"
 	"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"
 	"github.com/v2fly/v2ray-core/v4/proxy/vless/inbound"
 	"github.com/v2fly/v2ray-core/v4/proxy/vless/inbound"
 	"github.com/v2fly/v2ray-core/v4/proxy/vless/outbound"
 	"github.com/v2fly/v2ray-core/v4/proxy/vless/outbound"
@@ -16,7 +16,7 @@ import (
 
 
 func TestVLessOutbound(t *testing.T) {
 func TestVLessOutbound(t *testing.T) {
 	creator := func() cfgcommon.Buildable {
 	creator := func() cfgcommon.Buildable {
-		return new(VLessOutboundConfig)
+		return new(v4.VLessOutboundConfig)
 	}
 	}
 
 
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
@@ -62,7 +62,7 @@ func TestVLessOutbound(t *testing.T) {
 
 
 func TestVLessInbound(t *testing.T) {
 func TestVLessInbound(t *testing.T) {
 	creator := func() cfgcommon.Buildable {
 	creator := func() cfgcommon.Buildable {
-		return new(VLessInboundConfig)
+		return new(v4.VLessInboundConfig)
 	}
 	}
 
 
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
 	testassist.RunMultiTestCase(t, []testassist.TestCase{

+ 1 - 1
infra/conf/vmess.go → infra/conf/v4/vmess.go

@@ -1,4 +1,4 @@
-package conf
+package v4
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"

+ 4 - 4
infra/conf/vmess_test.go → infra/conf/v4/vmess_test.go

@@ -1,14 +1,14 @@
-package conf_test
+package v4_test
 
 
 import (
 import (
 	"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
 	"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/cfgcommon/testassist"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"testing"
 	"testing"
 
 
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/net"
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
 	"github.com/v2fly/v2ray-core/v4/common/protocol"
 	"github.com/v2fly/v2ray-core/v4/common/serial"
 	"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"
 	"github.com/v2fly/v2ray-core/v4/proxy/vmess/inbound"
 	"github.com/v2fly/v2ray-core/v4/proxy/vmess/inbound"
 	"github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound"
 	"github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound"
@@ -16,7 +16,7 @@ import (
 
 
 func TestVMessOutbound(t *testing.T) {
 func TestVMessOutbound(t *testing.T) {
 	creator := func() cfgcommon.Buildable {
 	creator := func() cfgcommon.Buildable {
-		return new(VMessOutboundConfig)
+		return new(v4.VMessOutboundConfig)
 	}
 	}
 
 
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
@@ -66,7 +66,7 @@ func TestVMessOutbound(t *testing.T) {
 
 
 func TestVMessInbound(t *testing.T) {
 func TestVMessInbound(t *testing.T) {
 	creator := func() cfgcommon.Buildable {
 	creator := func() cfgcommon.Buildable {
-		return new(VMessInboundConfig)
+		return new(v4.VMessInboundConfig)
 	}
 	}
 
 
 	testassist.RunMultiTestCase(t, []testassist.TestCase{
 	testassist.RunMultiTestCase(t, []testassist.TestCase{

+ 2 - 2
main/commands/helpers/config_load.go

@@ -2,9 +2,9 @@ package helpers
 
 
 import (
 import (
 	"bytes"
 	"bytes"
+	"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
 	"os"
 	"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/merge"
 	"github.com/v2fly/v2ray-core/v4/infra/conf/mergers"
 	"github.com/v2fly/v2ray-core/v4/infra/conf/mergers"
 	"github.com/v2fly/v2ray-core/v4/infra/conf/serial"
 	"github.com/v2fly/v2ray-core/v4/infra/conf/serial"
@@ -13,7 +13,7 @@ import (
 // LoadConfig load config files to *conf.Config, it will:
 // LoadConfig load config files to *conf.Config, it will:
 // - resolve folder to files
 // - resolve folder to files
 // - try to read stdin if no file specified
 // - 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)
 	m, err := LoadConfigToMap(files, format, recursively)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err