Files
v2ray_simple/proxy/config_test.go
e1732a364fed 5867bac0b2 修订代码,文档,Makefile,示例
修复 没给出 -c参数而给出了 -L 参数时,未能成功运行 的bug
使Makefile 支持 免参数编译 当前系统的 可执行文件。

Makefile的 BUILD_VERSION 这次 添加了 显示 build_on 系统 和 all_go_files_md5 的功能。

md5的打印只支持 linux/darwin,且因为 darwin的命令是 md5 而不是 md5sum,导致输出有差别,所以导致md5总和也有差别.
2022-05-05 14:09:12 +08:00

50 lines
907 B
Go

package proxy_test
import (
"net/url"
"testing"
"github.com/e1732a364fed/v2ray_simple/proxy"
)
func TestClientSimpleConfig(t *testing.T) {
confstr1 := `{
"local": "socks5://0.0.0.0:10800#taglocal",
"remote": "vlesss://a684455c-b14f-11ea-bf0d-42010aaa0003@127.0.0.1:4433?insecure=true&version=0#tag1",
"mycountry":"CN",
"fallbacks":[
{
"path":"/asf",
"dest":6060
}
]
}`
mc, hasE, err := proxy.LoadSimpleConfigFromStr(confstr1)
if hasE {
t.Log("loadConfigFromStr err", err)
t.FailNow()
}
t.Log(mc.DialUrl)
u, e := url.Parse(mc.DialUrl)
if e != nil {
t.FailNow()
}
t.Log(u.Fragment)
u, e = url.Parse(mc.ListenUrl)
if e != nil {
t.FailNow()
}
t.Log(u.Fragment)
t.Log(mc.ListenUrl)
t.Log(mc.MyCountryISO_3166)
if mc.MyCountryISO_3166 != "CN" {
t.FailNow()
}
t.Log(mc.Fallbacks, len(mc.Fallbacks))
for i, v := range mc.Fallbacks {
t.Log(i, v)
}
}