Shared IP ban list backed by Hyperbee2, seedable over Hyperswarm.
npm install ip-ban-list
const banList = new IpBanList(store, [opts])Create a new IP ban list.
store: Corestore instanceopts.key: Hypercore public key to open an existing ban list read-only (default: null)await banList.ready()Initialize the ban list.
await banList.close()Close the ban list.
await banList.ban(ip)Ban an IP address.
ip: IP address string (e.g. '1.2.3.4')await banList.unban(ip)Remove an IP address from the ban list.
ip: IP address stringconst banned = banList.isBanned(ip)Check if an IP address is banned. Returns true or false from an
in-memory cache that is loaded on ready() and updated from Hyperbee.
banList.on('cache-updated')Emitted when the in-memory cache is updated from Hyperbee. Fires once
during ready() and after later local or replicated updates.
banList.on('cache-update-error', error)Emitted when updating the in-memory cache from Hyperbee fails.
error: Error thrown while refreshing the cachebanList.keyThe Hypercore public key for the ban list (32 bytes).
banList.discoveryKeyThe discovery key for swarming (32 bytes).
Apache-2.0