mirror of
https://github.com/db9979/tiefenkontakt.git
synced 2026-12-05 12:24:12 +01:00
- Escorts: bridge lookouts (periscope feather, snorkel, surfaced boats, torpedo tracks), spoken sighting reports, 3D bridge station with binoculars and own foredeck, lookout hit inset - 3D sea split into models/shaders: multi-wave ocean with whitecaps, clouds, sun and moon, detailed ships with smoke and turning radar - Radar room rebuilt as phosphor PPI with range scales, ESM rose and radar status; NATO symbols on plot, mission charts and replay - Sortable and filterable contact list, leaderboard and alert log; smoothed list bearings; clear convoy progress bar - Ops: backups, metrics, structured logs, CI, Elo ratings, private matches, corvette and coastal sub, network load test - Mail: configurable SMTP (Gmail/iCloud), signal-style HTML mails with inline sonar header, mail test command - Fixes: spoofable client IP behind proxy, phone layout and lost taps, stacked debriefs, station 5 rejected by server - Raspberry Pi deploy script and .env.example
20 lines
879 B
TypeScript
20 lines
879 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { clientIpFrom } from '../src/client-ip.js';
|
|
|
|
describe('client address behind a proxy', () => {
|
|
it('takes the address the proxy appended, not one the client made up', () => {
|
|
// Client sent "X-Forwarded-For: 6.6.6.6", nginx appended the real address
|
|
expect(clientIpFrom('6.6.6.6, 84.10.20.30', '172.18.0.1', '1')).toBe('84.10.20.30');
|
|
expect(clientIpFrom('84.10.20.30', '172.18.0.1', '1')).toBe('84.10.20.30');
|
|
});
|
|
|
|
it('two proxies: the second entry from the right', () => {
|
|
expect(clientIpFrom('6.6.6.6, 84.10.20.30, 10.0.0.2', '10.0.0.3', '2')).toBe('84.10.20.30');
|
|
});
|
|
|
|
it('without TRUST_PROXY the header is ignored', () => {
|
|
expect(clientIpFrom('6.6.6.6', '84.10.20.30', undefined)).toBe('84.10.20.30');
|
|
expect(clientIpFrom(undefined, '84.10.20.30', '1')).toBe('84.10.20.30');
|
|
});
|
|
});
|