fix socks5 AssociatePacketConn Read

This commit is contained in:
dyhkwong 2024-05-17 20:03:42 +08:00
parent 8fb1634c9a
commit 76807c4415

View file

@ -85,9 +85,10 @@ func (c *AssociatePacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error
return bufio.WritePacketBuffer(c.NetPacketConn, buffer, c.remoteAddr) return bufio.WritePacketBuffer(c.NetPacketConn, buffer, c.remoteAddr)
} }
func (c *AssociatePacketConn) Read(b []byte) (n int, err error) { func (c *AssociatePacketConn) Read(b []byte) (int, error) {
n, _, err = c.ReadFrom(b) n, addr, err := c.ReadFrom(b)
return c.remoteAddr = M.SocksaddrFromNet(addr)
return n, err
} }
func (c *AssociatePacketConn) Write(b []byte) (n int, err error) { func (c *AssociatePacketConn) Write(b []byte) (n int, err error) {