This repository was archived by the owner on Feb 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
feat: Rewrite from SIO+ws-relay to protobuf+p2p-circuit #43
Closed
Closed
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
85dab51
rm -rf src/*
mkg20001 e5f92e4
Add first draft
mkg20001 274a0a9
Remove old tests
mkg20001 502f033
A few logic updates - Pkg fix
mkg20001 b07db93
docs: Update PROTOCOL
mkg20001 f43e5f4
docs: Update PROTOCOL
mkg20001 b3651dc
chore: remove unneded packages
mkg20001 ba0f012
Fixes
mkg20001 e4ffd06
Lint fixes
mkg20001 7fb5161
Fix
mkg20001 1963067
Fixes
mkg20001 03e3c95
Fixes
mkg20001 c0f3c10
Add dummy test
mkg20001 645ae8a
Fix dummy test
mkg20001 f626132
Make lint happy
mkg20001 cf7e7a4
chore: Upgrade package and use .dialProtocol
mkg20001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,62 @@ | ||
# Protocol | ||
|
||
### `/ws-star/2.0.0` | ||
|
||
## Connecting & Crypto challenge | ||
|
||
```protobuf | ||
message IdentifyRequest { | ||
required string nonce = 1; | ||
} | ||
|
||
message IdentifyResponse { | ||
required string id = 1; | ||
required string pubKey = 2; | ||
required bytes signature = 3; | ||
} | ||
``` | ||
|
||
### Error Handling | ||
|
||
If verifing the IdentifyResponse fails the connection gets closed by the server (protocol error) | ||
|
||
### Example Connection | ||
|
||
C: connects | ||
|
||
S: Uses `.getPeerInfo()` to get id. Generates random nonce (64 byte alphanumeric string) and sends IndentifyRequest. | ||
|
||
C: Signs nonce and send id, pubkey and signature back to server as IndentifyResponse | ||
|
||
S: Verifies IndentifyResponse | ||
|
||
S: Server adds peer to peerDB, starts to announce peer | ||
(If peer disconnects server stops to announce it) | ||
|
||
## Discovery | ||
|
||
The server peer periodically sends a list of all ids (in binary instead of b58) | ||
|
||
The client peer responds with discovery ACKs (which are basically pings) | ||
|
||
```protobuf | ||
message DiscoveryEvent { | ||
repeated bytes id = 1; | ||
} | ||
|
||
message DiscoveryACK { | ||
required bool ok = 1; | ||
} | ||
``` | ||
|
||
## Dials | ||
|
||
Dials work using p2p-circuit (currently with a fixed relay server) | ||
|
||
### Example Connection | ||
|
||
Ca: Connects via `<server-address>/p2p-circuit/ipfs/<dst-id>` | ||
|
||
Ca -> S -> Cb: Uses p2p-circuit to establish a connection with `<dst-id>` | ||
|
||
Cb: Finishes up connection |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not have all the same fields as the identify protocol?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the same identify protocol. Additionally in the libp2p-identify protocol the public keys never get exchanged.