diff --git a/chain/chain.go b/chain/chain.go index 58f77cc..7fb6859 100644 --- a/chain/chain.go +++ b/chain/chain.go @@ -34,7 +34,7 @@ func (c *Chain) Route(network, address string) (r *Route) { break } - node := group.filter(address).Next() + node := group.FilterAddr(address).Next() if node == nil { return } diff --git a/chain/node.go b/chain/node.go index a615f9b..957db27 100644 --- a/chain/node.go +++ b/chain/node.go @@ -41,6 +41,10 @@ func (g *NodeGroup) AddNode(node *Node) { g.nodes = append(g.nodes, node) } +func (g *NodeGroup) Nodes() []*Node { + return g.nodes +} + func (g *NodeGroup) WithSelector(selector Selector) *NodeGroup { g.selector = selector return g @@ -51,7 +55,7 @@ func (g *NodeGroup) WithBypass(bypass bypass.Bypass) *NodeGroup { return g } -func (g *NodeGroup) filter(addr string) *NodeGroup { +func (g *NodeGroup) FilterAddr(addr string) *NodeGroup { var nodes []*Node for _, node := range g.nodes { if node.Bypass == nil || !node.Bypass.Contains(addr) {