fix: ipv4in6 should be converged

This commit is contained in:
mzz2017
2023-02-13 18:26:31 +08:00
parent 79423f7ff1
commit 2a586e6341
3 changed files with 12 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import (
"encoding/binary"
"encoding/hex"
"fmt"
"net/netip"
"net/url"
"path/filepath"
"reflect"
@ -366,3 +367,10 @@ func BoolToString(b bool) string {
return "0"
}
}
func ConvergeIp(addr netip.Addr) netip.Addr {
if addr.Is4In6() {
addr = netip.AddrFrom4(addr.As4())
}
return addr
}