1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00

move v4 configure support to own directory

This commit is contained in:
Shelikhoo 2021-06-19 13:45:43 +01:00
parent c86ac3aca6
commit add375390e
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316
42 changed files with 76 additions and 76 deletions

View File

@ -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) { func DecodeJSONConfig(reader io.Reader) (*v4.Config, error) {
jsonConfig := &conf.Config{} jsonConfig := &v4.Config{}
err := DecodeJSON(reader, jsonConfig) err := DecodeJSON(reader, jsonConfig)
if err != nil { if err != nil {
return nil, err return nil, err

View File

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

View File

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

View File

@ -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{

View File

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

View File

@ -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

View File

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

View File

@ -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{

View File

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

View File

@ -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{

View File

@ -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"

View File

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

View File

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

View File

@ -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{

View File

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

View File

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

View File

@ -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{

View File

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

View File

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

View File

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

View File

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

View File

@ -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"

View File

@ -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()

View File

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

View File

@ -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{

View File

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

View File

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

View File

@ -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{

View File

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

View File

@ -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{

View File

@ -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"

View File

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

View File

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

View File

@ -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
} }

View File

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

View File

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

View File

@ -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)

View File

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

View File

@ -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{

View File

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

View File

@ -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{

View File

@ -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