Skip to content

Commit

Permalink
autorelay: remove the default static relay option (#1867)
Browse files Browse the repository at this point in the history
These relays were decomissioned recently.
  • Loading branch information
marten-seemann authored Nov 11, 2022
1 parent 8a43c6b commit bdb840f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 41 deletions.
14 changes: 0 additions & 14 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,20 +314,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

0 comments on commit bdb840f

Please sign in to comment.