@decentnetwork/peer 0.1.134 → 0.1.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/peer.js +15 -1
  2. package/package.json +1 -1
package/dist/peer.js CHANGED
@@ -34,7 +34,21 @@ import { createBoundUdp4Socket, closeDgramSocket } from "./transport/dgram-lifec
34
34
  const TURN_RELAY_SERVERS = (() => {
35
35
  const raw = process.env.DECENT_TURN_SERVERS?.trim();
36
36
  if (!raw) {
37
- return [{ host: "tokyo.fi.chat", port: 3478, username: "allcom", password: "allcompass" }];
37
+ // MORE THAN ONE, ALWAYS. This list is not a preference — it is the only
38
+ // way a peer learns its own public endpoint, so when every entry is down
39
+ // nobody can hole-punch and the WHOLE network silently degrades to TCP
40
+ // relay. That is not hypothetical: coturn on tokyo core-dumped and stayed
41
+ // dead for ten days, and with tokyo as the sole entry every link in the
42
+ // network ran at relay latency (~1200ms instead of ~130ms) the entire
43
+ // time. Nothing alerted, because the port stayed open.
44
+ //
45
+ // Ordered by expected reachability from the biggest population of peers.
46
+ // A dead entry costs one timeout before the next is tried, so listing a
47
+ // spare is close to free; having none is a network-wide outage.
48
+ return [
49
+ { host: "tokyo.fi.chat", port: 3478, username: "allcom", password: "allcompass" },
50
+ { host: "gfax.cn", port: 3478, username: "allcom", password: "allcompass" },
51
+ ];
38
52
  }
39
53
  return raw
40
54
  .split(",")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/peer",
3
- "version": "0.1.134",
3
+ "version": "0.1.135",
4
4
  "description": "Pure TypeScript port of Elastos Carrier (toxcore-derived) P2P messaging. DHT, onion routing, TCP relay, FlatBuffers app payloads, Express offline relay. Wire-compatible with iOS Beagle and the Carrier C SDK.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",