Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gives preference to IPv4 when connecting to Sequencer's feed #2650

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading