add socks

This commit is contained in:
ginuerzh
2021-11-05 23:36:50 +08:00
parent ec8615991b
commit e8f040cbdf
29 changed files with 1210 additions and 144 deletions

View File

@ -8,7 +8,11 @@ func (c *Chain) AddNodeGroup(group *NodeGroup) {
c.groups = append(c.groups, group)
}
func (c *Chain) GetRouteFor(addr string) (r *Route) {
func (c *Chain) GetRoute() (r *Route) {
return c.GetRouteFor("tcp", "")
}
func (c *Chain) GetRouteFor(network, address string) (r *Route) {
if c == nil || len(c.groups) == 0 {
return
}
@ -19,7 +23,7 @@ func (c *Chain) GetRouteFor(addr string) (r *Route) {
if node == nil {
return
}
if node.bypass != nil && node.bypass.Contains(addr) {
if node.bypass != nil && node.bypass.Contains(address) {
break
}
@ -33,3 +37,7 @@ func (c *Chain) GetRouteFor(addr string) (r *Route) {
}
return r
}
func (c *Chain) IsEmpty() bool {
return c == nil || len(c.groups) == 0
}