add plugin system

This commit is contained in:
ginuerzh
2023-04-18 20:52:56 +08:00
parent 7576651a67
commit 32c8188351
48 changed files with 761 additions and 115 deletions

View File

@ -116,7 +116,7 @@ func (h *redirectHandler) Handle(ctx context.Context, conn net.Conn, opts ...han
log.Debugf("%s >> %s", conn.RemoteAddr(), dstAddr)
if h.options.Bypass != nil && h.options.Bypass.Contains(dstAddr.String()) {
if h.options.Bypass != nil && h.options.Bypass.Contains(ctx, dstAddr.String()) {
log.Debug("bypass: ", dstAddr)
return nil
}
@ -157,7 +157,7 @@ func (h *redirectHandler) handleHTTP(ctx context.Context, rw io.ReadWriter, radd
"host": host,
})
if h.options.Bypass != nil && h.options.Bypass.Contains(host) {
if h.options.Bypass != nil && h.options.Bypass.Contains(ctx, host) {
log.Debug("bypass: ", host)
return nil
}
@ -226,7 +226,7 @@ func (h *redirectHandler) handleHTTPS(ctx context.Context, rw io.ReadWriter, rad
"host": host,
})
if h.options.Bypass != nil && h.options.Bypass.Contains(host) {
if h.options.Bypass != nil && h.options.Bypass.Contains(ctx, host) {
log.Debug("bypass: ", host)
return nil
}