forked from e1732a364fed/v2ray_simple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf_test.go
66 lines (51 loc) · 1.06 KB
/
conf_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package v2ray_simple
import (
"testing"
"github.com/BurntSushi/toml"
"github.com/e1732a364fed/v2ray_simple/proxy"
)
func TestLoadTomlConf(t *testing.T) {
var conf proxy.StandardConf
_, err := toml.Decode(testTomlConfStr, &conf)
if err != nil {
t.Log(err)
t.FailNow()
}
t.Log(conf)
t.Log("dial0", conf.Dial[0])
t.Log("listen0", conf.Listen[0])
t.Log("extra", conf.Listen[0].Extra)
t.Log(conf.Route[0])
t.Log(conf.Route[1])
t.Log(conf.Fallbacks)
}
const testTomlConfStr = `# this is a verysimple standard config
[app]
mycountry = "CN"
[[dial]]
tag = "my_vlesss1"
protocol = "vlesss"
uuid = "a684455c-b14f-11ea-bf0d-42010aaa0003"
host = "127.0.0.1"
port = 4433
version = 0
insecure = true
utls = true
[[listen]]
protocol = "socks5"
host = "127.0.0.1"
port = 1080
tag = "my_socks51"
extra = { ws_earlydata = 4096 }
[[route]]
toTag = "my_ws1"
country = ["CN"]
ip = ["0.0.0.0/8","10.0.0.0/8","fe80::/10","10.0.0.1"]
domain = ["www.google.com","www.twitter.com"]
network = ["tcp","udp"]
[[route]]
toTag = "my_vless1"
[[fallback]]
path = "/asf"
dest = 6060
`