[#CNode-2constructor-0f]
= xref:CNode.adoc[CNode]::CNode
:relfileprefix: ../
:mrdocs:

Construct a peer connection with the given identity, socket, addresses and options&period;

== Synopsis

Declared in `&lt;net&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
CNode(
    xref:NodeId-08.adoc[NodeId] id,
    std::shared&lowbar;ptr&lt;Sock&gt; sock,
    xref:CAddress.adoc[CAddress] const& addrIn,
    uint64&lowbar;t nKeyedNetGroupIn,
    uint64&lowbar;t nLocalHostNonceIn,
    xref:CService.adoc[CService] const& addrBindIn,
    std::string const& addrNameIn,
    xref:ConnectionType.adoc[ConnectionType] conn&lowbar;type&lowbar;in,
    bool inbound&lowbar;onion,
    uint64&lowbar;t network&lowbar;key,
    xref:CNodeOptions.adoc[CNodeOptions]&& node&lowbar;opts = &lcub;&rcub;);
----

== Parameters

[cols="1,4"]
|===
| Name| Description
| *id*
| the unique identifier for this peer&period;
| *sock*
| the connected socket used to communicate with the peer&period;
| *addrIn*
| the address of the peer&period;
| *nKeyedNetGroupIn*
| the network group key used to bucket this peer&period;
| *nLocalHostNonceIn*
| the local nonce used to detect connections to ourselves&period;
| *addrBindIn*
| the bind address of our side of the connection&period;
| *addrNameIn*
| the human&hyphen;readable address or hostname of the peer&period;
| *conn&lowbar;type&lowbar;in*
| the type of this connection&period;
| *inbound&lowbar;onion*
| whether this is an inbound onion (Tor) connection&period;
| *network&lowbar;key*
| the network key used to prevent cross&hyphen;network fingerprinting&period;
| *node&lowbar;opts*
| additional per&hyphen;connection options&period;
|===


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