From b7a513be561e1aced393fb77a44e172bb54e5414 Mon Sep 17 00:00:00 2001 From: Yonle Date: Tue, 7 Nov 2023 23:18:16 +0700 Subject: [PATCH] connect to relays with user-agent Signed-off-by: Yonle --- bouncer/bouncer1.js | 6 +++++- bouncer/bouncer2.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bouncer/bouncer1.js b/bouncer/bouncer1.js index 3dd1fe6..87e485b 100644 --- a/bouncer/bouncer1.js +++ b/bouncer/bouncer1.js @@ -88,7 +88,11 @@ function bc(msg) { // WS - Sessions function newConn(addr) { - const relay = new WebSocket(addr); + const relay = new WebSocket(addr, { + headers: { + "User-Agent": "Bostr; The nostr relay bouncer; https://github.com/Yonle/bostr" + } + }); relay.addr = addr; relay.on('open', _ => { diff --git a/bouncer/bouncer2.js b/bouncer/bouncer2.js index 6af7b53..d2f7dc2 100644 --- a/bouncer/bouncer2.js +++ b/bouncer/bouncer2.js @@ -104,7 +104,11 @@ function terminate_sess(id) { // WS - Sessions function newConn(addr, id) { if (!csess.has(id)) return; - const relay = new WebSocket(addr); + const relay = new WebSocket(addr, { + headers: { + "User-Agent": "Bostr; The nostr relay bouncer; https://github.com/Yonle/bostr" + } + }); relay.id = id; relay.addr = addr;