mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-03-23 13:41:28 +00:00
Feat/587-circuit-relay (#611)
* feat: implemented setup of circuit relay and test cases * chore: remove test files to be rewritten * added 1 test suite for protocol * added 1 test suite for discovery * fixed protocol timeouts and message types to handle reservations and stream operations. * Resolved merge conflict in libp2p/tools/utils.py by combining timeout approach with retry mechanism * fix: linting issues * docs: updated documentation with circuit-relay * chore: added enums, improved typing, security and examples * fix: created proper __init__ file to ensure importability * fix: replace transport_opt with listen_addrs in examples, fixed typing and improved code * fix type checking issues across relay module and test suite * regenerated circuit_pb2 file protobuf version 3 * fixed circuit relay example and moved imports to top in test_security_multistream * chore: moved imports to the top * chore: fixed linting of test_circuit_v2_transport.py --------- Co-authored-by: Manu Sheel Gupta <manusheel.edu@gmail.com>
This commit is contained in:
55
libp2p/relay/circuit_v2/pb/circuit.proto
Normal file
55
libp2p/relay/circuit_v2/pb/circuit.proto
Normal file
@ -0,0 +1,55 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package circuit.pb.v2;
|
||||
|
||||
// Circuit v2 message types
|
||||
message HopMessage {
|
||||
enum Type {
|
||||
RESERVE = 0;
|
||||
CONNECT = 1;
|
||||
STATUS = 2;
|
||||
}
|
||||
|
||||
Type type = 1;
|
||||
bytes peer = 2;
|
||||
Reservation reservation = 3;
|
||||
Limit limit = 4;
|
||||
Status status = 5;
|
||||
}
|
||||
|
||||
message StopMessage {
|
||||
enum Type {
|
||||
CONNECT = 0;
|
||||
STATUS = 1;
|
||||
}
|
||||
|
||||
Type type = 1;
|
||||
bytes peer = 2;
|
||||
Status status = 3;
|
||||
}
|
||||
|
||||
message Reservation {
|
||||
bytes voucher = 1;
|
||||
bytes signature = 2;
|
||||
int64 expire = 3;
|
||||
}
|
||||
|
||||
message Limit {
|
||||
int64 duration = 1;
|
||||
int64 data = 2;
|
||||
}
|
||||
|
||||
message Status {
|
||||
enum Code {
|
||||
OK = 0;
|
||||
RESERVATION_REFUSED = 100;
|
||||
RESOURCE_LIMIT_EXCEEDED = 101;
|
||||
PERMISSION_DENIED = 102;
|
||||
CONNECTION_FAILED = 200;
|
||||
DIAL_REFUSED = 201;
|
||||
STOP_FAILED = 300;
|
||||
MALFORMED_MESSAGE = 400;
|
||||
}
|
||||
Code code = 1;
|
||||
string message = 2;
|
||||
}
|
||||
Reference in New Issue
Block a user