[]previous and next page

addressKey

The key a rate limiter should use for an address.

The key a rate limiter should use for an address. IPv6 clients usually own a whole /64, so the key keeps only that prefix (otherwise one client could rotate through 2^64 addresses).

Import#

ts
import { addressKey } from "@shadow-js/dusk/server";

Signature#

ts
function addressKey(address: string, ipv6Prefix: 64 | 128 = 64): string

Parameters#

Name Description
address A normalized address.
ipv6Prefix Bits of an IPv6 address to keep: 64 (default) or 128.

Returns#

The key.

Examples#

ts
addressKey("2001:db8:1:2::9"); // "2001:0db8:0001:0002::/64" for a normalized address