ship it with all
This commit is contained in:
parent
1e2e25650d
commit
60c76f1d55
2 changed files with 15 additions and 4 deletions
|
|
@ -77,6 +77,13 @@ export async function randomHandler(): Promise<ApiResponse | { message: string }
|
||||||
return cachedResults[randomIndex];
|
return cachedResults[randomIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function allHandler(): Promise<string[] | { message: string }> {
|
||||||
|
if (cachedResults.length === 0) {
|
||||||
|
return { message: 'No data yet' };
|
||||||
|
}
|
||||||
|
return cachedResults.map(result => result.clientIP);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detailed debug endpoint with all possible headers
|
* Detailed debug endpoint with all possible headers
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@ import { FastifyInstance } from 'fastify';
|
||||||
import {
|
import {
|
||||||
healthHandler,
|
healthHandler,
|
||||||
mainHandler,
|
mainHandler,
|
||||||
randomHandler,
|
randomHandler,
|
||||||
|
allHandler,
|
||||||
detailedDebugHandler
|
detailedDebugHandler
|
||||||
} from './handlers';
|
} from './handlers';
|
||||||
|
|
||||||
|
|
@ -20,9 +21,12 @@ export async function registerRoutes(fastify: FastifyInstance) {
|
||||||
// Detailed debug endpoint (bypasses authentication)
|
// Detailed debug endpoint (bypasses authentication)
|
||||||
fastify.get('/ip-debug-detailed', detailedDebugHandler);
|
fastify.get('/ip-debug-detailed', detailedDebugHandler);
|
||||||
|
|
||||||
// Main detection endpoint - extracts all IPs from headers
|
|
||||||
fastify.get('/', mainHandler);
|
|
||||||
|
|
||||||
// Random endpoint for testing
|
// Random endpoint for testing
|
||||||
fastify.get('/random', randomHandler);
|
fastify.get('/random', randomHandler);
|
||||||
|
|
||||||
|
// All endpoint for testing
|
||||||
|
fastify.get('/all', allHandler);
|
||||||
|
|
||||||
|
// Main detection endpoint - extracts all IPs from headers
|
||||||
|
fastify.get('/', mainHandler);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue