Skip to content

Commit dc27334

Browse files
committed
Unwrap 4in6 address in socks packet conn
1 parent e2392d8 commit dc27334

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

protocol/socks/packet.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,18 @@ func (c *AssociatePacketConn) Write(b []byte) (n int, err error) {
8989
return c.WriteTo(b, c.remoteAddr)
9090
}
9191

92-
func (c *AssociatePacketConn) ReadPacket(buffer *buf.Buffer) (M.Socksaddr, error) {
93-
destination, err := c.NetPacketConn.ReadPacket(buffer)
92+
func (c *AssociatePacketConn) ReadPacket(buffer *buf.Buffer) (destination M.Socksaddr, err error) {
93+
destination, err = c.NetPacketConn.ReadPacket(buffer)
9494
if err != nil {
9595
return M.Socksaddr{}, err
9696
}
9797
c.remoteAddr = destination
9898
buffer.Advance(3)
99-
dest, err := M.SocksaddrSerializer.ReadAddrPort(buffer)
100-
return dest, err
99+
destination, err = M.SocksaddrSerializer.ReadAddrPort(buffer)
100+
if err != nil {
101+
return
102+
}
103+
return destination.Unwrap(), nil
101104
}
102105

103106
func (c *AssociatePacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error {

0 commit comments

Comments
 (0)