From 467e6df68c46ca5143a541442ab5f1ca3aaf9235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Emre=20Kabakc=C4=B1?= Date: Wed, 13 May 2026 15:46:30 +0100 Subject: [PATCH] fix(server): remove duplicate getClientIp export in rate-limiter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #694 restored the helper, but the merge of #693 left an earlier copy intact — esbuild errors out on `Multiple exports with the same name "getClientIp"` in src/gateway/utils/rate-limiter.ts, breaking `make build-packages` on main (typecheck + integration CI jobs cascade from there). Drop the older un-documented copy; keep the JSDoc'd one. No behavior change — the two implementations were functionally identical. --- .../server/src/gateway/utils/rate-limiter.ts | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/packages/server/src/gateway/utils/rate-limiter.ts b/packages/server/src/gateway/utils/rate-limiter.ts index 058fcc8e3..f161fafc5 100644 --- a/packages/server/src/gateway/utils/rate-limiter.ts +++ b/packages/server/src/gateway/utils/rate-limiter.ts @@ -1,22 +1,5 @@ import { getDb } from "../../db/client.js"; -export function getClientIp(headers: { - forwardedFor?: string; - realIp?: string; -}): string { - const forwarded = headers.forwardedFor?.split(",")[0]?.trim().toLowerCase(); - if (forwarded) { - return forwarded; - } - - const realIp = headers.realIp?.trim().toLowerCase(); - if (realIp) { - return realIp; - } - - return "unknown"; -} - /** * Extract the client IP for rate-limit / abuse-tracking purposes from the * inbound proxy headers. Prefers the first hop in `x-forwarded-for`, falling