Browse Source

Add GetAllowlist()

pull/1677/head
Marco Munizaga 2 years ago
parent
commit
a4d311454f
  1. 4
      p2p/host/resource-manager/rcmgr.go
  2. 2
      p2p/host/resource-manager/rcmgr_test.go

4
p2p/host/resource-manager/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)
}

2
p2p/host/resource-manager/rcmgr_test.go

@ -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…
Cancel
Save