Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement circuit v2 #1533

Merged
merged 60 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
084042c
Squashed commit of the following:
ckousik Jan 5, 2023
d4e6436
remove extra test command
ckousik Jan 5, 2023
7961199
fix linter
ckousik Jan 5, 2023
290dc0a
remove extraneous files
ckousik Jan 5, 2023
16fd3f6
fixes
ckousik Jan 24, 2023
f02275d
address review comments
ckousik Jan 24, 2023
7c6df6d
fix
ckousik Jan 24, 2023
b9d5168
more fixes
ckousik Jan 24, 2023
12c4775
start/stop reservation store
ckousik Jan 24, 2023
09a48cf
flakey test
ckousik Jan 24, 2023
0ceaa6e
await protocol handling
ckousik Jan 24, 2023
4b307ab
fix linting
ckousik Jan 24, 2023
fcc0f54
testing changes
ckousik Jan 24, 2023
b8499de
more console logs
ckousik Jan 24, 2023
036569b
more console logs
ckousik Jan 24, 2023
89fc003
debug
ckousik Jan 24, 2023
9eb58e5
remove sink
ckousik Jan 24, 2023
231eb1f
temporarily skip flaky test
ckousik Jan 25, 2023
2dd3b4a
remove duplicated interfaces
ckousik Jan 25, 2023
3f547d7
remove unused fields
ckousik Jan 25, 2023
9a35bab
fix tests expecting hop to be enabled
ckousik Jan 25, 2023
1601189
remove circuit v1 support
ckousik Jan 25, 2023
fedf97e
cleanup
ckousik Jan 27, 2023
d3226ec
set type as optional in proto
ckousik Jan 30, 2023
c9bc1d3
address review from Alex
ckousik Feb 1, 2023
545fe51
remove streamhandler
ckousik Feb 1, 2023
3afc8b9
fix lint
ckousik Feb 1, 2023
7901093
fix onError callback
ckousik Feb 1, 2023
996eed2
deny reservation over relayed connection
ckousik Feb 3, 2023
dfcb610
disable relay for tests
ckousik Feb 3, 2023
881d1e9
fix start
ckousik Feb 3, 2023
530f428
revert interop
ckousik Feb 3, 2023
5e1d3e0
remove all circuitv1 code
ckousik Feb 8, 2023
840e3e4
handle peer reconnect in circuit v2
ckousik Feb 8, 2023
ccc2894
handle peer reconnect
ckousik Feb 8, 2023
9a3c092
remove circuitv1 protobuf
ckousik Feb 8, 2023
e590eed
updated interop tests
ckousik Jan 31, 2023
c28b278
remove relay
ckousik Feb 1, 2023
0cff5a0
fix
ckousik Feb 3, 2023
b2092f3
point to remote interop tests (should fail)
ckousik Feb 17, 2023
5b00e5f
chore: update versions, fix up tests and linting
achingbrain Feb 22, 2023
ca59818
Merge remote-tracking branch 'origin/master' into ckousik/feat/circui…
achingbrain Feb 22, 2023
54ac1c3
chore: remove casting, update interop suite to be more reliable
achingbrain Feb 23, 2023
37a5a0e
temporary
ckousik Feb 23, 2023
a3e527a
transfer limits
ckousik Feb 23, 2023
69a7e68
remove commented code
ckousik Feb 24, 2023
de764b7
chore: fix interop
achingbrain Feb 24, 2023
48094f1
Merge remote-tracking branch 'origin/master' into ckousik/feat/circui…
achingbrain Feb 28, 2023
7e2b848
remove pipe from utils
ckousik Mar 1, 2023
ed86c65
spawn microtasks to handle circuit connections
ckousik Mar 1, 2023
ee77185
reset stream on exceeding relay limits
ckousik Mar 1, 2023
edad075
replace reset with abort
ckousik Mar 1, 2023
a5dc1ab
abort takes error param
ckousik Mar 1, 2023
8885cad
fix dep-check
ckousik Mar 1, 2023
15696d8
Fix abortable
ckousik Mar 1, 2023
e9cbdd9
chore: remove unecessary types as we can now unwrap the original Stre…
achingbrain Mar 2, 2023
72b695a
fix tests
ckousik Mar 2, 2023
5d7afa3
add test for tagging peer
ckousik Mar 2, 2023
38eeb31
apply suggestion
ckousik Mar 2, 2023
70e1b49
fix: allow configuring limits, actually apply limits, update docs, re…
achingbrain Mar 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dist
.coverage
package-lock.json
yarn.lock
.vscode
27 changes: 18 additions & 9 deletions doc/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- [Customizing DHT](#customizing-dht)
- [Setup with Content and Peer Routing](#setup-with-content-and-peer-routing)
- [Setup with Relay](#setup-with-relay)
- [Setup with Auto Relay](#setup-with-auto-relay)
- [Setup with Automatic Reservations](#setup-with-automatic-reservations)
- [Setup with Keychain](#setup-with-keychain)
- [Configuring Dialing](#configuring-dialing)
- [Configuring Connection Manager](#configuring-connection-manager)
Expand Down Expand Up @@ -433,22 +433,31 @@ const node = await createLibp2p({
transports: [tcp()],
streamMuxers: [mplex()],
connectionEncryption: [noise()],
relay: { // Circuit Relay options (this config is part of libp2p core configurations)
relay: { // Circuit Relay options
enabled: true, // Allows you to dial and accept relayed connections. Does not make you a relay.
hop: {
enabled: true, // Allows you to be a relay for other peers
active: true // You will attempt to dial destination peers if you are not connected to them
enabled: true, // Allows you to be a relay for other peers.
timeout: 30 * 1000, // Incoming hop requests must complete within this timeout
applyConnectionLimits: true // Apply data/duration limits to relayed connections (default: true)
limit: {
duration: 120 * 1000 // the maximum amount of ms a relayed connection can be open for
data: BigInt(1 << 17) // the maximum amount of data that can be transferred over a relayed connection
}
},
advertise: {
enabled: true, // Allows you to disable advertising the Hop service
bootDelay: 15 * 60 * 1000, // Delay before HOP relay service is advertised on the network
enabled: true, // Allows you to disable the advertise of the Hop service
ttl: 30 * 60 * 1000 // Delay Between HOP relay service advertisements on the network
ttl: 30 * 60 * 1000 // Delay Between HOP relay service advertisements on the network
},
reservationManager: { // the reservation manager creates reservations on discovered relays
enabled: true, // enable the reservation manager, default: false
maxReservations: 1 // the maximum number of relays to create reservations on
}
}
})
```

#### Setup with Auto Relay
#### Setup with Automatic Reservations

```js
import { createLibp2p } from 'libp2p'
Expand All @@ -462,9 +471,9 @@ const node = await createLibp2p({
connectionEncryption: [noise()]
relay: { // Circuit Relay options (this config is part of libp2p core configurations)
enabled: true, // Allows you to dial and accept relayed connections. Does not make you a relay.
autoRelay: {
reservationManager: {
enabled: true, // Allows you to bind to relays with HOP enabled for improving node dialability
maxListeners: 2 // Configure maximum number of HOP relays to use
maxListeners: 2 // Configure maximum number of HOP relays to use
}
}
})
Expand Down
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"@libp2p/interface-libp2p": "^1.0.0",
"@libp2p/interface-metrics": "^4.0.0",
"@libp2p/interface-peer-discovery": "^1.0.1",
"@libp2p/interface-peer-id": "^2.0.0",
"@libp2p/interface-peer-id": "^2.0.1",
"@libp2p/interface-peer-info": "^1.0.3",
"@libp2p/interface-peer-routing": "^1.0.1",
"@libp2p/interface-peer-store": "^1.2.2",
Expand All @@ -122,7 +122,7 @@
"@libp2p/peer-id": "^2.0.0",
"@libp2p/peer-id-factory": "^2.0.0",
"@libp2p/peer-record": "^5.0.0",
"@libp2p/peer-store": "^6.0.0",
"@libp2p/peer-store": "^6.0.4",
"@libp2p/tracked-map": "^3.0.0",
"@libp2p/utils": "^3.0.2",
"@multiformats/mafmt": "^11.0.2",
Expand All @@ -143,11 +143,13 @@
"it-map": "^2.0.0",
"it-merge": "^2.0.0",
"it-pair": "^2.0.2",
"it-pb-stream": "^3.0.0",
"it-pipe": "^2.0.3",
"it-sort": "^2.0.0",
"it-stream-types": "^1.0.4",
"merge-options": "^3.0.4",
"multiformats": "^11.0.0",
"p-defer": "^4.0.0",
"p-fifo": "^1.0.0",
"p-retry": "^5.0.0",
"private-ip": "^3.0.0",
Expand All @@ -162,17 +164,18 @@
"xsalsa20": "^1.1.0"
},
"devDependencies": {
"@chainsafe/libp2p-gossipsub": "^6.2.0",
"@chainsafe/libp2p-noise": "^11.0.0",
"@chainsafe/libp2p-yamux": "^3.0.3",
"@libp2p/bootstrap": "^6.0.0",
"@libp2p/daemon-client": "^4.0.1",
"@libp2p/daemon-server": "^4.0.1",
"@libp2p/daemon-client": "^5.0.0",
"@libp2p/daemon-server": "^4.1.0",
"@libp2p/floodsub": "^6.0.0",
"@libp2p/interface-compliance-tests": "^3.0.2",
"@libp2p/interface-connection-compliance-tests": "^2.0.3",
"@libp2p/interface-connection-encrypter-compliance-tests": "^4.0.0",
"@libp2p/interface-mocks": "^9.0.0",
"@libp2p/interop": "^4.0.0",
"@libp2p/interop": "^7.0.0",
"@libp2p/kad-dht": "^7.0.0",
"@libp2p/mdns": "^6.0.0",
"@libp2p/mplex": "^7.0.0",
Expand All @@ -188,11 +191,10 @@
"cborg": "^1.8.1",
"delay": "^5.0.0",
"execa": "^7.0.0",
"go-libp2p": "^0.0.6",
"go-libp2p": "^1.0.1",
"it-pushable": "^3.0.0",
"it-to-buffer": "^3.0.0",
"npm-run-all": "^4.1.5",
"p-defer": "^4.0.0",
"p-event": "^5.0.1",
"p-times": "^4.0.0",
"p-wait-for": "^5.0.0",
Expand Down
128 changes: 0 additions & 128 deletions src/circuit/IMPLEMENTATION_NOTES.md

This file was deleted.

Loading