mirror of https://github.com/XTLS/Xray-core
Non-defaultDispatcher registry failed to create vless inbound
parent
83c5370eec
commit
a74bf88412
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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{
|
||||
|
|
Loading…
Reference in New Issue