Elena Frank c61ea6ad29
protocols/: Add basic AutoNAT implementation (#2262)
This commit adds a behaviour protocol that implements the AutoNAT specification.
It enables users to detect whether they are behind a NAT. The Autonat Protocol
implements a Codec for the Request-Response protocol, and wraps it in a new
Network Behaviour with some additional functionality.

Co-authored-by: David Craven <david@craven.ch>
Co-authored-by: Max Inden <mail@max-inden.de>
2022-01-14 10:27:28 +01:00

38 lines
670 B
Protocol Buffer

syntax = "proto2";
package structs;
message Message {
enum MessageType {
DIAL = 0;
DIAL_RESPONSE = 1;
}
enum ResponseStatus {
OK = 0;
E_DIAL_ERROR = 100;
E_DIAL_REFUSED = 101;
E_BAD_REQUEST = 200;
E_INTERNAL_ERROR = 300;
}
message PeerInfo {
optional bytes id = 1;
repeated bytes addrs = 2;
}
message Dial {
optional PeerInfo peer = 1;
}
message DialResponse {
optional ResponseStatus status = 1;
optional string statusText = 2;
optional bytes addr = 3;
}
optional MessageType type = 1;
optional Dial dial = 2;
optional DialResponse dialResponse = 3;
}