diff --git a/client-ctl.go b/client-ctl.go index f68dcd9..5f92945 100644 --- a/client-ctl.go +++ b/client-ctl.go @@ -182,7 +182,7 @@ func (ctl *client_ctl_client_conns) ServeHTTP(w http.ResponseWriter, req *http.R ClientPeerName: r.peer_name, ServerPeerListenAddr: r.server_peer_listen_addr.String(), ServerPeerNet: r.server_peer_net, - ServerPeerOption: r.server_peer_option.string(), + ServerPeerOption: r.server_peer_option.String(), Lifetime: fmt.Sprintf("%.09f", r.lifetime.Seconds()), LifetimeStart: r.lifetime_start.Unix(), }) @@ -295,7 +295,7 @@ func (ctl *client_ctl_client_conns_id) ServeHTTP(w http.ResponseWriter, req *htt ClientPeerName: r.peer_name, ServerPeerListenAddr: r.server_peer_listen_addr.String(), ServerPeerNet: r.server_peer_net, - ServerPeerOption: r.server_peer_option.string(), + ServerPeerOption: r.server_peer_option.String(), Lifetime: fmt.Sprintf("%.09f", r.lifetime.Seconds()), LifetimeStart: r.lifetime_start.Unix(), }) @@ -373,7 +373,7 @@ func (ctl *client_ctl_client_conns_id_routes) ServeHTTP(w http.ResponseWriter, r ClientPeerName: r.peer_name, ServerPeerListenAddr: r.server_peer_listen_addr.String(), ServerPeerNet: r.server_peer_net, - ServerPeerOption: r.server_peer_option.string(), + ServerPeerOption: r.server_peer_option.String(), Lifetime: fmt.Sprintf("%.09f", r.lifetime.Seconds()), LifetimeStart: r.lifetime_start.Unix(), }) @@ -508,7 +508,7 @@ func (ctl *client_ctl_client_conns_id_routes_id) ServeHTTP(w http.ResponseWriter ClientPeerName: r.peer_name, ServerPeerListenAddr: r.server_peer_listen_addr.String(), ServerPeerNet: r.server_peer_net, - ServerPeerOption: r.server_peer_option.string(), + ServerPeerOption: r.server_peer_option.String(), Lifetime: r.lifetime.String(), }) if err != nil { goto oops } @@ -613,7 +613,7 @@ func (ctl *client_ctl_client_conns_id_routes_spsp) ServeHTTP(w http.ResponseWrit ClientPeerName: r.peer_name, ServerPeerListenAddr: r.server_peer_listen_addr.String(), ServerPeerNet: r.server_peer_net, - ServerPeerOption: r.server_peer_option.string(), + ServerPeerOption: r.server_peer_option.String(), Lifetime: r.lifetime.String(), }) if err != nil { goto oops } diff --git a/hodu.go b/hodu.go index ae3f025..b8e024b 100644 --- a/hodu.go +++ b/hodu.go @@ -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" } diff --git a/server-ctl.go b/server-ctl.go index 3b5e94f..9821725 100644 --- a/server-ctl.go +++ b/server-ctl.go @@ -102,7 +102,7 @@ func (ctl *server_ctl_server_conns) ServeHTTP(w http.ResponseWriter, req *http.R ClientPeerName: r.PtcName, ServerPeerServiceAddr: r.SvcAddr.String(), ServerPeerServiceNet: r.SvcPermNet.String(), - ServerPeerOption: r.SvcOption.string(), + ServerPeerOption: r.SvcOption.String(), }) } js = append(js, json_out_server_conn{ @@ -169,7 +169,7 @@ func (ctl *server_ctl_server_conns_id) ServeHTTP(w http.ResponseWriter, req *htt ClientPeerName: r.PtcName, ServerPeerServiceAddr: r.SvcAddr.String(), ServerPeerServiceNet: r.SvcPermNet.String(), - ServerPeerOption: r.SvcOption.string(), + ServerPeerOption: r.SvcOption.String(), }) } js = &json_out_server_conn{ @@ -234,7 +234,7 @@ func (ctl *server_ctl_server_conns_id_routes) ServeHTTP(w http.ResponseWriter, r ClientPeerName: r.PtcName, ServerPeerServiceAddr: r.SvcAddr.String(), ServerPeerServiceNet: r.SvcPermNet.String(), - ServerPeerOption: r.SvcOption.string(), + ServerPeerOption: r.SvcOption.String(), }) } cts.route_mtx.Unlock() @@ -319,7 +319,7 @@ func (ctl *server_ctl_server_conns_id_routes_id) ServeHTTP(w http.ResponseWriter ClientPeerName: r.PtcName, ServerPeerServiceAddr: r.SvcAddr.String(), ServerPeerServiceNet: r.SvcPermNet.String(), - ServerPeerOption: r.SvcOption.string(), + ServerPeerOption: r.SvcOption.String(), }) if err != nil { goto oops } diff --git a/server.go b/server.go index 2bf4ca0..3e7c9fe 100644 --- a/server.go +++ b/server.go @@ -381,7 +381,7 @@ func (cts *ServerConn) make_route_listener(id RouteId, option RouteOption, svc_r svcaddr = &net.TCPAddr{IP: net.IPv6zero, Port: 0} } } else { - return nil, nil, fmt.Errorf("invalid route option value %d(%s)", option, option.string()) + return nil, nil, fmt.Errorf("invalid route option value %d(%s)", option, option.String()) } l, err = net.ListenTCP(nw, svcaddr) // make the binding address configurable. support multiple binding addresses???