From 147fae51036afb9f59de50d7ab38331ddeccb58a Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 9 Nov 2022 10:05:07 +0000 Subject: [PATCH] remove deprecated StaticRelays option --- options.go | 12 ------------ p2p/protocol/holepunch/holepunch_test.go | 6 ++++-- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/options.go b/options.go index 9007d613f8..aac6146980 100644 --- a/options.go +++ b/options.go @@ -16,7 +16,6 @@ import ( "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/metrics" "github.com/libp2p/go-libp2p/core/network" - "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/peerstore" "github.com/libp2p/go-libp2p/core/pnet" "github.com/libp2p/go-libp2p/core/protocol" @@ -303,17 +302,6 @@ func EnableAutoRelay(opts ...autorelay.Option) Option { } } -// StaticRelays configures known relays for autorelay; when this option is enabled -// then the system will use the configured relays instead of querying the DHT to -// discover relays. -// Deprecated: pass an autorelay.WithStaticRelays option to EnableAutoRelay. -func StaticRelays(relays []peer.AddrInfo) Option { - return func(cfg *Config) error { - cfg.AutoRelayOpts = append(cfg.AutoRelayOpts, autorelay.WithStaticRelays(relays)) - return nil - } -} - // 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/protocol/holepunch/holepunch_test.go b/p2p/protocol/holepunch/holepunch_test.go index 5c364ff013..5676935108 100644 --- a/p2p/protocol/holepunch/holepunch_test.go +++ b/p2p/protocol/holepunch/holepunch_test.go @@ -359,9 +359,11 @@ func mkHostWithStaticAutoRelay(t *testing.T, relay host.Host) host.Host { h, err := libp2p.New( libp2p.ListenAddrs(ma.StringCast("/ip4/127.0.0.1/tcp/0")), libp2p.EnableRelay(), - libp2p.EnableAutoRelay(autorelay.WithCircuitV1Support()), + libp2p.EnableAutoRelay( + autorelay.WithCircuitV1Support(), + autorelay.WithStaticRelays([]peer.AddrInfo{pi}), + ), libp2p.ForceReachabilityPrivate(), - libp2p.StaticRelays([]peer.AddrInfo{pi}), ) require.NoError(t, err)