updated code to treat ipv4inv6 as ipv4
This commit is contained in:
parent
e1eb346228
commit
c237b8a842
@ -182,7 +182,7 @@ func (ctl *client_ctl_client_conns) ServeHTTP(w http.ResponseWriter, req *http.R
|
|||||||
ClientPeerName: r.peer_name,
|
ClientPeerName: r.peer_name,
|
||||||
ServerPeerListenAddr: r.server_peer_listen_addr.String(),
|
ServerPeerListenAddr: r.server_peer_listen_addr.String(),
|
||||||
ServerPeerNet: r.server_peer_net,
|
ServerPeerNet: r.server_peer_net,
|
||||||
ServerPeerOption: r.server_peer_option.string(),
|
ServerPeerOption: r.server_peer_option.String(),
|
||||||
Lifetime: fmt.Sprintf("%.09f", r.lifetime.Seconds()),
|
Lifetime: fmt.Sprintf("%.09f", r.lifetime.Seconds()),
|
||||||
LifetimeStart: r.lifetime_start.Unix(),
|
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,
|
ClientPeerName: r.peer_name,
|
||||||
ServerPeerListenAddr: r.server_peer_listen_addr.String(),
|
ServerPeerListenAddr: r.server_peer_listen_addr.String(),
|
||||||
ServerPeerNet: r.server_peer_net,
|
ServerPeerNet: r.server_peer_net,
|
||||||
ServerPeerOption: r.server_peer_option.string(),
|
ServerPeerOption: r.server_peer_option.String(),
|
||||||
Lifetime: fmt.Sprintf("%.09f", r.lifetime.Seconds()),
|
Lifetime: fmt.Sprintf("%.09f", r.lifetime.Seconds()),
|
||||||
LifetimeStart: r.lifetime_start.Unix(),
|
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,
|
ClientPeerName: r.peer_name,
|
||||||
ServerPeerListenAddr: r.server_peer_listen_addr.String(),
|
ServerPeerListenAddr: r.server_peer_listen_addr.String(),
|
||||||
ServerPeerNet: r.server_peer_net,
|
ServerPeerNet: r.server_peer_net,
|
||||||
ServerPeerOption: r.server_peer_option.string(),
|
ServerPeerOption: r.server_peer_option.String(),
|
||||||
Lifetime: fmt.Sprintf("%.09f", r.lifetime.Seconds()),
|
Lifetime: fmt.Sprintf("%.09f", r.lifetime.Seconds()),
|
||||||
LifetimeStart: r.lifetime_start.Unix(),
|
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,
|
ClientPeerName: r.peer_name,
|
||||||
ServerPeerListenAddr: r.server_peer_listen_addr.String(),
|
ServerPeerListenAddr: r.server_peer_listen_addr.String(),
|
||||||
ServerPeerNet: r.server_peer_net,
|
ServerPeerNet: r.server_peer_net,
|
||||||
ServerPeerOption: r.server_peer_option.string(),
|
ServerPeerOption: r.server_peer_option.String(),
|
||||||
Lifetime: r.lifetime.String(),
|
Lifetime: r.lifetime.String(),
|
||||||
})
|
})
|
||||||
if err != nil { goto oops }
|
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,
|
ClientPeerName: r.peer_name,
|
||||||
ServerPeerListenAddr: r.server_peer_listen_addr.String(),
|
ServerPeerListenAddr: r.server_peer_listen_addr.String(),
|
||||||
ServerPeerNet: r.server_peer_net,
|
ServerPeerNet: r.server_peer_net,
|
||||||
ServerPeerOption: r.server_peer_option.string(),
|
ServerPeerOption: r.server_peer_option.String(),
|
||||||
Lifetime: r.lifetime.String(),
|
Lifetime: r.lifetime.String(),
|
||||||
})
|
})
|
||||||
if err != nil { goto oops }
|
if err != nil { goto oops }
|
||||||
|
8
hodu.go
8
hodu.go
@ -53,7 +53,7 @@ func TcpAddrStrClass(addr string) string {
|
|||||||
ap, err = netip.ParseAddrPort(addr)
|
ap, err = netip.ParseAddrPort(addr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if ap.Addr().Is6() { return "tcp6" }
|
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 {
|
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"
|
return "tcp4"
|
||||||
} else {
|
} else {
|
||||||
return "tcp6"
|
return "tcp6"
|
||||||
@ -103,7 +105,7 @@ func string_to_route_option(desc string) RouteOption {
|
|||||||
return option
|
return option
|
||||||
}
|
}
|
||||||
|
|
||||||
func (option RouteOption) string() string {
|
func (option RouteOption) String() string {
|
||||||
var str string
|
var str string
|
||||||
str = ""
|
str = ""
|
||||||
if option & RouteOption(ROUTE_OPTION_TCP6) != 0 { str += " tcp6" }
|
if option & RouteOption(ROUTE_OPTION_TCP6) != 0 { str += " tcp6" }
|
||||||
|
@ -102,7 +102,7 @@ func (ctl *server_ctl_server_conns) ServeHTTP(w http.ResponseWriter, req *http.R
|
|||||||
ClientPeerName: r.PtcName,
|
ClientPeerName: r.PtcName,
|
||||||
ServerPeerServiceAddr: r.SvcAddr.String(),
|
ServerPeerServiceAddr: r.SvcAddr.String(),
|
||||||
ServerPeerServiceNet: r.SvcPermNet.String(),
|
ServerPeerServiceNet: r.SvcPermNet.String(),
|
||||||
ServerPeerOption: r.SvcOption.string(),
|
ServerPeerOption: r.SvcOption.String(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
js = append(js, json_out_server_conn{
|
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,
|
ClientPeerName: r.PtcName,
|
||||||
ServerPeerServiceAddr: r.SvcAddr.String(),
|
ServerPeerServiceAddr: r.SvcAddr.String(),
|
||||||
ServerPeerServiceNet: r.SvcPermNet.String(),
|
ServerPeerServiceNet: r.SvcPermNet.String(),
|
||||||
ServerPeerOption: r.SvcOption.string(),
|
ServerPeerOption: r.SvcOption.String(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
js = &json_out_server_conn{
|
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,
|
ClientPeerName: r.PtcName,
|
||||||
ServerPeerServiceAddr: r.SvcAddr.String(),
|
ServerPeerServiceAddr: r.SvcAddr.String(),
|
||||||
ServerPeerServiceNet: r.SvcPermNet.String(),
|
ServerPeerServiceNet: r.SvcPermNet.String(),
|
||||||
ServerPeerOption: r.SvcOption.string(),
|
ServerPeerOption: r.SvcOption.String(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
cts.route_mtx.Unlock()
|
cts.route_mtx.Unlock()
|
||||||
@ -319,7 +319,7 @@ func (ctl *server_ctl_server_conns_id_routes_id) ServeHTTP(w http.ResponseWriter
|
|||||||
ClientPeerName: r.PtcName,
|
ClientPeerName: r.PtcName,
|
||||||
ServerPeerServiceAddr: r.SvcAddr.String(),
|
ServerPeerServiceAddr: r.SvcAddr.String(),
|
||||||
ServerPeerServiceNet: r.SvcPermNet.String(),
|
ServerPeerServiceNet: r.SvcPermNet.String(),
|
||||||
ServerPeerOption: r.SvcOption.string(),
|
ServerPeerOption: r.SvcOption.String(),
|
||||||
})
|
})
|
||||||
if err != nil { goto oops }
|
if err != nil { goto oops }
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ func (cts *ServerConn) make_route_listener(id RouteId, option RouteOption, svc_r
|
|||||||
svcaddr = &net.TCPAddr{IP: net.IPv6zero, Port: 0}
|
svcaddr = &net.TCPAddr{IP: net.IPv6zero, Port: 0}
|
||||||
}
|
}
|
||||||
} else {
|
} 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???
|
l, err = net.ListenTCP(nw, svcaddr) // make the binding address configurable. support multiple binding addresses???
|
||||||
|
Loading…
x
Reference in New Issue
Block a user