updated code to treat ipv4inv6 as ipv4

This commit is contained in:
2025-01-16 01:26:58 +09:00
parent e1eb346228
commit c237b8a842
4 changed files with 15 additions and 13 deletions

View File

@ -53,7 +53,7 @@ func TcpAddrStrClass(addr string) string {
ap, err = netip.ParseAddrPort(addr)
if err == nil {
if ap.Addr().Is6() { return "tcp6" }
if ap.Addr().Is4() { return "tcp4" }
if ap.Addr().Is4() || ap.Addr().Is4In6() { return "tcp4" }
}
}
@ -61,7 +61,9 @@ func TcpAddrStrClass(addr string) string {
}
func TcpAddrClass(addr *net.TCPAddr) string {
if addr.AddrPort().Addr().Is4() {
var netip_addr netip.Addr
netip_addr = addr.AddrPort().Addr()
if netip_addr.Is4() || netip_addr.Is4In6() {
return "tcp4"
} else {
return "tcp6"
@ -103,7 +105,7 @@ func string_to_route_option(desc string) RouteOption {
return option
}
func (option RouteOption) string() string {
func (option RouteOption) String() string {
var str string
str = ""
if option & RouteOption(ROUTE_OPTION_TCP6) != 0 { str += " tcp6" }