Skip to content

Commit

Permalink
Merge pull request #2650 from OffchainLabs/node_feed_ipv4
Browse files Browse the repository at this point in the history
Gives preference to IPv4 when connecting to Sequencer's feed
  • Loading branch information
PlasmaPower authored Oct 7, 2024
2 parents 79d6ec8 + 03df994 commit 2034723
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions broadcastclient/broadcastclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,18 @@ func (bc *BroadcastClient) connect(ctx context.Context, nextSeqNum arbutil.Messa
MinVersion: tls.VersionTLS12,
},
Extensions: extensions,
NetDial: func(ctx context.Context, network, addr string) (net.Conn, error) {
var netDialer net.Dialer
// For tcp connections, prefer IPv4 over IPv6 to avoid rate limiting issues
if network == "tcp" {
conn, err := netDialer.DialContext(ctx, "tcp4", addr)
if err == nil {
return conn, nil
}
return netDialer.DialContext(ctx, "tcp6", addr)
}
return netDialer.DialContext(ctx, network, addr)
},
}

if bc.isShuttingDown() {
Expand Down

0 comments on commit 2034723

Please sign in to comment.