From 134802d1ee080a01dad548ab374e0ccbad99c457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 25 Apr 2025 11:35:06 +0800 Subject: [PATCH] Fix ssh outbound --- protocol/ssh/outbound.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/protocol/ssh/outbound.go b/protocol/ssh/outbound.go index eb9970b5..b329d4b3 100644 --- a/protocol/ssh/outbound.go +++ b/protocol/ssh/outbound.go @@ -10,6 +10,7 @@ import ( "strconv" "strings" "sync" + "time" "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/adapter/outbound" @@ -191,9 +192,29 @@ func (s *Outbound) DialContext(ctx context.Context, network string, destination if err != nil { return nil, err } - return client.Dial(network, destination.String()) + conn, err := client.Dial(network, destination.String()) + if err != nil { + return nil, err + } + return &chanConnWrapper{Conn: conn}, nil } func (s *Outbound) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error) { return nil, os.ErrInvalid } + +type chanConnWrapper struct { + net.Conn +} + +func (c *chanConnWrapper) SetDeadline(t time.Time) error { + return os.ErrInvalid +} + +func (c *chanConnWrapper) SetReadDeadline(t time.Time) error { + return os.ErrInvalid +} + +func (c *chanConnWrapper) SetWriteDeadline(t time.Time) error { + return os.ErrInvalid +}