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

fix!: remove autodialer #2639

Merged
merged 5 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
3 changes: 1 addition & 2 deletions doc/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,7 @@ const node = await createLibp2p({
noise()
],
connectionManager: {
maxConnections: Infinity,
minConnections: 0
maxConnections: Infinity
}
})
```
Expand Down
6 changes: 0 additions & 6 deletions doc/LIMITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ const node = await createLibp2p({
*/
maxConnections: 100,

/**
* If the number of open connections goes below this number, the node
* will try to connect to randomly selected peers from the peer store
*/
minConnections: 50,

/**
* How many connections can be open but not yet upgraded
*/
Expand Down
3 changes: 0 additions & 3 deletions interop/test/fixtures/get-libp2p.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ const IP = process.env.ip ?? '0.0.0.0'
export async function getLibp2p (): Promise<Libp2p<{ ping: PingService }>> {
const options: Libp2pOptions<{ ping: PingService, identify: Identify }> = {
start: true,
connectionManager: {
minConnections: 0
},
connectionGater: {
denyDialMultiaddr: async () => false
},
Expand Down
3 changes: 1 addition & 2 deletions packages/integration-tests/.aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ export default {
const peerId = await createEd25519PeerId()
const libp2p = await createLibp2p({
connectionManager: {
inboundConnectionThreshold: Infinity,
minConnections: 0
inboundConnectionThreshold: Infinity
},
addresses: {
listen: [
Expand Down
51 changes: 51 additions & 0 deletions packages/integration-tests/test/bootstrap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import { bootstrap } from '@libp2p/bootstrap'
import { TypedEventEmitter, peerDiscoverySymbol } from '@libp2p/interface'
import { mplex } from '@libp2p/mplex'
import { createEd25519PeerId } from '@libp2p/peer-id-factory'
import { plaintext } from '@libp2p/plaintext'
import { webSockets } from '@libp2p/websockets'
import * as Filter from '@libp2p/websockets/filters'
import { multiaddr } from '@multiformats/multiaddr'
import { expect } from 'aegir/chai'
import { createLibp2p } from 'libp2p'
Expand Down Expand Up @@ -103,4 +106,52 @@ describe('bootstrap', () => {

return deferred.promise
})

it('bootstrap should dial all peers in the list', async () => {
const deferred = defer()

const bootstrappers = [
`${process.env.RELAY_MULTIADDR}`
]

libp2p = await createLibp2p({
connectionEncryption: [
plaintext()
],
transports: [
webSockets({
filter: Filter.all
})
],
streamMuxers: [
mplex()
],
peerDiscovery: [
bootstrap({
list: bootstrappers
})
],
connectionGater: {
denyDialMultiaddr: () => false
}
})

const expectedPeers = new Set(
bootstrappers.map(ma => multiaddr(ma).getPeerId())
)

libp2p.addEventListener('connection:open', (evt) => {
const { remotePeer } = evt.detail

expectedPeers.delete(remotePeer.toString())
if (expectedPeers.size === 0) {
libp2p.removeEventListener('connection:open')
deferred.resolve()
}
})

await libp2p.start()

return deferred.promise
})
})
3 changes: 0 additions & 3 deletions packages/integration-tests/test/circuit-relay.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ async function createClient (options: Libp2pOptions = {}): Promise<Libp2p> {
connectionEncryption: [
plaintext()
],
connectionManager: {
minConnections: 0
},
services: {
identify: identify()
},
Expand Down
3 changes: 0 additions & 3 deletions packages/integration-tests/test/fetch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ async function createNode (): Promise<Libp2p<{ fetch: Fetch }>> {
return createLibp2p(createBaseOptions({
services: {
fetch: fetch()
},
connectionManager: {
minConnections: 0
}
}))
}
Expand Down
5 changes: 1 addition & 4 deletions packages/integration-tests/test/interop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,7 @@ async function createJsPeer (options: SpawnOptions): Promise<Daemon> {
},
transports: [tcp(), circuitRelayTransport()],
streamMuxers: [],
connectionEncryption: [noise()],
connectionManager: {
minConnections: 0
}
connectionEncryption: [noise()]
}

if (options.noListen !== true) {
Expand Down
3 changes: 1 addition & 2 deletions packages/libp2p/.aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export default {
const peerId = await createEd25519PeerId()
const libp2p = await createLibp2p({
connectionManager: {
inboundConnectionThreshold: Infinity,
minConnections: 0
inboundConnectionThreshold: Infinity
},
addresses: {
listen: [
Expand Down
Loading
Loading