mirror of
https://github.com/libp2p/go-libp2p-resource-manager.git
synced 2025-03-10 09:10:38 +08:00
Add GetAllowlist()
This commit is contained in:
parent
2bb066a2ce
commit
8c5643aa2f
4
rcmgr.go
4
rcmgr.go
@ -162,6 +162,10 @@ func NewResourceManager(limits Limiter, opts ...Option) (network.ResourceManager
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func (r *resourceManager) GetAllowlist() *Allowlist {
|
||||
return r.allowlist
|
||||
}
|
||||
|
||||
func (r *resourceManager) ViewSystem(f func(network.ResourceScope) error) error {
|
||||
return f(r.system)
|
||||
}
|
||||
|
@ -1022,7 +1022,7 @@ func TestResourceManagerWithAllowlist(t *testing.T) {
|
||||
r.allowlistedSystem.IncRef()
|
||||
r.allowlistedTransient = newTransientScope(limits.GetTransientLimits().WithConnLimit(1, 1, 1), r, "allowlistedTransient", r.allowlistedSystem.resourceScope)
|
||||
r.allowlistedTransient.IncRef()
|
||||
allowlist := r.allowlist
|
||||
allowlist := r.GetAllowlist()
|
||||
|
||||
allowlist.Add(multiaddr.StringCast("/ip4/1.2.3.4"))
|
||||
allowlist.Add(multiaddr.StringCast("/ip4/4.3.2.1/p2p/" + peerA.String()))
|
||||
|
Loading…
Reference in New Issue
Block a user