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 {
h := &sniHandler{
bypass: options.Bypass,
router: (&chain.Router{}).
WithLogger(options.Logger).
WithResolver(options.Resolver),
router: options.Router,
logger: log,
}
@ -74,16 +72,9 @@ func (h *sniHandler) Init(md md.Metadata) (err error) {
}
}
h.router.WithRetry(h.md.retryCount)
return nil
}
// WithChain implements chain.Chainable interface
func (h *sniHandler) WithChain(chain *chain.Chain) {
h.router.WithChain(chain)
}
func (h *sniHandler) Handle(ctx context.Context, conn net.Conn) {
defer conn.Close()