mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 20:50:09 +00:00
support xtls-rprx-vision, support reality
This commit is contained in:
@@ -2,97 +2,32 @@ package node_test
|
||||
|
||||
import (
|
||||
"github.com/Yuzuki616/V2bX/api/panel"
|
||||
"github.com/Yuzuki616/V2bX/conf"
|
||||
. "github.com/Yuzuki616/V2bX/node"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBuildV2ray(t *testing.T) {
|
||||
nodeInfo := &panel.NodeInfo{
|
||||
NodeType: "V2ray",
|
||||
NodeID: 1,
|
||||
Port: 1145,
|
||||
SpeedLimit: 0,
|
||||
AlterID: 2,
|
||||
TransportProtocol: "ws",
|
||||
Host: "test.test.tk",
|
||||
Path: "v2ray",
|
||||
EnableTLS: false,
|
||||
TLSType: "tls",
|
||||
NodeType: "v2ray",
|
||||
NodeId: 1,
|
||||
ServerPort: 1145,
|
||||
Network: "ws",
|
||||
NetworkSettings: nil,
|
||||
Host: "test.test.tk",
|
||||
ServerName: "test.test.tk",
|
||||
}
|
||||
certConfig := &CertConfig{
|
||||
CertMode: "http",
|
||||
certConfig := &conf.CertConfig{
|
||||
CertMode: "none",
|
||||
CertDomain: "test.test.tk",
|
||||
Provider: "alidns",
|
||||
Email: "test@gmail.com",
|
||||
}
|
||||
config := &Config{
|
||||
config := &conf.ControllerConfig{
|
||||
ListenIP: "0.0.0.0",
|
||||
CertConfig: certConfig,
|
||||
}
|
||||
_, err := buildInbound(config, nodeInfo)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildTrojan(t *testing.T) {
|
||||
nodeInfo := &panel.NodeInfo{
|
||||
NodeType: "Trojan",
|
||||
NodeID: 1,
|
||||
Port: 1145,
|
||||
SpeedLimit: 0,
|
||||
AlterID: 2,
|
||||
TransportProtocol: "tcp",
|
||||
Host: "trojan.test.tk",
|
||||
Path: "v2ray",
|
||||
EnableTLS: false,
|
||||
TLSType: "tls",
|
||||
}
|
||||
DNSEnv := make(map[string]string)
|
||||
DNSEnv["ALICLOUD_ACCESS_KEY"] = "aaa"
|
||||
DNSEnv["ALICLOUD_SECRET_KEY"] = "bbb"
|
||||
certConfig := &CertConfig{
|
||||
CertMode: "dns",
|
||||
CertDomain: "trojan.test.tk",
|
||||
Provider: "alidns",
|
||||
Email: "test@gmail.com",
|
||||
DNSEnv: DNSEnv,
|
||||
}
|
||||
config := &Config{
|
||||
CertConfig: certConfig,
|
||||
}
|
||||
_, err := buildInbound(config, nodeInfo)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildSS(t *testing.T) {
|
||||
nodeInfo := &panel.NodeInfo{
|
||||
NodeType: "Shadowsocks",
|
||||
NodeID: 1,
|
||||
Port: 1145,
|
||||
SpeedLimit: 0,
|
||||
AlterID: 2,
|
||||
TransportProtocol: "tcp",
|
||||
Host: "test.test.tk",
|
||||
Path: "v2ray",
|
||||
EnableTLS: false,
|
||||
TLSType: "tls",
|
||||
}
|
||||
DNSEnv := make(map[string]string)
|
||||
DNSEnv["ALICLOUD_ACCESS_KEY"] = "aaa"
|
||||
DNSEnv["ALICLOUD_SECRET_KEY"] = "bbb"
|
||||
certConfig := &CertConfig{
|
||||
CertMode: "dns",
|
||||
CertDomain: "trojan.test.tk",
|
||||
Provider: "alidns",
|
||||
Email: "test@me.com",
|
||||
DNSEnv: DNSEnv,
|
||||
}
|
||||
config := &Config{
|
||||
CertConfig: certConfig,
|
||||
}
|
||||
_, err := buildInbound(config, nodeInfo)
|
||||
_, err := BuildInbound(config, nodeInfo, "11")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user