SVLAVR
2026-11-24 18:20:46 +00:00
committed by RPRXX
co-authored by Codex RPRX
parent 15b2499d34
commit e17392a96e
64 changed files with 3107 additions and 3918 deletions
+8 -7
View File
@@ -6,12 +6,12 @@ import (
"github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/mux"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/proxy"
"github.com/xtls/xray-core/transport/internet"
@@ -48,7 +48,6 @@ type AlwaysOnInboundHandler struct {
receiverConfig *proxyman.ReceiverConfig
proxy proxy.Inbound
workers []worker
mux *mux.Server
tag string
}
@@ -82,11 +81,14 @@ func NewAlwaysOnInboundHandler(ctx context.Context, tag string, receiverConfig *
return nil, errors.New("not an inbound proxy.")
}
dispatcher := new(struct{ routing.Dispatcher })
if err := core.RequireFeatures(ctx, func(d routing.Dispatcher) { dispatcher.Dispatcher = d }); err != nil {
return nil, err
}
h := &AlwaysOnInboundHandler{
receiverConfig: receiverConfig,
proxyConfig: proxyConfig,
proxy: p,
mux: mux.NewServer(ctx),
tag: tag,
}
@@ -117,7 +119,7 @@ func NewAlwaysOnInboundHandler(ctx context.Context, tag string, receiverConfig *
proxy: p,
stream: mss,
tag: tag,
dispatcher: h.mux,
dispatcher: dispatcher,
sniffingRequest: sniffingRequest,
uplinkCounter: uplinkCounter,
downlinkCounter: downlinkCounter,
@@ -139,7 +141,7 @@ func NewAlwaysOnInboundHandler(ctx context.Context, tag string, receiverConfig *
stream: mss,
recvOrigDest: receiverConfig.ReceiveOriginalDestination,
tag: tag,
dispatcher: h.mux,
dispatcher: dispatcher,
sniffingRequest: sniffingRequest,
uplinkCounter: uplinkCounter,
downlinkCounter: downlinkCounter,
@@ -154,7 +156,7 @@ func NewAlwaysOnInboundHandler(ctx context.Context, tag string, receiverConfig *
proxy: p,
address: address,
port: net.Port(port),
dispatcher: h.mux,
dispatcher: dispatcher,
sniffingRequest: sniffingRequest,
uplinkCounter: uplinkCounter,
downlinkCounter: downlinkCounter,
@@ -192,7 +194,6 @@ func (h *AlwaysOnInboundHandler) Close() error {
for _, worker := range h.workers {
errs = append(errs, worker.Close())
}
errs = append(errs, h.mux.Close())
errs = append(errs, common.Close(h.proxy))
if err := errors.Combine(errs...); err != nil {
return errors.New("failed to close all resources").Base(err)