Skip to content

Commit 1ede334

Browse files
committed
edits
1 parent 2128fb0 commit 1ede334

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

content/concepts/introduction/core-abstractions/connections.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,40 @@ weight: 33
88

99
A libp2p connection allows two peers to read and write data to each other.
1010
Peers connect over [transport protocols](../transports/overview.md), which are
11-
core abstractions of libp2p and offer extensibility. As a modular networking stack,
12-
libp2p is transport-agnostic and does not enforce the implementation of a specific
13-
transport protocol. Though the support of modern transport protocols is a primary
14-
focus for libp2p, implementers may support multiple types of transport. This document
15-
does not cover establishing "transport level" connections, for example, opening "raw"
16-
TCP sockets, as those semantics are specific to each transport. Rather, this document
17-
explains the process that occurs after making the initial transport-level connection,
18-
up to the point where "application level" streams are opened. Learn about transport
19-
protocols in libp2p in the [transport section](../transports/overview/).
11+
core abstractions of libp2p and offer extensibility.
12+
This document does not cover establishing "transport level" connections, for example,
13+
opening "raw" TCP sockets, as those semantics are specific to each transport. Rather,
14+
this document explains the process that occurs after making the initial transport-level
15+
connection, up to the point where "application level" streams are opened.
16+
Learn about transport protocols in libp2p in the [transport section](../transports/overview/).
2017

2118
## Life of a libp2p connection
2219

23-
The following points present an overview for a standard libp2p connection:
20+
The following points present an overview for a standard libp2p connection; we'll then dive
21+
more into the various components later in the document.
2422

2523
- A libp2p node (peer) initiates a connection with another node by sending
2624
a request over the underlying transport protocol (e.g., TCP). This request
27-
is referred to as "dialing."
25+
is referred to as "dialing", and the peer is referred to as the "dialer."
2826
- The receiving node, known as the "listener", accepts the incoming connection
2927
request and responds with a handshake message to initiate the protocol negotiation
3028
process.
3129
- Both nodes exchange protocol information and select the protocols to use for the
32-
connection, including protocols for security and stream multiplexing if necessary.
33-
The multistream-select protocol is used for this negotiation process.
30+
connection, including protocols for [security](../secure-comm/overview.md) and
31+
[stream multiplexing](../multiplex/overview.md) if necessary.
32+
The [multistream-select](https://github.com/multiformats/multistream-select) is used
33+
for this negotiation process.
3434
- If the underlying transport protocol does not natively support security and multiplexing,
3535
a connection upgrade is performed to add these capabilities to the raw transport connection.
36-
The peers may use NAT traversal techniques such as UPnP or hole punching to allow nodes
37-
behind NAT devices to establish connections.
36+
The peers may use NAT traversal techniques such as
37+
[UPnP](https://en.wikipedia.org/wiki/Universal_Plug_and_Play) or
38+
[hole punching](../nat/hole-punching.md) to allow nodes behind NAT devices to establish
39+
connections.
3840
- Once the connection is established, and protocols are selected, the nodes can open multiple
3941
streams over the connection for various interactions, each using its own protocol.
4042
- Data is exchanged over the streams using the negotiated protocols.
41-
- When a node wants to close the connection or a stream, it sends a close message to the other
42-
node, which responds with an acknowledgment message.
43+
- When a node wants to close the connection or a stream, it sends a "close" message to the other
44+
node, which responds with an "acknowledgment" message.
4345
- Once both nodes have sent and received the close message and acknowledgment, the connection
4446
or stream is closed.
4547

@@ -98,8 +100,8 @@ important to consider compatibility with existing protocols, performance, and se
98100

99101
libp2p is designed to support a variety of transport protocols, including those that do
100102
not natively support the core libp2p capabilities of security and stream multiplexing.
101-
The process of layering capabilities onto "raw" transport connections is called "upgrading"
102-
the connection.
103+
The process of layering capabilities onto "raw" transport connections is known as
104+
"upgrading" the connection.
103105

104106
The listener's multiaddr determines the security protocol to be used on a connection
105107
(see [addressing specification]). The multiplexing protocol is determined using protocol
@@ -153,17 +155,16 @@ version, but they may also choose to support older versions for compatibility. M
153155
protocols is available on the [protocols document](protocols.md).
154156

155157
Protocol negotiation works by one peer sending a message containing the protocol ID of the
156-
protocol it wishes to use, and the other either echoing back the same id if it supports
157-
the protocol or sending a different id if it does not. This process continues until both
158+
protocol it wishes to use, and the other either echoing back the same ID if it supports
159+
the protocol or sending a different ID if it does not. This process continues until both
158160
peers agree on a common protocol to use or determine that no common protocol is available.
159161

160162
For example, consider a case where two libp2p nodes are attempting to upgrade a
161163
raw transport connection to a secure libp2p connection using the Noise protocol:
162164

163165
- The dialing peer sends a message containing the protocol ID `/noise/1.0.0` to
164-
- indicate its desire to use the Noise protocol.
165-
- The listening peer supports the Noise protocol,
166-
which echoes the same protocol ID.
166+
indicate its desire to use the Noise protocol.
167+
- The listening peer supports the Noise protocol, which echoes the same protocol ID.
167168
- Both peers perform the Noise handshake to establish a secure connection.
168169

169170
> If the listening peer did not support the Noise protocol, it would have responded

0 commit comments

Comments
 (0)