-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Queue Introduce wait for intro to complete before more requests are sent
- Loading branch information
Universal Web
committed
Jul 11, 2023
1 parent
c7a0bb0
commit 5b8c543
Showing
10 changed files
with
113 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { connectedLog } from '#logs'; | ||
import { decode } from 'msgpackr'; | ||
import { randomBuffer } from '#utilities/crypto'; | ||
export async function intro(message) { | ||
console.log('-------CLIENT INTRO-------\n'); | ||
// opn stands for open meaning connect to a server | ||
const connectRequest = this.request({ | ||
message: randomBuffer() | ||
}, 'open'); | ||
console.log('HANDSHAKE: Intro request', connectRequest); | ||
const connectResponse = await connectRequest.send(); | ||
const { | ||
data, | ||
state, | ||
time, | ||
// server connection ID | ||
sid | ||
} = connectResponse; | ||
if (state === 1 && sid) { | ||
connectedLog(data); | ||
this.handshake = true; | ||
this.state = 1; | ||
this.connected = true; | ||
this.destination.id = sid; | ||
if (data.key) { | ||
console.log('New Key Provided for Perfect Forward Secrecy'); | ||
} | ||
} | ||
console.log('-------CLIENT HANDSHAKE CONNECTED-------\n'); | ||
return connectResponse; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters