client is a stranger #127

Open
opened 2025-06-09 12:52:13 -04:00 by cory · 1 comment
Owner

What's up with this error and clients reconnecting rapidly?

Error from tunnel: client is a stranger Error: client is a stranger
at EventEmitter.<anonymous> (C:\Users\john\AppData\Local\Programs\Manyverse\resources\app\index.js:108512:24)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

%D0hiDKOhg66KQGL7Emg9NxmQPffOZ2Ni1cv9W+reWOY=.sha256

What's up with this error and clients reconnecting rapidly? ``` Error from tunnel: client is a stranger Error: client is a stranger at EventEmitter.<anonymous> (C:\Users\john\AppData\Local\Programs\Manyverse\resources\app\index.js:108512:24) at processTicksAndRejections (node:internal/process/task_queues:96:5) ``` %D0hiDKOhg66KQGL7Emg9NxmQPffOZ2Ni1cv9W+reWOY=.sha256
cory added this to the Competitive Social Experience milestone 2025-06-09 12:52:13 -04:00
cory modified the milestone from Competitive Social Experience to Solve the Mysteries 2025-06-09 21:09:36 -04:00
Author
Owner

Seems to be this code...

    monitorIncomingConnections() {
        const firewall = this;
        const { ssb, config } = firewall;
        ssb.auth.hook(async function (fn, args) {
            var _a; 
            const source = ssb.id;
            const [dest, cb] = args;
            if (config.rejectBlocked) {
                const [, blocked] = await run(ssb.friends.isBlocking)({ source, dest }); 
                if (blocked) {
                    debug('prevented blocked peer %s from connecting to us', dest);
                    cb(new Error('client is blocked'));
                    return;
                }   
            }
            if (config.rejectUnknown) {
                if (firewall.outgoingAttemptsMap.has(dest)) {
                    fn.apply(this, args);
                    return;
                }   
                const [, hops] = await run(ssb.friends.hops)({});
                if (hops && (hops[dest] == null || hops[dest] < -1)) {
                    debug('prevented unknown peer %s from connecting to us', dest);
                    cb(new Error('client is a stranger'));
                    const ts = Date.now();
                    const previousTS = (_a = firewall.incomingAttemptsMap.get(dest)) !== null && _a !== void 0 ? _a : 0;
                    firewall.incomingAttemptsMap.set(dest, ts);
                    if (previousTS + INCOMING_ATTEMPT_RECENTLY < ts) {
                        firewall.notifyIncomingAttempts({ id: dest, ts }); 
                    }   
                    firewall.saveOldIncomingAttempts();
                    return;
                }   
            }   
            fn.apply(this, args);
        }); 
Seems to be this code... ```js monitorIncomingConnections() { const firewall = this; const { ssb, config } = firewall; ssb.auth.hook(async function (fn, args) { var _a; const source = ssb.id; const [dest, cb] = args; if (config.rejectBlocked) { const [, blocked] = await run(ssb.friends.isBlocking)({ source, dest }); if (blocked) { debug('prevented blocked peer %s from connecting to us', dest); cb(new Error('client is blocked')); return; } } if (config.rejectUnknown) { if (firewall.outgoingAttemptsMap.has(dest)) { fn.apply(this, args); return; } const [, hops] = await run(ssb.friends.hops)({}); if (hops && (hops[dest] == null || hops[dest] < -1)) { debug('prevented unknown peer %s from connecting to us', dest); cb(new Error('client is a stranger')); const ts = Date.now(); const previousTS = (_a = firewall.incomingAttemptsMap.get(dest)) !== null && _a !== void 0 ? _a : 0; firewall.incomingAttemptsMap.set(dest, ts); if (previousTS + INCOMING_ATTEMPT_RECENTLY < ts) { firewall.notifyIncomingAttempts({ id: dest, ts }); } firewall.saveOldIncomingAttempts(); return; } } fn.apply(this, args); }); ```
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cory/tildefriends#127
No description provided.