mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-03 08:23:04 +00:00
Simpilify configuration files
This commit is contained in:
1 parent
78daf8a879
commit
72b4eeba8b
27 files changed
+251
-208
No files matched your search
@@ -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{}
|
||||
})
|
||||
}
|
||||
@@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user