Add GetAllowlist()

This commit is contained in:
Marco Munizaga 2022-06-27 15:42:00 -07:00
parent 2bb066a2ce
commit 8c5643aa2f
2 changed files with 5 additions and 1 deletions

View File

@ -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)
}

View File

@ -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()))