add chain.Chainable interface

This commit is contained in:
ginuerzh
2021-11-23 21:44:32 +08:00
parent ece51cb0b8
commit 7beb5bf6d7
18 changed files with 125 additions and 63 deletions

View File

@ -41,7 +41,6 @@ func NewHandler(opts ...handler.Option) handler.Handler {
}
return &httpHandler{
chain: options.Chain,
bypass: options.Bypass,
logger: options.Logger,
}
@ -51,6 +50,11 @@ func (h *httpHandler) Init(md md.Metadata) error {
return h.parseMetadata(md)
}
// implements chain.Chainable interface
func (h *httpHandler) WithChain(chain *chain.Chain) {
h.chain = chain
}
func (h *httpHandler) Handle(ctx context.Context, conn net.Conn) {
defer conn.Close()