[#ConnectionType]
= ConnectionType
:mrdocs:

Different types of connections to a peer&period; This enum encapsulates the information we have available at the time of opening or accepting the connection&period; Aside from INBOUND, all types are initiated by us&period;

== Synopsis

Declared in `&lt;node&sol;connection&lowbar;types&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
enum class ConnectionType : int;
----

== Description

If adding or removing types, please update CONNECTION&lowbar;TYPE&lowbar;DOC in src&sol;rpc&sol;net&period;cpp and src&sol;qt&sol;rpcconsole&period;cpp, as well as the descriptions in src&sol;qt&sol;guiutil&period;cpp and src&sol;bitcoin&hyphen;cli&period;cpp&colon;&colon;NetinfoRequestHandler&period;

== Members

[cols="1,4"]
|===
| Name| Description
| `INBOUND` 
| Inbound connections are those initiated by a peer&period; This is the only property we know at the time of connection, until P2P messages are exchanged&period;
| `OUTBOUND&lowbar;FULL&lowbar;RELAY` 
| These are the default connections that we use to connect with the network&period; There is no restriction on what is relayed&semi; by default we relay blocks, addresses &amp; transactions&period; We automatically attempt to open MAX&lowbar;OUTBOUND&lowbar;FULL&lowbar;RELAY&lowbar;CONNECTIONS using addresses from our AddrMan&period;
| `MANUAL` 
| We open manual connections to addresses that users explicitly requested via the addnode RPC or the &hyphen;addnode&sol;&hyphen;connect configuration options&period; Even if a manual connection is misbehaving, we do not automatically disconnect or add it to our discouragement filter&period;
| `FEELER` 
| Feeler connections are short&hyphen;lived connections made to check that a node is alive&period; They can be useful for&colon; &hyphen; test&hyphen;before&hyphen;evict&colon; if one of the peers is considered for eviction from our AddrMan because another peer is mapped to the same slot in the tried table, evict only if this longer&hyphen;known peer is offline&period; &hyphen; move node addresses from New to Tried table, so that we have more connectable addresses in our AddrMan&period; Note that in the literature (&quot;Eclipse Attacks on Bitcoin’s Peer&hyphen;to&hyphen;Peer Network&quot;) only the latter feature is referred to as &quot;feeler connections&quot;, although in our codebase feeler connections encompass test&hyphen;before&hyphen;evict as well&period; We make these connections approximately every FEELER&lowbar;INTERVAL&colon; first we resolve previously found collisions if they exist (test&hyphen;before&hyphen;evict), otherwise we connect to a node from the new table&period;
| `BLOCK&lowbar;RELAY` 
| We use block&hyphen;relay&hyphen;only connections to help prevent against partition attacks&period; By not relaying transactions or addresses, these connections are harder to detect by a third party, thus helping obfuscate the network topology&period; We automatically attempt to open MAX&lowbar;BLOCK&lowbar;RELAY&lowbar;ONLY&lowbar;ANCHORS using addresses from our anchors&period;dat&period; Then addresses from our AddrMan if MAX&lowbar;BLOCK&lowbar;RELAY&lowbar;ONLY&lowbar;CONNECTIONS isn&apos;t reached yet&period;
| `ADDR&lowbar;FETCH` 
| AddrFetch connections are short lived connections used to solicit addresses from peers&period; These are initiated to addresses submitted via the &hyphen;seednode command line argument, or under certain conditions when the AddrMan is empty&period;
| `PRIVATE&lowbar;BROADCAST` 
| Private broadcast connections are short&hyphen;lived and only opened to privacy networks (Tor, I2P) for relaying privacy&hyphen;sensitive data (like our own transactions) and closed afterwards&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:ConnectionTypeAsString.adoc[`ConnectionTypeAsString`]
| Convert ConnectionType enum to a string value
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
