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
+27
View File
@@ -0,0 +1,27 @@
import { describe, expect, it } from "vitest";
import { getClientIp, NoopIpIntelligenceProvider } from "../src/index";
describe("client IP extraction", () => {
it("ignores spoofable forwarding headers unless a trusted proxy is configured", () => {
const headers = new Headers({ "x-forwarded-for": "203.0.113.1" });
expect(getClientIp(headers, false)).toBeNull();
});
it("uses the first valid address supplied by a trusted proxy", () => {
const headers = new Headers({ "x-forwarded-for": "203.0.113.1, 10.0.0.2" });
expect(getClientIp(headers, true)).toBe("203.0.113.1");
});
it("rejects malformed proxy values", () => {
expect(getClientIp(new Headers({ "x-forwarded-for": "not-an-ip" }), true)).toBeNull();
});
});
describe("VPN intelligence", () => {
it("explicitly reports unknown when no provider is configured", async () => {
await expect(new NoopIpIntelligenceProvider().classify("203.0.113.1")).resolves.toEqual({
classification: "unknown",
provider: null,
});
});
});