Fix none readfrom

This commit is contained in:
世界 2022-06-06 10:03:23 +08:00
parent 1e22882ea8
commit b941e76915
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
2 changed files with 13 additions and 9 deletions

14
none.go
View file

@ -92,7 +92,7 @@ func (c *noneConn) WriteBuffer(buffer *buf.Buffer) error {
}
func (c *noneConn) ReadFrom(r io.Reader) (n int64, err error) {
if c.handshake {
if !c.handshake {
return bufio.ReadFrom0(c, r)
}
return bufio.Copy(c.Conn, r)
@ -106,6 +106,18 @@ func (c *noneConn) RemoteAddr() net.Addr {
return c.destination.TCPAddr()
}
func (c *noneConn) Upstream() any {
return c.Conn
}
func (c *noneConn) ReaderReplaceable() bool {
return true
}
func (c *noneConn) WriterReplaceable() bool {
return c.handshake
}
type nonePacketConn struct {
net.Conn
}