Simpilify configuration files

This commit is contained in:
V2Ray committed 2015-10-06 23:11:08 +02:00
1 parent 78daf8a879
commit 72b4eeba8b
27 files changed
+251 -208

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
package json
import (
"github.com/v2ray/v2ray-core/config"
"github.com/v2ray/v2ray-core/config/json"
)
type FreedomConfiguration struct {
}
func init() {
json.RegisterConfigType("freedom", config.TypeOutbound, func() interface{} {
return &FreedomConfiguration{}
})
}
+7 -4
View File
@@ -11,6 +11,7 @@ import (
"github.com/v2ray/v2ray-core"
v2net "github.com/v2ray/v2ray-core/common/net"
_ "github.com/v2ray/v2ray-core/proxy/socks"
"github.com/v2ray/v2ray-core/proxy/socks/config/json"
"github.com/v2ray/v2ray-core/testing/mocks"
"github.com/v2ray/v2ray-core/testing/servers/tcp"
"github.com/v2ray/v2ray-core/testing/servers/udp"
@@ -47,11 +48,11 @@ func TestUDPSend(t *testing.T) {
PortValue: pointPort,
InboundConfigValue: &mocks.ConnectionConfig{
ProtocolValue: "mock_ich",
ContentValue: nil,
SettingsValue: nil,
},
OutboundConfigValue: &mocks.ConnectionConfig{
ProtocolValue: "freedom",
ContentValue: nil,
SettingsValue: nil,
},
}
@@ -89,11 +90,13 @@ func TestSocksTcpConnect(t *testing.T) {
PortValue: pointPort,
InboundConfigValue: &mocks.ConnectionConfig{
ProtocolValue: "socks",
ContentValue: []byte("{\"auth\": \"noauth\"}"),
SettingsValue: &json.SocksConfig{
AuthMethod: "auth",
},
},
OutboundConfigValue: &mocks.ConnectionConfig{
ProtocolValue: "freedom",
ContentValue: nil,
SettingsValue: nil,
},
}
+1 -5
View File
@@ -8,11 +8,7 @@ import (
type FreedomFactory struct {
}
func (factory FreedomFactory) Initialize(config []byte) error {
return nil
}
func (factory FreedomFactory) Create(vp *core.Point, firstPacket v2net.Packet) (core.OutboundConnectionHandler, error) {
func (factory FreedomFactory) Create(vp *core.Point, config interface{}, firstPacket v2net.Packet) (core.OutboundConnectionHandler, error) {
return NewFreedomConnection(firstPacket), nil
}