mirror of
https://github.com/e1732a364fed/v2ray_simple.git
synced 2025-10-07 01:32:57 +08:00

修复dns配置中"特殊服务器" 无法被正确配置、使用的bug 将 proxy.Standard结构 移动到 项目根目录的 StandardConf. 将 proxy.AppConf, LoadTomlConfStr, LoadTomlConfFile 函数 移动到根目录 因为 StandardConf和 AppConf里包含很多App级别的配置, 不宜放到proxy子包中 将 proxy.RuleConf 移动到 netLayer 将 proxy.LoadRulesForRoutePolicy 移动到 netLayer 将 proxy.LoadDnsMachine 移动到 netLayer 在dnsquery失败后,会判断错误, 若发现是Read错误,则会试图重新拨号
50 lines
973 B
Go
50 lines
973 B
Go
package proxy_test
|
|
|
|
import (
|
|
"net/url"
|
|
"testing"
|
|
|
|
"github.com/hahahrfool/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.Client_ThatDialRemote_Url)
|
|
u, e := url.Parse(mc.Client_ThatDialRemote_Url)
|
|
if e != nil {
|
|
t.FailNow()
|
|
}
|
|
t.Log(u.Fragment)
|
|
|
|
u, e = url.Parse(mc.Server_ThatListenPort_Url)
|
|
if e != nil {
|
|
t.FailNow()
|
|
}
|
|
t.Log(u.Fragment)
|
|
t.Log(mc.Server_ThatListenPort_Url)
|
|
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)
|
|
}
|
|
}
|