mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-04-18 11:39:11 -04:00
Move proxy/common/config to proxy/internal/config
This commit is contained in:
@@ -4,9 +4,8 @@ import (
|
||||
"net"
|
||||
"testing"
|
||||
|
||||
v2netjson "github.com/v2ray/v2ray-core/common/net/json"
|
||||
v2nettesting "github.com/v2ray/v2ray-core/common/net/testing"
|
||||
"github.com/v2ray/v2ray-core/proxy/dokodemo/json"
|
||||
_ "github.com/v2ray/v2ray-core/proxy/dokodemo/json"
|
||||
_ "github.com/v2ray/v2ray-core/proxy/freedom"
|
||||
"github.com/v2ray/v2ray-core/shell/point"
|
||||
"github.com/v2ray/v2ray-core/shell/point/testing/mocks"
|
||||
@@ -36,17 +35,16 @@ func TestDokodemoTCP(t *testing.T) {
|
||||
assert.Error(err).IsNil()
|
||||
|
||||
pointPort := v2nettesting.PickPort()
|
||||
networkList := v2netjson.NetworkList([]string{"tcp"})
|
||||
config := mocks.Config{
|
||||
PortValue: pointPort,
|
||||
InboundConfigValue: &mocks.ConnectionConfig{
|
||||
ProtocolValue: "dokodemo-door",
|
||||
SettingsValue: &json.DokodemoConfig{
|
||||
Host: v2netjson.NewIPHost(net.ParseIP("127.0.0.1")),
|
||||
PortValue: port,
|
||||
NetworkList: &networkList,
|
||||
TimeoutValue: 0,
|
||||
},
|
||||
SettingsValue: []byte(`{
|
||||
"address": "127.0.0.1",
|
||||
"port": ` + port.String() + `,
|
||||
"network": "tcp",
|
||||
"timeout": 0
|
||||
}`),
|
||||
},
|
||||
OutboundConfigValue: &mocks.ConnectionConfig{
|
||||
ProtocolValue: "freedom",
|
||||
@@ -98,17 +96,16 @@ func TestDokodemoUDP(t *testing.T) {
|
||||
assert.Error(err).IsNil()
|
||||
|
||||
pointPort := v2nettesting.PickPort()
|
||||
networkList := v2netjson.NetworkList([]string{"udp"})
|
||||
config := mocks.Config{
|
||||
PortValue: pointPort,
|
||||
InboundConfigValue: &mocks.ConnectionConfig{
|
||||
ProtocolValue: "dokodemo-door",
|
||||
SettingsValue: &json.DokodemoConfig{
|
||||
Host: v2netjson.NewIPHost(net.ParseIP("127.0.0.1")),
|
||||
PortValue: port,
|
||||
NetworkList: &networkList,
|
||||
TimeoutValue: 0,
|
||||
},
|
||||
SettingsValue: []byte(`{
|
||||
"address": "127.0.0.1",
|
||||
"port": ` + port.String() + `,
|
||||
"network": "udp",
|
||||
"timeout": 0
|
||||
}`),
|
||||
},
|
||||
OutboundConfigValue: &mocks.ConnectionConfig{
|
||||
ProtocolValue: "freedom",
|
||||
|
||||
@@ -3,7 +3,8 @@ package json
|
||||
import (
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
v2netjson "github.com/v2ray/v2ray-core/common/net/json"
|
||||
"github.com/v2ray/v2ray-core/proxy/common/config/json"
|
||||
"github.com/v2ray/v2ray-core/proxy/internal/config"
|
||||
"github.com/v2ray/v2ray-core/proxy/internal/config/json"
|
||||
)
|
||||
|
||||
type DokodemoConfig struct {
|
||||
@@ -30,7 +31,7 @@ func (this *DokodemoConfig) Timeout() int {
|
||||
}
|
||||
|
||||
func init() {
|
||||
json.RegisterInboundConnectionConfig("dokodemo-door", func() interface{} {
|
||||
config.RegisterInboundConnectionConfig("dokodemo-door", json.JsonConfigLoader(func() interface{} {
|
||||
return new(DokodemoConfig)
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user