mirror of
https://github.com/aculix/ticket-monitoring.git
synced 2026-10-27 07:15:51 +00:00
fix: make the SOCKS5 proxy work for BookMyShow too
BookMyShow blocks datacenter IPs on top of TLS fingerprinting, confirmed by CI runners getting 403 with a working impersonation, so cloud hosts need the proxy for BMS as well as District. impit resolves DNS locally for socks5:// and hands an IPv6-only exit an unreachable IPv4 address, so the scheme is normalized to socks5h://. Verified end to end: a proxied BMS check returns 200 and alerts. Docs said the proxy did nothing for BookMyShow, which was wrong.
This commit is contained in:
1 parent
608221fe18
commit
5f86252df1
4 files changed
+28
-13
No files matched your search
+5
-3
@@ -33,9 +33,11 @@ function writeState(cfg, state) {
|
||||
|
||||
/**
|
||||
* Routes provider requests through a SOCKS5 proxy. Notifications stay direct, so the
|
||||
* alerting path never depends on the proxy. District needs this on datacenter hosts whose
|
||||
* IP the WAF blocks. It does nothing for BookMyShow, which blocks on TLS fingerprint
|
||||
* rather than IP; impit handles that instead.
|
||||
* alerting path never depends on the proxy.
|
||||
*
|
||||
* Both sites block datacenter IPs, so a cloud host generally needs this for both. It is
|
||||
* only half the story for BookMyShow, which also blocks on TLS fingerprint: impit deals
|
||||
* with the fingerprint, the proxy deals with the IP, and BMS needs both.
|
||||
*/
|
||||
async function attachProxy(cfg) {
|
||||
if (!cfg.proxyUrl) return;
|
||||
|
||||
@@ -18,9 +18,13 @@ let client = null;
|
||||
async function getClient(cfg) {
|
||||
if (client) return client;
|
||||
if (!Impit) ({ Impit } = await import("impit"));
|
||||
// With socks5:// impit resolves DNS locally and asks the proxy for that address,
|
||||
// which fails outright on an IPv6-only exit that cannot reach the IPv4 we picked.
|
||||
// socks5h:// leaves resolution to the proxy, so normalize to it.
|
||||
const proxyUrl = cfg.proxyUrl ? cfg.proxyUrl.replace(/^socks5:\/\//i, "socks5h://") : "";
|
||||
client = new Impit({
|
||||
browser: "chrome",
|
||||
...(cfg.proxyUrl ? { proxyUrl: cfg.proxyUrl } : {}),
|
||||
...(proxyUrl ? { proxyUrl } : {}),
|
||||
});
|
||||
return client;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user