ax(node): rename u to peerURL in Transport.Connect
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:
parent
d4cf8e5e3d
commit
d400946352
1 changed files with 2 additions and 2 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue