From bdb840fba25c6b15c41862a00c0d813cb29d686d Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Fri, 11 Nov 2022 07:30:49 +0000 Subject: [PATCH] autorelay: remove the default static relay option (#1867) These relays were decomissioned recently. --- options.go | 14 -------------- p2p/host/autorelay/options.go | 27 --------------------------- 2 files changed, 41 deletions(-) diff --git a/options.go b/options.go index 440427ae..9007d613 100644 --- a/options.go +++ b/options.go @@ -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 { diff --git a/p2p/host/autorelay/options.go b/p2p/host/autorelay/options.go index a6e9f595..2cfaf0b5 100644 --- a/p2p/host/autorelay/options.go +++ b/p2p/host/autorelay/options.go @@ -3,7 +3,6 @@ package autorelay import ( "context" "errors" - "fmt" "time" "github.com/libp2p/go-libp2p/core/peer" @@ -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 { @@ -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).