Non-defaultDispatcher registry failed to create vless inbound

pull/5133/head
wyx2685 2025-09-12 15:09:19 +09:00
parent 83c5370eec
commit a74bf88412
No known key found for this signature in database
GPG Key ID: 8827A30FF1DB1379
3 changed files with 23 additions and 7 deletions

View File

@ -5,6 +5,7 @@ import (
"time"
"github.com/xtls/xray-core/app/dispatcher"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/mux"
"github.com/xtls/xray-core/common/net"
@ -226,8 +227,14 @@ func (w *BridgeWorker) DispatchLink(ctx context.Context, dest net.Destination, l
})
return w.Dispatcher.DispatchLink(ctx, dest, link)
}
link = w.Dispatcher.(*dispatcher.DefaultDispatcher).WrapLink(ctx, link)
if dispatcher, ok := w.Dispatcher.(*dispatcher.DefaultDispatcher); ok {
link = dispatcher.WrapLink(ctx, link)
} else {
link = &transport.Link{
Reader: &buf.TimeoutWrapperReader{Reader: link.Reader},
Writer: link.Writer,
}
}
w.handleInternalConn(link)
return nil

View File

@ -64,7 +64,14 @@ func (s *Server) DispatchLink(ctx context.Context, dest net.Destination, link *t
if dest.Address != muxCoolAddress {
return s.dispatcher.DispatchLink(ctx, dest, link)
}
link = s.dispatcher.(*dispatcher.DefaultDispatcher).WrapLink(ctx, link)
if dispatcher, ok := s.dispatcher.(*dispatcher.DefaultDispatcher); ok {
link = dispatcher.WrapLink(ctx, link)
} else {
link = &transport.Link{
Reader: &buf.TimeoutWrapperReader{Reader: link.Reader},
Writer: link.Writer,
}
}
worker, err := NewServerWorker(ctx, s.dispatcher, link)
if err != nil {
return err

View File

@ -12,7 +12,7 @@ import (
"time"
"unsafe"
"github.com/xtls/xray-core/app/dispatcher"
app_dispatcher "github.com/xtls/xray-core/app/dispatcher"
"github.com/xtls/xray-core/app/reverse"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
@ -76,7 +76,6 @@ type Handler struct {
validator vless.Validator
decryption *encryption.ServerInstance
outboundHandlerManager outbound.Manager
defaultDispatcher *dispatcher.DefaultDispatcher
ctx context.Context
fallbacks map[string]map[string]map[string]*Fallback // or nil
// regexps map[string]*regexp.Regexp // or nil
@ -90,7 +89,6 @@ func New(ctx context.Context, config *Config, dc dns.Client, validator vless.Val
policyManager: v.GetFeature(policy.ManagerType()).(policy.Manager),
validator: validator,
outboundHandlerManager: v.GetFeature(outbound.ManagerType()).(outbound.Manager),
defaultDispatcher: v.GetFeature(routing.DispatcherType()).(*dispatcher.DefaultDispatcher),
ctx: ctx,
}
@ -619,7 +617,11 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s
if err != nil {
return err
}
return r.NewMux(ctx, h.defaultDispatcher.WrapLink(ctx, &transport.Link{Reader: clientReader, Writer: clientWriter}))
if dispatcher, ok := dispatcher.(*app_dispatcher.DefaultDispatcher); ok {
return r.NewMux(ctx, dispatcher.WrapLink(ctx, &transport.Link{Reader: clientReader, Writer: clientWriter}))
} else {
return r.NewMux(ctx, &transport.Link{Reader: &buf.TimeoutWrapperReader{Reader: clientReader}, Writer: clientWriter})
}
}
if err := dispatcher.DispatchLink(ctx, request.Destination(), &transport.Link{