增加默认路由

This commit is contained in:
bjdgyc
2021-08-13 11:33:53 +08:00
parent 5bd55d1fa8
commit 8187fb548f
3 changed files with 19 additions and 13968 deletions

View File

@@ -68,17 +68,24 @@ func SetGroup(g *Group) error {
clientDns := []ValData{}
for _, v := range g.ClientDns {
if v.Val != "" {
ip := net.ParseIP(v.Val)
if ip.String() != v.Val {
return errors.New("DNS IP 错误")
}
clientDns = append(clientDns, v)
}
}
if len(clientDns) == 0 {
return errors.New("DNS 错误")
return errors.New("必须设置一个DNS")
}
g.ClientDns = clientDns
routeInclude := []ValData{}
for _, v := range g.RouteInclude {
if v.Val != "" {
if v.Val == "all" {
continue
}
ipMask, _, err := parseIpNet(v.Val)
if err != nil {
return errors.New("RouteInclude 错误" + err.Error())