Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat: increase maximum allowed STUN/TURN URLs from 4 to 8

0xken15b6142712803d
diff --git a/cli/src/lib/terminalP2p.spec.ts b/cli/src/lib/terminalP2p.spec.ts
index 7804bcaf0..b60f8b810 100644
--- a/cli/src/lib/terminalP2p.spec.ts
+++ b/cli/src/lib/terminalP2p.spec.ts
@@ -149,11 +149,14 @@ describe('terminal WebRTC data channel', () => {
sdp: 'not-a-real-sdp',
stunUrls: [
'stun:1.example:3478', 'stun:2.example:3478', 'stun:3.example:3478',
- 'stun:4.example:3478', 'stun:5.example:3478', 'turn:6.example:3478', 42,
+ 'stun:4.example:3478', 'stun:5.example:3478', 'stun:6.example:3478',
+ 'stun:7.example:3478', 'stun:8.example:3478', 'stun:9.example:3478',
+ 'turn:10.example:3478', 42,
] as unknown as string[],
})
expect(selectStunUrls).toHaveBeenCalledWith([
'stun:1.example:3478', 'stun:2.example:3478', 'stun:3.example:3478', 'stun:4.example:3478',
+ 'stun:5.example:3478', 'stun:6.example:3478', 'stun:7.example:3478', 'stun:8.example:3478',
])
} finally {
await responder.stop()
diff --git a/cli/src/lib/terminalP2p.ts b/cli/src/lib/terminalP2p.ts
index e3719b0d2..071b1e0bd 100644
--- a/cli/src/lib/terminalP2p.ts
+++ b/cli/src/lib/terminalP2p.ts
@@ -491,7 +491,7 @@ export class TerminalP2pResponderPool {
await this.closeConnection(connId, 'superseded', false)
if (this.offerSeq.get(connId) !== seq) return
const offeredStunUrls = Array.isArray(payload.stunUrls)
- ? payload.stunUrls.filter((url): url is string => typeof url === 'string' && /^stuns?:/i.test(url)).slice(0, 4)
+ ? payload.stunUrls.filter((url): url is string => typeof url === 'string' && /^stuns?:/i.test(url)).slice(0, 8)
: []
// The offerer raced these too, and may well have landed on a different server. That is fine: a
// srflx candidate is each peer's own public address, so the two sides need not agree on who to ask.