diff --git a/docs/changelog.md b/docs/changelog.md index bd46dc8cec..8af286e744 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,9 +2,17 @@ icon: material/alert-decagram --- -#### 1.14.0-alpha.24 +#### 1.14.0-alpha.25 -* Fixes and improvement +* Revert Tailscale endpoint dial fields deprecation and remove `control_http_client` **1** +* Fixes and improvements + +**1**: + +The `control_http_client` field on +[Tailscale](/configuration/endpoint/tailscale/) endpoints introduced in +`1.14.0-alpha.13` is removed, and the deprecation of +[Dial Fields](/configuration/endpoint/tailscale/#dial-fields) is reverted. #### 1.13.12 diff --git a/protocol/group/selector.go b/protocol/group/selector.go index 85bea2b964..1da8466b4e 100644 --- a/protocol/group/selector.go +++ b/protocol/group/selector.go @@ -141,7 +141,11 @@ func (s *Selector) SelectOutbound(tag string) bool { } func (s *Selector) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error) { - conn, err := s.selected.Load().DialContext(ctx, network, destination) + selected := s.selected.Load() + if selected == nil { + return nil, E.New("selector ", s.Tag(), " has no selected outbound") + } + conn, err := selected.DialContext(ctx, network, destination) if err != nil { return nil, err } @@ -149,7 +153,11 @@ func (s *Selector) DialContext(ctx context.Context, network string, destination } func (s *Selector) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error) { - conn, err := s.selected.Load().ListenPacket(ctx, destination) + selected := s.selected.Load() + if selected == nil { + return nil, E.New("selector ", s.Tag(), " has no selected outbound") + } + conn, err := selected.ListenPacket(ctx, destination) if err != nil { return nil, err } @@ -159,6 +167,10 @@ func (s *Selector) ListenPacket(ctx context.Context, destination M.Socksaddr) (n func (s *Selector) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, onClose N.CloseHandlerFunc) { ctx = interrupt.ContextWithIsExternalConnection(ctx) selected := s.selected.Load() + if selected == nil { + N.CloseOnHandshakeFailure(conn, onClose, E.New("selector ", s.Tag(), " has no selected outbound")) + return + } if outboundHandler, isHandler := selected.(adapter.ConnectionHandler); isHandler { outboundHandler.NewConnection(ctx, conn, metadata, onClose) } else { @@ -169,6 +181,10 @@ func (s *Selector) NewConnection(ctx context.Context, conn net.Conn, metadata ad func (s *Selector) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext, onClose N.CloseHandlerFunc) { ctx = interrupt.ContextWithIsExternalConnection(ctx) selected := s.selected.Load() + if selected == nil { + N.CloseOnHandshakeFailure(conn, onClose, E.New("selector ", s.Tag(), " has no selected outbound")) + return + } if outboundHandler, isHandler := selected.(adapter.PacketConnectionHandler); isHandler { outboundHandler.NewPacketConnection(ctx, conn, metadata, onClose) } else { @@ -178,6 +194,9 @@ func (s *Selector) NewPacketConnection(ctx context.Context, conn N.PacketConn, m func (s *Selector) NewDirectRouteConnection(metadata adapter.InboundContext, routeContext tun.DirectRouteContext, timeout time.Duration) (tun.DirectRouteDestination, error) { selected := s.selected.Load() + if selected == nil { + return nil, E.New("selector ", s.Tag(), " has no selected outbound") + } if !common.Contains(selected.Network(), metadata.Network) { return nil, E.New(metadata.Network, " is not supported by outbound: ", selected.Tag()) }