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
tsfunction distinctRemoteAddr(remoteAddr: string): AddressType
Parameters
| Name | Type |
|---|---|
remoteAddr | string |
Returns: AddressType
Diagram
mermaidgraph LR Input[Remote address data] --> Function[distinctRemoteAddr] Function --> Output[Distinct remote address]
Usage
tsimport { 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)
IPRestrictionRule—src/middleware/ip-restriction/index.ts:38
Was this page helpful?