Expose conn_type via a practical API for JSON-RPC consumers.
- returns the
conn_typeas an integer id for API clients. It is a simple and small change to implement and maintain, and the API can remain stable even if theConnectionTypeelement naming or order changes. - adds a
uint8_ttype to theConnectionTypeenum class; if preferred, this can be dropped
$ ./src/bitcoin-cli help getpeerinfo
...
"inbound" : true|false, (boolean) Inbound (true) or Outbound (false)
"addnode" : true|false, (boolean) Whether connection was due to addnode/-connect or if it was an automatic/inbound connection
"conn_type" : n, (numeric) Connection type between 0 and 5:
0 - inbound (initiated by the peer)
1 - outbound-full-relay (default automatic connections)
2 - manual (added using the -addnode/-connect configuration options or the addnode RPC)
3 - feeler (short-lived automatic connection to test addresses)
4 - block-relay-only (does not relay transactions or addresses)
5 - addr-fetch (short-lived automatic connection to request addresses)