Unwrap 4in6 address in socks packet conn

This commit is contained in:
世界 2023-06-19 13:18:48 +08:00
parent e2392d8d40
commit dc27334e9a
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -89,15 +89,18 @@ func (c *AssociatePacketConn) Write(b []byte) (n int, err error) {
return c.WriteTo(b, c.remoteAddr)
}
func (c *AssociatePacketConn) ReadPacket(buffer *buf.Buffer) (M.Socksaddr, error) {
destination, err := c.NetPacketConn.ReadPacket(buffer)
func (c *AssociatePacketConn) ReadPacket(buffer *buf.Buffer) (destination M.Socksaddr, err error) {
destination, err = c.NetPacketConn.ReadPacket(buffer)
if err != nil {
return M.Socksaddr{}, err
}
c.remoteAddr = destination
buffer.Advance(3)
dest, err := M.SocksaddrSerializer.ReadAddrPort(buffer)
return dest, err
destination, err = M.SocksaddrSerializer.ReadAddrPort(buffer)
if err != nil {
return
}
return destination.Unwrap(), nil
}
func (c *AssociatePacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error {