Skip to content

IPRestrictionRules

reference
1 min readUpdated

Kind: Interface

Source: src/middleware/ip-restriction/index.ts

Part of: Middleware

Rules for IP Restriction Middleware

IPRestrictionRules defines the allow and deny rule collections used by IP Restriction Middleware. The middleware reads allowList and denyList to determine whether an incoming IP address matches a restriction rule.

Properties

PropertyType
denyListIPRestrictionRule[]
allowListIPRestrictionRule[]

Diagram

mermaid
graph LR
  Rules[IPRestrictionRules]
  Allow[allowList: IPRestrictionRule[]]
  Deny[denyList: IPRestrictionRule[]]
  Rule[IPRestrictionRule]

  Rules --> Allow
  Rules --> Deny
  Allow --> Rule
  Deny --> Rule

Usage

ts
import type { IPRestrictionRules } from "./middleware/ip-restriction";

const rules: IPRestrictionRules = {
  allowList: [],
  denyList: [],
};

// Pass `rules` to the IP Restriction Middleware configuration.

AI Coding Instructions

  • Keep both allowList and denyList present when creating an IPRestrictionRules object.
  • Store only IPRestrictionRule entries in each list.
  • Check middleware behavior when an IP matches entries in both lists.
  • Keep rule construction consistent with the IPRestrictionRule type.

Was this page helpful?

Download as PDF
IPRestrictionRules — Hono (narrator proof)