File tree Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Original file line number Diff line number Diff line change 1212 } ) ;
1313}
1414</ script >
15- < script type ="module ">
15+ < script type ="_module ">
1616import { Addr } from '/src/addr.js' ;
1717
1818const host = new Addr ( 'turn+tcp:ucCm6JK3s22XuCRiTZVFpWajUq0tIpB7lDn1Sv8dRv3@localhost?setup=active' ) . connect ( ) ;
1919log_everything ( host , 'host' ) ;
2020</ script >
21- < script type ="_module ">
21+ < script type ="module ">
2222import { cert , Cert } from '/src/cert.js' ;
2323import { Addr } from '/src/addr.js' ;
2424
2525const certa = await Cert . load ( 'peera' ) ;
2626const 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 } ) ;
3030log_everything ( a , 'a' ) ;
3131log_everything ( b , 'b' ) ;
3232</ script >
Original file line number Diff line number Diff line change @@ -105,8 +105,8 @@ export class Addr extends URL {
105105 yield { address, port, usernameFragment } ;
106106 } else if ( / ^ ( t u r n s ? ) (?: \+ ( t c p | u d p ) ) ? : / 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 }
Original file line number Diff line number Diff line change @@ -16,13 +16,9 @@ export function to_fingerprint(id) {
1616export 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
2824export function to_string ( id ) {
You can’t perform that action at this time.
0 commit comments