Skip to content

Commit 7a8c89e

Browse files
committed
Update broadcast IPs
I changed the broadcast addresses. Now the port is 65535 in all cases.
1 parent b0957e7 commit 7a8c89e

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
});
1313
}
1414
</script>
15-
<script type="module">
15+
<script type="_module">
1616
import { Addr } from '/src/addr.js';
1717

1818
const host = new Addr('turn+tcp:ucCm6JK3s22XuCRiTZVFpWajUq0tIpB7lDn1Sv8dRv3@localhost?setup=active').connect();
1919
log_everything(host, 'host');
2020
</script>
21-
<script type="_module">
21+
<script type="module">
2222
import { cert, Cert } from '/src/cert.js';
2323
import { Addr } from '/src/addr.js';
2424

2525
const certa = await Cert.load('peera');
2626
const certb = await Cert.load('peerb');
2727

28-
const a = new Addr(`turn+tcp:${certb}@localhost?setup`).connect({cert: certa});
29-
const b = new Addr(`turn+tcp:${certa}@localhost?setup`).connect({cert: certb});
28+
const a = new Addr(`turn+tcp:${certb}@stun.evan-brass.net?setup`).connect({cert: certa});
29+
const b = new Addr(`turn+tcp:${certa}@stun.evan-brass.net?setup`).connect({cert: certb});
3030
log_everything(a, 'a');
3131
log_everything(b, 'b');
3232
</script>

src/addr.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ export class Addr extends URL {
105105
yield { address, port, usernameFragment };
106106
} else if (/^(turns?)(?:\+(tcp|udp))?:/i.test(this.protocol)) {
107107
yield {
108-
address: 'fe80::ffff:ffff:ffff:ffff',
109-
port: is_firefox ? 65534 : 65535,
108+
address: is_firefox ? 'fe80::ffff:ffff:ffff:ffff' : 'ff02::1',
109+
port: 65535,
110110
usernameFragment,
111111
};
112112
}

src/id.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,9 @@ export function to_fingerprint(id) {
1616
export function from_bytes(arr) {
1717
if (arr.length != bytes) return;
1818

19-
let n = '0x';
20-
for (let b of arr) {
21-
if (typeof b != 'string') b = b.toString(16);
22-
if (b.length < 2) b = b.padStart(2, '0');
23-
n += b;
24-
}
25-
return BigInt(n);
19+
return BigInt(
20+
arr.reduce((a, v) => a + v.toString(16).padStart(2, '0'), '0x')
21+
);
2622
}
2723

2824
export function to_string(id) {

0 commit comments

Comments
 (0)