security: use net.JoinHostPort instead of fmt.Sprintf
Some checks failed
Benchmark GC Performance / benchmark (push) Successful in 1m19s
Run Gosec / tests (push) Successful in 48s
Go Revive Lint / lint (push) Successful in 34s
Go Build Multi-Platform / build (amd64, darwin) (push) Failing after 31s
Go Build Multi-Platform / build (amd64, windows) (push) Failing after 34s
Go Build Multi-Platform / build (arm, freebsd) (push) Failing after 29s
Go Build Multi-Platform / build (arm, linux) (push) Failing after 27s
Go Build Multi-Platform / Create Release (push) Has been skipped
Go Test Multi-Platform / Test (ubuntu-latest, arm64) (push) Successful in 48s
Go Test Multi-Platform / Test (ubuntu-latest, amd64) (push) Successful in 1m28s
Go Build Multi-Platform / build (amd64, freebsd) (push) Failing after 27s
Go Build Multi-Platform / build (amd64, linux) (push) Failing after 27s
Go Build Multi-Platform / build (arm, windows) (push) Failing after 27s
Go Build Multi-Platform / build (arm64, darwin) (push) Failing after 27s
Go Build Multi-Platform / build (arm64, freebsd) (push) Failing after 27s
Performance Monitor / performance-monitor (push) Successful in 2m40s
Go Build Multi-Platform / build (arm64, windows) (push) Failing after 25s
Go Build Multi-Platform / build (arm64, linux) (push) Failing after 27s
Go Test Multi-Platform / Test (macos-latest, amd64) (push) Has been cancelled
Go Test Multi-Platform / Test (windows-latest, amd64) (push) Has been cancelled
Go Test Multi-Platform / Test (macos-latest, arm64) (push) Has been cancelled

This commit is contained in:
2025-11-09 00:05:36 -06:00
parent 22fc5093db
commit f097bb3241

View File

@@ -333,7 +333,7 @@ func (tc *TCPClientInterface) reconnect() {
// Log reconnection attempt
fmt.Printf("Failed to reconnect to %s (attempt %d/%d): %v\n",
addr, retries+1, tc.maxReconnectTries, err)
net.JoinHostPort(tc.targetAddr, fmt.Sprintf("%d", tc.targetPort)), retries+1, tc.maxReconnectTries, err)
// Wait with exponential backoff
time.Sleep(backoff)
@@ -354,7 +354,7 @@ func (tc *TCPClientInterface) reconnect() {
// If we've exhausted all retries, perform final teardown
tc.teardown()
fmt.Printf("Failed to reconnect to %s after %d attempts\n",
fmt.Sprintf("%s:%d", tc.targetAddr, tc.targetPort), tc.maxReconnectTries)
net.JoinHostPort(tc.targetAddr, fmt.Sprintf("%d", tc.targetPort)), tc.maxReconnectTries)
}
func (tc *TCPClientInterface) Enable() {
@@ -562,7 +562,7 @@ func (ts *TCPServerInterface) Start() error {
ts.mutex.Lock()
defer ts.mutex.Unlock()
addr := fmt.Sprintf("%s:%d", ts.bindAddr, ts.bindPort)
addr := net.JoinHostPort(ts.bindAddr, fmt.Sprintf("%d", ts.bindPort))
listener, err := net.Listen("tcp", addr)
if err != nil {
return fmt.Errorf("failed to start TCP server: %w", err)