diff --git a/connmgr/manager.go b/connmgr/manager.go index 1e64e7943bd343fb5dfe22e83c7f22056de7928e..223dcdf5560f622e5eca271dcf8d183d8ceda277 100644 --- a/connmgr/manager.go +++ b/connmgr/manager.go @@ -70,6 +70,10 @@ type ConnManager interface { // See notes on Protect() for more info. Unprotect(id peer.ID, tag string) (protected bool) + // IsProtected returns true if the peer is protected for some tag; if the tag is the empty string + // then it will return true if the peer is protected for any tag + IsProtected(id peer.ID, tag string) (protected bool) + // Close closes the connection manager and stops background processes. Close() error } diff --git a/connmgr/null.go b/connmgr/null.go index 473af3289524059385b3145ef6aa38ba5b1a209c..2de861c3b14e29d1216edaad9bef0efa1046a643 100644 --- a/connmgr/null.go +++ b/connmgr/null.go @@ -20,4 +20,5 @@ func (_ NullConnMgr) TrimOpenConns(ctx context.Context) {} func (_ NullConnMgr) Notifee() network.Notifiee { return network.GlobalNoopNotifiee } func (_ NullConnMgr) Protect(peer.ID, string) {} func (_ NullConnMgr) Unprotect(peer.ID, string) bool { return false } +func (_ NullConnMgr) IsProtected(peer.ID, string) bool { return false } func (_ NullConnMgr) Close() error { return nil }