feat(platform): add Discord onboarding and Velocity gate

This commit is contained in:
dmg
2026-08-01 13:45:18 -04:00
parent 9d305e5dc9
commit c5de0a1810
80 changed files with 4840 additions and 1572 deletions
+30
View File
@@ -0,0 +1,30 @@
import { isIP } from "node:net";
export type IpClassification = "unknown" | "clear" | "vpn" | "proxy" | "hosting" | "tor";
export interface IpIntelligenceResult {
classification: IpClassification;
provider: string | null;
rawResponse?: Record<string, unknown>;
}
export interface IpIntelligenceProvider {
classify(ipAddress: string): Promise<IpIntelligenceResult>;
}
export class NoopIpIntelligenceProvider implements IpIntelligenceProvider {
async classify(_ipAddress: string): Promise<IpIntelligenceResult> {
return { classification: "unknown", provider: null };
}
}
export function getClientIp(headers: Headers, trustProxy: boolean) {
if (!trustProxy) return null;
const candidate =
headers.get("x-forwarded-for")?.split(",")[0]?.trim() ||
headers.get("x-real-ip")?.trim() ||
null;
return candidate && isIP(candidate) ? candidate : null;
}