-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor ping pong encrypted example #1007
base: main
Are you sure you want to change the base?
Refactor ping pong encrypted example #1007
Conversation
56af371
to
d228ec2
Compare
Bencher
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
Bencher
🚨 11 ALERTS: Threshold Boundary Limits exceeded!
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
Bencher
🚨 1 ALERT: Threshold Boundary Limit exceeded!
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
Bencher
🚨 2 ALERTS: Threshold Boundary Limits exceeded!
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
1da5329
to
e37608e
Compare
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.
tACK e37608e. There are just a few nits.
|
||
// create Ping frame | ||
let ping_frame = | ||
StandardSv2Frame::<Message>::from_message(message.clone(), PING_MSG_TYPE, 0, false) |
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.
https://stratumprotocol.org/specification/09-Extensions/
Is a 0 extension type unique in some way?
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.
since there are no extensions defined yet, using 0
is just the void/null case
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.
LGTM.
aa1ad0c
to
5f67449
Compare
Note: Wait to merge until the following is merged: |
Co-authored-by: bit-aloo <[email protected]>
5f67449
to
4aa8c14
Compare
similarly to #977, this PR is refactoring the
examples/ping-pong-with-noise
example intoexamples/ping-pong-encrypted
.I wrote it from scratch as an exercise to get familiar with
protocols
crates.The overall idea is quite similar to the previous implementation, but with some simplifications to make the example easier to understand.
ping-pong-encrypted
is an example of how to do encrypted SV2 traffic while leveraging the following crates:binary_sv2
codec_sv2
framing_sv2
(which is actually just re-exported bycodec_sv2
)noise_sv2
We establish a simple
Ping
-Pong
protocol with a server and a client communicating over a TCP socket.The server expects to receive a
Ping
message encoded as a SV2 binary frame.The
Ping
message contains anonce
, which is au8
generated randomly by the client.The client expects to get a
Pong
message in response, also encoded as a SV2 binary frame, with the samenonce
.The messages are assigned arbitrary values for binary encoding:
All communication is encrypted with SV2 Noise Protocol.