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

autorelay: remove the default static relay option #1867

Merged
merged 1 commit into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
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
14 changes: 0 additions & 14 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,20 +270,6 @@ func StaticRelays(relays []peer.AddrInfo) Option {
}
}

// DefaultStaticRelays configures the static relays to use the known PL-operated relays.
// Deprecated: pass autorelay.WithDefaultStaticRelays to EnableAutoRelay.
func DefaultStaticRelays() Option {
relays := make([]peer.AddrInfo, 0, len(autorelay.DefaultRelays))
for _, addr := range autorelay.DefaultRelays {
pi, err := peer.AddrInfoFromString(addr)
if err != nil {
panic(fmt.Sprintf("failed to initialize default static relays: %s", err))
}
relays = append(relays, *pi)
}
return StaticRelays(relays)
}

// ForceReachabilityPublic overrides automatic reachability detection in the AutoNAT subsystem,
// forcing the local node to believe it is reachable externally.
func ForceReachabilityPublic() Option {
Expand Down
27 changes: 0 additions & 27 deletions p2p/host/autorelay/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package autorelay
import (
"context"
"errors"
"fmt"
"time"

"github.com/libp2p/go-libp2p/core/peer"
Expand Down Expand Up @@ -49,28 +48,6 @@ var (
errStaticRelaysPeerSource = errors.New("cannot use WithPeerSource and WithStaticRelays")
)

// DefaultRelays are the known PL-operated v1 relays; will be decommissioned in 2022.
var DefaultRelays = []string{
"/ip4/147.75.80.110/tcp/4001/p2p/QmbFgm5zan8P6eWWmeyfncR5feYEMPbht5b1FW1C37aQ7y",
"/ip4/147.75.80.110/udp/4001/quic/p2p/QmbFgm5zan8P6eWWmeyfncR5feYEMPbht5b1FW1C37aQ7y",
"/ip4/147.75.195.153/tcp/4001/p2p/QmW9m57aiBDHAkKj9nmFSEn7ZqrcF1fZS4bipsTCHburei",
"/ip4/147.75.195.153/udp/4001/quic/p2p/QmW9m57aiBDHAkKj9nmFSEn7ZqrcF1fZS4bipsTCHburei",
"/ip4/147.75.70.221/tcp/4001/p2p/Qme8g49gm3q4Acp7xWBKg3nAa9fxZ1YmyDJdyGgoG6LsXh",
"/ip4/147.75.70.221/udp/4001/quic/p2p/Qme8g49gm3q4Acp7xWBKg3nAa9fxZ1YmyDJdyGgoG6LsXh",
}

var defaultStaticRelays []peer.AddrInfo

func init() {
for _, s := range DefaultRelays {
pi, err := peer.AddrInfoFromString(s)
if err != nil {
panic(fmt.Sprintf("failed to initialize default static relays: %s", err))
}
defaultStaticRelays = append(defaultStaticRelays, *pi)
}
}

type Option func(*config) error

func WithStaticRelays(static []peer.AddrInfo) Option {
Expand All @@ -90,10 +67,6 @@ func WithStaticRelays(static []peer.AddrInfo) Option {
}
}

func WithDefaultStaticRelays() Option {
return WithStaticRelays(defaultStaticRelays)
}

// WithPeerSource defines a callback for AutoRelay to query for more relay candidates.
// AutoRelay will call this function when it needs new candidates is connected to the desired number of
// relays, and it has enough candidates (in case we get disconnected from one of the relays).
Expand Down