add weight for selector

This commit is contained in:
ginuerzh
2022-09-02 17:23:59 +08:00
parent c643014e12
commit 00f7fa2997
16 changed files with 109 additions and 45 deletions

View File

@ -1,6 +1,8 @@
package registry
import (
"context"
"github.com/go-gost/core/chain"
"github.com/go-gost/core/metadata"
"github.com/go-gost/core/selector"
@ -49,10 +51,10 @@ func (w *chainWrapper) Metadata() metadata.Metadata {
return v.Metadata()
}
func (w *chainWrapper) Route(network, address string) chain.Route {
func (w *chainWrapper) Route(ctx context.Context, network, address string) chain.Route {
v := w.r.get(w.name)
if v == nil {
return nil
}
return v.Route(network, address)
return v.Route(ctx, network, address)
}