add reload and plugin support for hop

This commit is contained in:
ginuerzh
2023-09-28 21:04:15 +08:00
parent ddc3c9392e
commit ea585fc25d
88 changed files with 2208 additions and 1538 deletions

View File

@ -10,6 +10,7 @@ import (
"time"
"github.com/go-gost/core/chain"
"github.com/go-gost/core/hop"
"github.com/go-gost/core/handler"
"github.com/go-gost/core/logger"
md "github.com/go-gost/core/metadata"
@ -22,7 +23,7 @@ func init() {
}
type http3Handler struct {
hop chain.Hop
hop hop.Hop
router *chain.Router
md metadata
options handler.Options
@ -53,7 +54,7 @@ func (h *http3Handler) Init(md md.Metadata) error {
}
// Forward implements handler.Forwarder.
func (h *http3Handler) Forward(hop chain.Hop) {
func (h *http3Handler) Forward(hop hop.Hop) {
h.hop = hop
}
@ -118,7 +119,7 @@ func (h *http3Handler) roundTrip(ctx context.Context, w http.ResponseWriter, req
var target *chain.Node
if h.hop != nil {
target = h.hop.Select(ctx, chain.HostSelectOption(addr))
target = h.hop.Select(ctx, hop.HostSelectOption(addr))
}
if target == nil {
err := errors.New("target not available")