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

test: add tests for non-unilateral DCUtR over TCP #1932

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
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
6 changes: 5 additions & 1 deletion packages/interface-internal/src/connection-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import type { PeerId } from '@libp2p/interface/peer-id'
import type { PeerMap } from '@libp2p/peer-collections'
import type { Multiaddr } from '@multiformats/multiaddr'

export interface OpenConnectionOptions extends AbortOptions {
priority?: number
}

export interface ConnectionManager {
/**
* Return connections, optionally filtering by a PeerId
Expand Down Expand Up @@ -37,7 +41,7 @@ export interface ConnectionManager {
* const connection = await libp2p.connectionManager.openConnection(peerId)
* ```
*/
openConnection: (peer: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions) => Promise<Connection>
openConnection: (peer: PeerId | Multiaddr | Multiaddr[], options?: OpenConnectionOptions) => Promise<Connection>

/**
* Close our connections to a peer
Expand Down
8 changes: 7 additions & 1 deletion packages/libp2p/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
"types": "./dist/src/circuit-relay/index.d.ts",
"import": "./dist/src/circuit-relay/index.js"
},
"./dcutr": {
"types": "./dist/src/dcutr/index.d.ts",
"import": "./dist/src/dcutr/index.js"
},
"./fetch": {
"types": "./dist/src/fetch/index.d.ts",
"import": "./dist/src/fetch/index.js"
Expand Down Expand Up @@ -100,7 +104,8 @@
"build": "aegir build",
"generate": "run-s generate:proto:*",
"generate:proto:autonat": "protons ./src/autonat/pb/index.proto",
"generate:proto:circuit": "protons ./src/circuit/pb/index.proto",
"generate:proto:circuit-relay": "protons ./src/circuit-relay/pb/index.proto",
"generate:proto:dcutr": "protons ./src/dcutr/pb/message.proto",
"generate:proto:fetch": "protons ./src/fetch/pb/proto.proto",
"generate:proto:identify": "protons ./src/identify/pb/message.proto",
"generate:proto:plaintext": "protons ./src/insecure/pb/proto.proto",
Expand Down Expand Up @@ -129,6 +134,7 @@
"@libp2p/utils": "^4.0.0",
"@multiformats/mafmt": "^12.1.2",
"@multiformats/multiaddr": "^12.1.3",
"@multiformats/multiaddr-matcher": "^1.0.0",
"abortable-iterator": "^5.0.1",
"any-signal": "^4.1.1",
"datastore-core": "^9.0.1",
Expand Down
1 change: 0 additions & 1 deletion packages/libp2p/src/connection-manager/auto-dial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ export class AutoDial implements Startable {

log('connecting to a peerStore stored peer %p', peer.id)
await this.connectionManager.openConnection(peer.id, {
// @ts-expect-error needs adding to the ConnectionManager interface
priority: this.autoDialPriority
})
}, {
Expand Down
6 changes: 1 addition & 5 deletions packages/libp2p/src/connection-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type { Metrics } from '@libp2p/interface/metrics'
import type { PeerId } from '@libp2p/interface/peer-id'
import type { Peer, PeerStore } from '@libp2p/interface/peer-store'
import type { Startable } from '@libp2p/interface/startable'
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
import type { ConnectionManager, OpenConnectionOptions } from '@libp2p/interface-internal/connection-manager'
import type { TransportManager } from '@libp2p/interface-internal/transport-manager'

const log = logger('libp2p:connection-manager')
Expand Down Expand Up @@ -154,10 +154,6 @@ export interface DefaultConnectionManagerComponents {
events: EventEmitter<Libp2pEvents>
}

export interface OpenConnectionOptions extends AbortOptions {
priority?: number
}

/**
* Responsible for managing known connections.
*/
Expand Down
Loading