mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-04 20:37:40 +03:00
Cast 4in6 from reading socksaddr
This commit is contained in:
parent
5b49366f6e
commit
01ea424838
2 changed files with 6 additions and 2 deletions
|
@ -122,7 +122,11 @@ func (s *Serializer) ReadAddress(reader io.Reader) (Socksaddr, error) {
|
|||
if err != nil {
|
||||
return Socksaddr{}, E.Cause(err, "read ipv6 address")
|
||||
}
|
||||
return Socksaddr{Addr: netip.AddrFrom16(addr)}, nil
|
||||
netAddr := netip.AddrFrom16(addr)
|
||||
if netAddr.Is4In6() {
|
||||
netAddr = netip.AddrFrom4(netAddr.As4())
|
||||
}
|
||||
return Socksaddr{Addr: netAddr}, nil
|
||||
default:
|
||||
return Socksaddr{}, E.New("unknown address family: ", af)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue