update
This commit is contained in:
@@ -175,7 +175,7 @@ In traditional client-server networking:
|
||||
|
||||
### P2P Networking: A Different Paradigm
|
||||
|
||||
P2P networking doesn't replace the OSI model—it's built **on top of it**. The difference is **who** initiates connections and **how** data flows:
|
||||
P2P networking doesn't replace the OSI model - it's built **on top of it**. The difference is **who** initiates connections and **how** data flows:
|
||||
|
||||
| Aspect | Client-Server (OSI-based) | Peer-to-Peer |
|
||||
|--------|---------------------------|--------------|
|
||||
@@ -190,7 +190,7 @@ P2P networking doesn't replace the OSI model—it's built **on top of it**. The
|
||||
|
||||
### How P2P Uses the OSI Layers
|
||||
|
||||
P2P applications still use all 7 OSI layers—they just use them differently:
|
||||
P2P applications still use all 7 OSI layers - they just use them differently:
|
||||
|
||||
```
|
||||
Traditional Web (Client-Server):
|
||||
@@ -244,7 +244,7 @@ swarm.on('connection', (conn, peerInfo) => {
|
||||
|
||||
#### 2. No Port Forwarding Required
|
||||
|
||||
Traditional servers need **port forwarding**—you configure your router to forward incoming connections to your server.
|
||||
Traditional servers need **port forwarding** - you configure your router to forward incoming connections to your server.
|
||||
|
||||
P2P uses **NAT traversal** (hole punching):
|
||||
- Your peer initiates an outgoing connection to a relay
|
||||
@@ -1602,7 +1602,7 @@ The extension requires:
|
||||
|
||||
### P2P Security: Understanding the Threat Landscape
|
||||
|
||||
When building P2P applications, you need to think about security differently than traditional client-server applications. In P2P, there is no central server to filter traffic or block attackers—**every peer is exposed to every other peer**.
|
||||
When building P2P applications, you need to think about security differently than traditional client-server applications. In P2P, there is no central server to filter traffic or block attackers - **every peer is exposed to every other peer**.
|
||||
|
||||
#### The Unique Challenges of P2P Security
|
||||
|
||||
@@ -1654,7 +1654,7 @@ An attacker sends massive amounts of data to a victim, overwhelming its bandwidt
|
||||
- Consider implementing your own rate limiting
|
||||
|
||||
##### 4. **Amplification Attacks**
|
||||
An attacker uses the P2P network to amplify their attack—sending small requests that generate large responses.
|
||||
An attacker uses the P2P network to amplify their attack - sending small requests that generate large responses.
|
||||
|
||||
**Hyperswarm's Defense**:
|
||||
- DHT responses are bounded in size
|
||||
@@ -1702,7 +1702,7 @@ const swarm = new Hyperswarm({
|
||||
|
||||
**How it works**:
|
||||
- Called during the connection handshake
|
||||
- Synchronous function—no async operations
|
||||
- Synchronous function - no async operations
|
||||
- Receives the remote peer's public key in hex string format
|
||||
- Return `true` to reject, `false` to accept
|
||||
|
||||
|
||||
Reference in New Issue
Block a user