Fix ssh outbound

This commit is contained in:
世界 2025-04-25 11:35:06 +08:00
parent e5e81b4de1
commit 134802d1ee
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4

View File

@ -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
}