null.go 984 Bytes
Newer Older
1 2 3 4 5
package connmgr

import (
	"context"

tavit ohanian's avatar
tavit ohanian committed
6 7
	"gitlab.dms3.io/p2p/go-p2p-core/network"
	"gitlab.dms3.io/p2p/go-p2p-core/peer"
8 9 10 11 12 13 14
)

// NullConnMgr is a ConnMgr that provides no functionality.
type NullConnMgr struct{}

var _ ConnManager = (*NullConnMgr)(nil)

Marten Seemann's avatar
Marten Seemann committed
15 16 17 18 19 20 21 22 23 24
func (NullConnMgr) TagPeer(peer.ID, string, int)             {}
func (NullConnMgr) UntagPeer(peer.ID, string)                {}
func (NullConnMgr) UpsertTag(peer.ID, string, func(int) int) {}
func (NullConnMgr) GetTagInfo(peer.ID) *TagInfo              { return &TagInfo{} }
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 }