MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / ipHook

Function ipHook

apps/api/src/hooks/ip.hook.ts:4–14  ·  view source on GitHub ↗
(request: FastifyRequest)

Source from the content-addressed store, hash-verified

2import type { FastifyRequest } from 'fastify';
3
4export async function ipHook(request: FastifyRequest) {
5 const { ip, header } = getClientIpFromHeaders(request.headers);
6
7 if (ip) {
8 request.clientIp = ip;
9 request.clientIpHeader = header;
10 } else {
11 request.clientIp = '';
12 request.clientIpHeader = '';
13 }
14}

Callers

nothing calls this directly

Calls 1

getClientIpFromHeadersFunction · 0.90

Tested by

no test coverage detected