add context for selector

This commit is contained in:
ginuerzh
2022-09-02 17:23:28 +08:00
parent 2835a5d44a
commit 7136710673
4 changed files with 25 additions and 16 deletions

View File

@ -1,6 +1,8 @@
package chain
import (
"context"
"github.com/go-gost/core/bypass"
"github.com/go-gost/core/hosts"
"github.com/go-gost/core/metadata"
@ -110,10 +112,10 @@ func (g *NodeGroup) FilterAddr(addr string) *NodeGroup {
}
}
func (g *NodeGroup) Next() *Node {
func (g *NodeGroup) Next(ctx context.Context) *Node {
if g == nil || len(g.nodes) == 0 {
return nil
}
return g.selector.Select(g.nodes...)
return g.selector.Select(ctx, g.nodes...)
}