UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

24 lines (23 loc) • 1.24 kB
/** * The address a request is counted against. * * The TCP peer is the only address a client cannot choose, so it is the * default. `X-Forwarded-For` is read only when the operator says a reverse * proxy stands in front of the server (`trustProxy`), and then from the right: * the hops of the listed proxies are skipped and the first other entry is the * client, because a proxy appends the address it saw and anything a client put * in the header itself sits further left. * * @module server/utils/clientAddress */ import type { ServerClientAddressInput } from "../../types/index.js"; /** Strip an IPv4-mapped IPv6 prefix and a port, so one client has one key. */ export declare function canonicalAddress(address: string): string | undefined; /** * The client's address, or `undefined` when the runtime reports no peer and * no trusted header names one. The result is always a bare IP, so a header * holding anything else cannot become a counter key. */ export declare function resolveClientAddress(input: ServerClientAddressInput): string | undefined; /** `true` for an address only this host can reach: 127/8, `::1`, or their mapped forms. */ export declare function isLoopbackAddress(address: string | undefined): boolean;