add port range support for service

This commit is contained in:
ginuerzh
2024-07-08 22:38:21 +08:00
parent 96f4d7bf5c
commit c1d0887a9b
73 changed files with 1915 additions and 316 deletions

View File

@ -9,7 +9,6 @@ import (
"strconv"
"time"
"github.com/go-gost/core/chain"
"github.com/go-gost/core/handler"
"github.com/go-gost/core/logger"
md "github.com/go-gost/core/metadata"
@ -29,7 +28,6 @@ func init() {
}
type forwardHandler struct {
router *chain.Router
md metadata
options handler.Options
}
@ -50,11 +48,6 @@ func (h *forwardHandler) Init(md md.Metadata) (err error) {
return
}
h.router = h.options.Router
if h.router == nil {
h.router = chain.NewRouter(chain.LoggerRouterOption(h.options.Logger))
}
return nil
}
@ -97,7 +90,7 @@ func (h *forwardHandler) handleDirectForward(ctx context.Context, conn *sshd_uti
return nil
}
cc, err := h.router.Dial(ctx, "tcp", targetAddr)
cc, err := h.options.Router.Dial(ctx, "tcp", targetAddr)
if err != nil {
return err
}