mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-08 11:10:14 +08:00
强制使用规范的网络路由地址
This commit is contained in:
@@ -21,19 +21,19 @@ func TestGetPolicy(t *testing.T) {
|
||||
err = SetPolicy(&p2)
|
||||
ast.Nil(err)
|
||||
|
||||
route := []ValData{{Val: "192.168.1.1/24"}}
|
||||
route := []ValData{{Val: "192.168.1.0/24"}}
|
||||
p3 := Policy{Username: "a3", ClientDns: []ValData{{Val: "114.114.114.114"}}, RouteInclude: route, DsExcludeDomains: "com.cn,qq.com"}
|
||||
err = SetPolicy(&p3)
|
||||
ast.Nil(err)
|
||||
// 判断 IpMask
|
||||
ast.Equal(p3.RouteInclude[0].IpMask, "192.168.1.1/255.255.255.0")
|
||||
ast.Equal(p3.RouteInclude[0].IpMask, "192.168.1.0/255.255.255.0")
|
||||
|
||||
route2 := []ValData{{Val: "192.168.2.1/24"}}
|
||||
route2 := []ValData{{Val: "192.168.2.0/24"}}
|
||||
p4 := Policy{Username: "a4", ClientDns: []ValData{{Val: "114.114.114.114"}}, RouteExclude: route2, DsIncludeDomains: "com.cn,qq.com"}
|
||||
err = SetPolicy(&p4)
|
||||
ast.Nil(err)
|
||||
// 判断 IpMask
|
||||
ast.Equal(p4.RouteExclude[0].IpMask, "192.168.2.1/255.255.255.0")
|
||||
ast.Equal(p4.RouteExclude[0].IpMask, "192.168.2.0/255.255.255.0")
|
||||
|
||||
// 判断所有数据
|
||||
var userPolicy *Policy
|
||||
|
Reference in New Issue
Block a user