Add read deadline implementation

This commit is contained in:
世界 2023-04-08 14:41:53 +08:00
parent 17988ac0d3
commit 5c830455eb
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
8 changed files with 25 additions and 19 deletions

View file

@ -13,6 +13,7 @@ import (
"github.com/sagernet/sing-shadowsocks"
"github.com/sagernet/sing/common"
"github.com/sagernet/sing/common/buf"
"github.com/sagernet/sing/common/bufio/deadline"
M "github.com/sagernet/sing/common/metadata"
N "github.com/sagernet/sing/common/network"
@ -143,15 +144,15 @@ func (m *Method) DialConn(conn net.Conn, destination M.Socksaddr) (net.Conn, err
Conn: conn,
destination: destination,
}
return shadowsocksConn, shadowsocksConn.writeRequest()
return deadline.NewConn(shadowsocksConn), shadowsocksConn.writeRequest()
}
func (m *Method) DialEarlyConn(conn net.Conn, destination M.Socksaddr) net.Conn {
return &clientConn{
return deadline.NewConn(&clientConn{
Method: m,
Conn: conn,
destination: destination,
}
})
}
func (m *Method) DialPacketConn(conn net.Conn) N.NetPacketConn {