ax(node): rename u to peerURL in Transport.Connect
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

Single-letter variable name violates AX Principle 1 (predictable names
over short names). peerURL is self-describing without requiring context.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 11:26:37 +01:00
parent d4cf8e5e3d
commit d400946352
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -319,13 +319,13 @@ func (t *Transport) Connect(peer *Peer) (*PeerConnection, error) {
if t.config.TLSCertPath != "" {
scheme = "wss"
}
u := url.URL{Scheme: scheme, Host: peer.Address, Path: t.config.WSPath}
peerURL := url.URL{Scheme: scheme, Host: peer.Address, Path: t.config.WSPath}
// Dial the peer with timeout to prevent hanging on unresponsive peers
dialer := websocket.Dialer{
HandshakeTimeout: 10 * time.Second,
}
conn, _, err := dialer.Dial(u.String(), nil)
conn, _, err := dialer.Dial(peerURL.String(), nil)
if err != nil {
return nil, fmt.Errorf("failed to connect to peer: %w", err)
}