From 014d4692cd68bcae125143d5008491ad04634662 Mon Sep 17 00:00:00 2001 From: Yonle Date: Tue, 21 May 2024 18:32:12 +0700 Subject: [PATCH] bouncer connection to relays: tell ConnID in header This commit will expose ConnID in User-Agent HTTP Header on connection to upstream relays. The ConnID is only an random string that only the bostr admin knows what IP it does belong. This random string is always changing and will never give the same ID on every single connections, So please do not take this to be a similiar thing like X-Real-IP. The ConnID won't reveal client IP to upstream relay due to how the bouncer technically works, But it will help on both parties to finding the culprit. Only the respective bostr owner / admin know what IP does this ConnIDs belong. - To report an suspected service abuse, Contact to the bostr admin. Make sure that you send atleast more than a single log of ConnID. Please remember that these ConnIDs is not always the same. So sending more log about ConnIDs will help bostr admin to figure out the culprit. - For bostr admins, Finding out the culprit is easy. In your bostr log: 1 --- xxx.xxx.xxx.xxx is now using session 171629xxxxxxx_1_0.503985444xxxxxxx ^ ^ | | Culprit ConnID Signed-off-by: Yonle --- worker_bouncer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker_bouncer.js b/worker_bouncer.js index 8882975..07dc5f7 100644 --- a/worker_bouncer.js +++ b/worker_bouncer.js @@ -280,7 +280,7 @@ function newConn(addr, id, reconn_t = 0) { if (!stats[addr]) stats[addr] = { raw_rx: 0, rx: 0, tx: 0, f: 0 }; const relay = new WebSocket(addr, { headers: { - "User-Agent": `Bostr ${version}; The nostr relay bouncer; https://github.com/Yonle/bostr; ${server_meta.canonical_url || "No canonical bouncer URL specified"}; Contact: ${server_meta.contact}`, + "User-Agent": `Bostr ${version}; The nostr relay bouncer; https://github.com/Yonle/bostr; ConnID: ${id}; ${server_meta.canonical_url || "No canonical bouncer URL specified"}; Contact: ${server_meta.contact}`, } });