Skip to content

distinctRemoteAddr

reference
1 min readUpdated

Kind: Function

Source: src/utils/ipaddr.ts

Part of: Utils

Distinct Remote Addr

distinctRemoteAddr derives a distinct remote-address value from the address data passed to it. It belongs to the IP-address utility layer and centralizes remote-address handling for callers that need a consistent value.

Signature

ts
function distinctRemoteAddr(remoteAddr: string): AddressType

Parameters

NameType
remoteAddrstring

Returns: AddressType

Diagram

mermaid
graph LR
  Input[Remote address data] --> Function[distinctRemoteAddr]
  Function --> Output[Distinct remote address]

Usage

ts
import { distinctRemoteAddr } from "./utils/ipaddr";

const remoteAddress = request.socket.remoteAddress;
const address = distinctRemoteAddr(remoteAddress);

if (address) {
  auditLog({ remoteAddress: address });
}

AI Coding Instructions

  • Keep remote-address parsing and normalization inside src/utils/ipaddr.ts.
  • Pass the address value in the format expected by distinctRemoteAddr.
  • Check the returned value before using it in logs, access checks, or storage.
  • Do not duplicate remote-address handling logic at call sites.

Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (1)

  • IPRestrictionRulesrc/middleware/ip-restriction/index.ts:38

Was this page helpful?

Download as PDF
distinctRemoteAddr — Hono (narrator proof)