mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
net: expose transport types/session IDs of connections in RPC and logs
Co-authored-by: Dhruv Mehta <856960+dhruv@users.noreply.github.com>
This commit is contained in:
parent
432a62c4dc
commit
b815cce50e
9 changed files with 104 additions and 4 deletions
|
|
@ -24,3 +24,17 @@ std::string ConnectionTypeAsString(ConnectionType conn_type)
|
|||
|
||||
assert(false);
|
||||
}
|
||||
|
||||
std::string TransportTypeAsString(TransportProtocolType transport_type)
|
||||
{
|
||||
switch (transport_type) {
|
||||
case TransportProtocolType::DETECTING:
|
||||
return "detecting";
|
||||
case TransportProtocolType::V1:
|
||||
return "v1";
|
||||
case TransportProtocolType::V2:
|
||||
return "v2";
|
||||
} // no default case, so the compiler can warn about missing cases
|
||||
|
||||
assert(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#define BITCOIN_NODE_CONNECTION_TYPES_H
|
||||
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
|
||||
/** Different types of connections to a peer. This enum encapsulates the
|
||||
* information we have available at the time of opening or accepting the
|
||||
|
|
@ -79,4 +80,14 @@ enum class ConnectionType {
|
|||
/** Convert ConnectionType enum to a string value */
|
||||
std::string ConnectionTypeAsString(ConnectionType conn_type);
|
||||
|
||||
/** Transport layer version */
|
||||
enum class TransportProtocolType : uint8_t {
|
||||
DETECTING, //!< Peer could be v1 or v2
|
||||
V1, //!< Unencrypted, plaintext protocol
|
||||
V2, //!< BIP324 protocol
|
||||
};
|
||||
|
||||
/** Convert TransportProtocolType enum to a string value */
|
||||
std::string TransportTypeAsString(TransportProtocolType transport_type);
|
||||
|
||||
#endif // BITCOIN_NODE_CONNECTION_TYPES_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue