mirror of
https://github.com/sussy-code/sudo-proxy.git
synced 2026-04-20 16:32:04 +00:00
Finish ip fetching
This commit is contained in:
parent
ed4d8826ce
commit
9ef1467ee1
2 changed files with 10 additions and 2 deletions
|
|
@ -11,6 +11,9 @@ Read the docs at https://docs.movie-web.app/proxy
|
||||||
- bypass CORS - always allows browser to send requests through it
|
- bypass CORS - always allows browser to send requests through it
|
||||||
- secure it with turnstile - prevent bots from using your proxy
|
- secure it with turnstile - prevent bots from using your proxy
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> Turnstile integration only works properly with cloudflare workers as platform
|
||||||
|
|
||||||
### supported platforms:
|
### supported platforms:
|
||||||
- cloudflare workers
|
- cloudflare workers
|
||||||
- AWS lambda
|
- AWS lambda
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
import { EventHandlerRequest, H3Event } from 'h3';
|
import { EventHandlerRequest, H3Event } from 'h3';
|
||||||
|
|
||||||
export function getIp(_event: H3Event<EventHandlerRequest>) {
|
export function getIp(event: H3Event<EventHandlerRequest>) {
|
||||||
return 'not-a-real-ip'; // TODO cross platform IP
|
const value = getHeader(event, 'CF-Connecting-IP');
|
||||||
|
if (!value)
|
||||||
|
throw new Error(
|
||||||
|
'Ip header not found, turnstile only works on cloudflare workers',
|
||||||
|
);
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue