add router handler option

This commit is contained in:
ginuerzh
2021-12-31 00:03:24 +08:00
parent a430384bba
commit 9769efe33c
35 changed files with 98 additions and 281 deletions

View File

@ -46,9 +46,7 @@ func NewHandler(opts ...handler.Option) handler.Handler {
return &tunHandler{
bypass: options.Bypass,
router: (&chain.Router{}).
WithLogger(options.Logger).
WithResolver(options.Resolver),
router: options.Router,
logger: options.Logger,
exit: make(chan struct{}, 1),
}
@ -59,16 +57,9 @@ func (h *tunHandler) Init(md md.Metadata) (err error) {
return err
}
h.router.WithRetry(h.md.retryCount)
return nil
}
// implements chain.Chainable interface
func (h *tunHandler) WithChain(chain *chain.Chain) {
h.router.WithChain(chain)
}
// Forward implements handler.Forwarder.
func (h *tunHandler) Forward(group *chain.NodeGroup) {
h.group = group