renamed tcp_addr_str_class to TcpAddrStrClass

This commit is contained in:
hyung-hwan 2025-01-08 17:32:40 +09:00
parent 13faadabcd
commit 26c40ea70e
5 changed files with 14 additions and 14 deletions

View File

@ -409,7 +409,7 @@ func (ctl *client_ctl_client_conns_id_routes) ServeHTTP(w http.ResponseWriter, r
if jcr.ClientPeerAddr == "" {
status_code = http.StatusBadRequest; w.WriteHeader(status_code)
err = fmt.Errorf("blank client-peer-addr")
goto oops;
goto oops
}
server_peer_option = string_to_route_option(jcr.ServerPeerOption)

View File

@ -181,7 +181,7 @@ func NewClientRoute(cts *ClientConn, id RouteId, client_peer_addr string, client
r.peer_addr = client_peer_addr // client-side peer
r.peer_name = client_peer_name
// if the client_peer_addr is a domain name, it can't tell between tcp4 and tcp6
r.peer_option = string_to_route_option(tcp_addr_str_class(client_peer_addr))
r.peer_option = string_to_route_option(TcpAddrStrClass(client_peer_addr))
r.server_peer_addr = server_peer_svc_addr
r.server_peer_net = server_peer_svc_net // permitted network for server-side peer
@ -1211,7 +1211,7 @@ func NewClient(ctx context.Context, logger Logger, ctl_addrs []string, ctl_prefi
c.ctl = make([]*http.Server, len(ctl_addrs))
copy(c.ctl_addr, ctl_addrs)
hs_log = log.New(&client_ctl_log_writer{cli: &c}, "", 0);
hs_log = log.New(&client_ctl_log_writer{cli: &c}, "", 0)
for i = 0; i < len(ctl_addrs); i++ {
c.ctl[i] = &http.Server{
@ -1449,7 +1449,7 @@ func (c *Client) RunCtlTask(wg *sync.WaitGroup) {
if c.stop_req.Load() == false {
// this guard has a flaw in that the stop request can be made
// between the check above and net.Listen() below.
l, err = net.Listen(tcp_addr_str_class(cs.Addr), cs.Addr)
l, err = net.Listen(TcpAddrStrClass(cs.Addr), cs.Addr)
if err == nil {
if c.stop_req.Load() == false {
// check it again to make the guard slightly more stable

View File

@ -43,7 +43,7 @@ type Service interface {
WriteLog(id string, level LogLevel, fmtstr string, args ...interface{})
}
func tcp_addr_str_class(addr string) string {
func TcpAddrStrClass(addr string) string {
// the string is supposed to be addr:port
if len(addr) > 0 {

View File

@ -494,8 +494,8 @@ func (pxy *server_proxy_xterm_file) ServeHTTP(w http.ResponseWriter, req *http.R
case "_redirect":
// shorthand for /_ssh/{conn_id}/_/
// don't care about parameters following the path
status_code = http.StatusMovedPermanently;
w.Header().Set("Location", req.URL.Path + "_/");
status_code = http.StatusMovedPermanently
w.Header().Set("Location", req.URL.Path + "_/")
w.WriteHeader(status_code)
case "_forbidden":
status_code = http.StatusForbidden; w.WriteHeader(status_code)
@ -563,7 +563,7 @@ func (pxy *server_proxy_ssh_ws) connect_ssh (ctx context.Context, username strin
}
*/
addr = svc_addr_to_dst_addr(r.SvcAddr);
addr = svc_addr_to_dst_addr(r.SvcAddr)
dialer = &net.Dialer{}
conn, err = dialer.DialContext(ctx, "tcp", addr.String())

View File

@ -1015,7 +1015,7 @@ func NewServer(ctx context.Context, logger Logger, ctl_addrs []string, rpc_addrs
// ---------------------------------------------------------
hs_log = log.New(&server_http_log_writer{svr: &s}, "", 0);
hs_log = log.New(&server_http_log_writer{svr: &s}, "", 0)
// ---------------------------------------------------------
@ -1212,7 +1212,7 @@ func (s *Server) RunCtlTask(wg *sync.WaitGroup) {
// defeat hard-coded "tcp" in ListenAndServe() and ListenAndServeTLS()
// err = cs.ListenAndServe()
// err = cs.ListenAndServeTLS("", "")
l, err = net.Listen(tcp_addr_str_class(cs.Addr), cs.Addr)
l, err = net.Listen(TcpAddrStrClass(cs.Addr), cs.Addr)
if err == nil {
if s.stop_req.Load() == false {
if s.ctltlscfg == nil {
@ -1255,7 +1255,7 @@ func (s *Server) RunPxyTask(wg *sync.WaitGroup) {
s.log.Write("", LOG_INFO, "Proxy channel[%d] started on %s", i, s.pxy_addr[i])
if s.stop_req.Load() == false {
l, err = net.Listen(tcp_addr_str_class(cs.Addr), cs.Addr)
l, err = net.Listen(TcpAddrStrClass(cs.Addr), cs.Addr)
if err == nil {
if s.stop_req.Load() == false {
if s.pxytlscfg == nil { // TODO: change this
@ -1298,7 +1298,7 @@ func (s *Server) RunWpxTask(wg *sync.WaitGroup) {
s.log.Write("", LOG_INFO, "Wpx channel[%d] started on %s", i, s.wpx_addr[i])
if s.stop_req.Load() == false {
l, err = net.Listen(tcp_addr_str_class(cs.Addr), cs.Addr)
l, err = net.Listen(TcpAddrStrClass(cs.Addr), cs.Addr)
if err == nil {
if s.stop_req.Load() == false {
if s.wpxtlscfg == nil { // TODO: change this
@ -1392,7 +1392,7 @@ func (s *Server) AddNewServerConn(remote_addr *net.Addr, local_addr *net.Addr, p
_, ok = s.cts_map[s.cts_next_id]
if !ok {
assigned_id = s.cts_next_id
s.cts_next_id++;
s.cts_next_id++
if s.cts_next_id == 0 { s.cts_next_id++ }
break
}
@ -1412,7 +1412,7 @@ func (s *Server) AddNewServerConn(remote_addr *net.Addr, local_addr *net.Addr, p
return nil, fmt.Errorf("existing client - %s", cts.RemoteAddr.String())
}
s.cts_map_by_addr[cts.RemoteAddr] = &cts
s.cts_map[cts.Id] = &cts;
s.cts_map[cts.Id] = &cts
s.stats.conns.Store(int64(len(s.cts_map)))
s.cts_mtx.Unlock()