Fix URLTest session warmup for session-based outbounds

This commit is contained in:
世界
2026-10-23 19:57:08 +08:00
parent 8e90fc34e6
commit b5c6f6c859
3 changed files with 16 additions and 0 deletions
+6
View File
@@ -33,6 +33,8 @@ func RegisterOutbound(registry *outbound.Registry) {
outbound.Register[option.NaiveOutboundOptions](registry, C.TypeNaive, NewOutbound)
}
var _ adapter.OutboundWithMultiplex = (*Outbound)(nil)
type Outbound struct {
outbound.Adapter
ctx context.Context
@@ -257,6 +259,10 @@ func (h *Outbound) ListenPacket(ctx context.Context, destination M.Socksaddr) (n
return h.uotClient.ListenPacket(ctx, destination)
}
func (h *Outbound) MultiplexEnabled() bool {
return true
}
func (h *Outbound) InterfaceUpdated(ctx context.Context) {
h.client.CloseAllConnections()
}
+5
View File
@@ -70,6 +70,7 @@ var (
_ adapter.OutboundWithPreferredRoutes = (*Endpoint)(nil)
_ adapter.InterfaceUpdateListener = (*Endpoint)(nil)
_ adapter.Referrer = (*Endpoint)(nil)
_ adapter.OutboundWithMultiplex = (*Endpoint)(nil)
_ dialer.PacketDialerWithDestination = (*Endpoint)(nil)
_ tun.Port = (*Endpoint)(nil)
)
@@ -756,6 +757,10 @@ func (t *Endpoint) Logout(ctx context.Context) error {
return nil
}
func (t *Endpoint) MultiplexEnabled() bool {
return true
}
func (t *Endpoint) InterfaceUpdated(ctx context.Context) {
if !t.started.Load() {
return
+5
View File
@@ -29,6 +29,7 @@ import (
var (
_ adapter.OutboundWithPreferredRoutes = (*Endpoint)(nil)
_ adapter.InterfaceUpdateListener = (*Endpoint)(nil)
_ adapter.OutboundWithMultiplex = (*Endpoint)(nil)
_ dialer.PacketDialerWithDestination = (*Endpoint)(nil)
)
@@ -156,6 +157,10 @@ func (w *Endpoint) Start(stage adapter.StartStage, scope *adapter.Scope) error {
return nil
}
func (w *Endpoint) MultiplexEnabled() bool {
return true
}
func (w *Endpoint) InterfaceUpdated(ctx context.Context) {
if !w.started.Load() {
return