update to support multiple control server addresses

This commit is contained in:
2024-12-03 11:52:46 +09:00
parent b17f3af7ad
commit d167308879
6 changed files with 181 additions and 121 deletions

View File

@ -37,7 +37,8 @@ type json_out_client_conn_id struct {
type json_out_client_conn struct {
Id uint32 `json:"id"`
ServerAddr string `json:"server-addr"`
ReqServerAddr string `json:"req-server-addr"` // server address requested. may be a domain name
ServerAddr string `json:"server-addr"` // actual server address
ClientAddr string `json:"client-addr"`
Routes []json_out_client_route `json:"routes"`
}
@ -126,6 +127,7 @@ func (ctl *client_ctl_client_conns) ServeHTTP(w http.ResponseWriter, req *http.R
}
js = append(js, json_out_client_conn{
Id: cts.id,
ReqServerAddr: cts.cfg.ServerAddr,
ServerAddr: cts.remote_addr,
ClientAddr: cts.local_addr,
Routes: jsp,
@ -233,7 +235,13 @@ func (ctl *client_ctl_client_conns_id) ServeHTTP(w http.ResponseWriter, req *htt
ServerPeerListenAddr: r.server_peer_listen_addr.String(),
})
}
js = &json_out_client_conn{Id: cts.id, ServerAddr: cts.local_addr, ClientAddr: cts.remote_addr, Routes: jsp}
js = &json_out_client_conn{
Id: cts.id,
ReqServerAddr: cts.cfg.ServerAddr,
ServerAddr: cts.local_addr,
ClientAddr: cts.remote_addr,
Routes: jsp,
}
cts.route_mtx.Unlock()
status_code = http.StatusOK; w.WriteHeader(status_code)