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 <yonle@lecturify.net>
This commit is contained in:
Yonle
2024-05-21 18:32:12 +07:00
parent b99795f9d8
commit 014d4692cd

View File

@@ -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}`,
}
});