Skip to content
Open
Show file tree
Hide file tree
Changes from all 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: 3 additions & 3 deletions interop/test/fixtures/get-libp2p.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { yamux } from '@libp2p/yamux'
import { createLibp2p } from 'libp2p'
import type { Identify } from '@libp2p/identify'
import type { Libp2p } from '@libp2p/interface'
import type { PingService } from '@libp2p/ping'
import type { Ping } from '@libp2p/ping'
import type { Libp2pOptions } from 'libp2p'

const isDialer: boolean = process.env.is_dialer === 'true'
Expand All @@ -26,8 +26,8 @@ const SECURE_CHANNEL = process.env.security
const MUXER = process.env.muxer
const IP = process.env.ip ?? '0.0.0.0'

export async function getLibp2p (): Promise<Libp2p<{ ping: PingService }>> {
const options: Libp2pOptions<{ ping: PingService, identify: Identify }> = {
export async function getLibp2p (): Promise<Libp2p<{ ping: Ping }>> {
const options: Libp2pOptions<{ ping: Ping, identify: Identify }> = {
start: true,
connectionGater: {
denyDialMultiaddr: async () => false
Expand Down
4 changes: 2 additions & 2 deletions packages/integration-tests/test/dht.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import type { Identify } from '@libp2p/identify'
import type { Libp2p, PeerId } from '@libp2p/interface'
import type { KadDHT } from '@libp2p/kad-dht'
import type { PingService } from '@libp2p/ping'
import type { Ping } from '@libp2p/ping'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { Libp2pOptions } from 'libp2p'

Expand Down Expand Up @@ -153,7 +153,7 @@ describe('DHT subsystem operates correctly', () => {
it('kad-dht should discover other peers', async () => {
const deferred = pDefer()

const getConfig = (): Libp2pOptions<{ dht: KadDHT, ping: PingService, identify: Identify }> => ({
const getConfig = (): Libp2pOptions<{ dht: KadDHT, ping: Ping, identify: Identify }> => ({
addresses: {
listen: [
listenAddr.toString()
Expand Down
7 changes: 4 additions & 3 deletions packages/integration-tests/test/identify.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,11 @@ describe('identify', () => {
const agentVersion = 'js-project/1.0.0'

const libp2p = await createLibp2p(createBaseOptions({
nodeInfo: {
userAgent: agentVersion
},
services: {
identify: identify({
agentVersion
})
identify: identify()
}
}))

Expand Down
4 changes: 2 additions & 2 deletions packages/integration-tests/test/interop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import pDefer from 'p-defer'
import type { Identify } from '@libp2p/identify'
import type { ServiceMap, PrivateKey } from '@libp2p/interface'
import type { SpawnOptions, Daemon, DaemonFactory } from '@libp2p/interop'
import type { PingService } from '@libp2p/ping'
import type { Ping } from '@libp2p/ping'
import type { Libp2pOptions, ServiceFactoryMap } from 'libp2p'

/**
Expand Down Expand Up @@ -159,7 +159,7 @@ async function createJsPeer (options: SpawnOptions): Promise<Daemon> {
throw new UnsupportedError()
}

const services: ServiceFactoryMap<{ identify: Identify, ping: PingService } & Record<string, any>> = {
const services: ServiceFactoryMap<{ identify: Identify, ping: Ping } & Record<string, any>> = {
identify: identify(),
ping: ping()
}
Expand Down
4 changes: 2 additions & 2 deletions packages/integration-tests/test/ping.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { expect } from 'aegir/chai'
import { createLibp2p } from 'libp2p'
import { createBaseOptions } from './fixtures/base-options.js'
import type { Libp2p } from '@libp2p/interface'
import type { PingService } from '@libp2p/ping'
import type { Ping } from '@libp2p/ping'

describe('ping', () => {
let nodes: Array<Libp2p<{ ping: PingService }>>
let nodes: Array<Libp2p<{ ping: Ping }>>

beforeEach(async () => {
nodes = await Promise.all([
Expand Down
17 changes: 0 additions & 17 deletions packages/interface-internal/src/registrar.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
import type { StreamHandler, StreamHandlerOptions, StreamHandlerRecord, Topology, AbortOptions } from '@libp2p/interface'

export type {
/**
* @deprecated This type should be imported from @libp2p/interface directly
*/
StreamHandler,

/**
* @deprecated This type should be imported from @libp2p/interface directly
*/
StreamHandlerOptions,

/**
* @deprecated This type should be imported from @libp2p/interface directly
*/
StreamHandlerRecord
}

/**
* The `Registrar` provides an interface for registering protocol handlers -
* these are invoked when remote peers open streams on the local node with the
Expand Down
28 changes: 0 additions & 28 deletions packages/interface/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,34 +132,6 @@ export class MuxerClosedError extends Error {
}
}

/**
* Thrown when a protocol stream is closed during an operation
*
* @deprecated delete if unused
*/
export class StreamClosedError extends Error {
static name = 'StreamClosedError'

constructor (message = 'The stream has been closed') {
super(message)
this.name = 'StreamClosedError'
}
}

/**
* Thrown when a protocol stream is closing during an operation
*
* @deprecated delete if unused
*/
export class StreamClosingError extends Error {
static name = 'StreamClosingError'

constructor (message = 'The stream is closing') {
super(message)
this.name = 'StreamClosingError'
}
}

/**
* Thrown when a protocol stream is reset by the remote muxer
*/
Expand Down
5 changes: 0 additions & 5 deletions packages/interface/src/peer-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,4 @@ export interface PeerStore {
* ```
*/
consumePeerRecord(buf: Uint8Array, options?: ConsumePeerRecordOptions): Promise<boolean>

/**
* @deprecated Pass `expectedPeer` as a property of `options` instead
*/
consumePeerRecord(buf: Uint8Array, expectedPeer?: PeerId, options?: AbortOptions): Promise<boolean>
}
18 changes: 0 additions & 18 deletions packages/libp2p/src/connection-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,6 @@ export interface ConnectionManagerInit {
*/
inboundUpgradeTimeout?: number

/**
* When a new outbound connection is opened, the upgrade process (e.g.
* protect, encrypt, multiplex etc) must complete within this number of ms.
*
* Does not apply if an abort signal is passed to the `.dial` method.
*
* @deprecated This is handled by `dialTimeout`
*/
outboundUpgradeTimeout?: number

/**
* Protocol negotiation must complete within this number of ms
*
* @default 2000
* @deprecated use outboundStreamProtocolNegotiationTimeout or inboundStreamProtocolNegotiationTimeout instead
*/
protocolNegotiationTimeout?: number

/**
* Outbound protocol negotiation must complete within this number of ms.
*
Expand Down
4 changes: 2 additions & 2 deletions packages/libp2p/src/libp2p.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ export class Libp2p<T extends ServiceMap = ServiceMap> extends TypedEventEmitter
connectionEncrypters: (init.connectionEncrypters ?? []).map((fn, index) => this.configureComponent(`connection-encryption-${index}`, fn(this.components))),
streamMuxers: (init.streamMuxers ?? []).map((fn, index) => this.configureComponent(`stream-muxers-${index}`, fn(this.components))),
inboundUpgradeTimeout: init.connectionManager?.inboundUpgradeTimeout,
inboundStreamProtocolNegotiationTimeout: init.connectionManager?.inboundStreamProtocolNegotiationTimeout ?? init.connectionManager?.protocolNegotiationTimeout,
outboundStreamProtocolNegotiationTimeout: init.connectionManager?.outboundStreamProtocolNegotiationTimeout ?? init.connectionManager?.protocolNegotiationTimeout,
inboundStreamProtocolNegotiationTimeout: init.connectionManager?.inboundStreamProtocolNegotiationTimeout,
outboundStreamProtocolNegotiationTimeout: init.connectionManager?.outboundStreamProtocolNegotiationTimeout,
connectionCloseTimeout: init.connectionManager?.connectionCloseTimeout
})

Expand Down
7 changes: 0 additions & 7 deletions packages/protocol-identify/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ export interface IdentifyInit {
*/
protocolPrefix?: string

/**
* What details we should send as part of an identify message
*
* @deprecated Use `nodeInfo.userAgent` in the main libp2p config instead
*/
agentVersion?: string

/**
* How long we should wait for a remote peer to send their identify response
*
Expand Down
10 changes: 1 addition & 9 deletions packages/protocol-identify/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ export function getCleanMultiaddr (addr: Uint8Array | string | null | undefined)
}
}

export function getAgentVersion (nodeInfo: NodeInfo, agentVersion?: string): string {
if (agentVersion != null) {
return agentVersion
}

return nodeInfo.userAgent
}

export async function consumeIdentifyMessage (peerStore: PeerStore, events: TypedEventTarget<Libp2pEvents>, log: Logger, connection: Connection, message: IdentifyMessage): Promise<IdentifyResult> {
log('received identify from %p', connection.remotePeer)

Expand Down Expand Up @@ -217,7 +209,7 @@ export abstract class AbstractIdentify implements Startable {
// Store self host metadata
this.host = {
protocolVersion: `${init.protocolPrefix ?? defaultValues.protocolPrefix}/${IDENTIFY_PROTOCOL_VERSION}`,
agentVersion: getAgentVersion(components.nodeInfo, init.agentVersion)
agentVersion: components.nodeInfo.userAgent
}

this.handleProtocol = this.handleProtocol.bind(this)
Expand Down
3 changes: 1 addition & 2 deletions packages/protocol-identify/test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,10 @@ describe('identify', () => {
})

it('should store own host data and protocol version into metadataBook on start', async () => {
const agentVersion = 'js-project/1.0.0'
const agentVersion = 'test'
const protocolVersion = '/my/id/0.1.0'

identify = new Identify(components, {
agentVersion,
protocolPrefix: '/my/id'
})

Expand Down
10 changes: 0 additions & 10 deletions packages/protocol-ping/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ export interface Ping {
ping(peer: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<number>
}

/**
* @deprecated Use the `Ping` export instead
*/
export type PingService = Ping

export interface PingInit {
protocolPrefix?: string
maxInboundStreams?: number
Expand All @@ -48,11 +43,6 @@ export interface PingInit {
timeout?: number
}

/**
* @deprecated Use the `PingInit` export instead
*/
export type PingServiceInit = PingInit

export interface PingComponents {
registrar: Registrar
connectionManager: ConnectionManager
Expand Down
9 changes: 0 additions & 9 deletions packages/transport-circuit-relay-v2/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,6 @@ export interface CircuitRelayTransportInit extends TransportReservationStoreInit
*/
maxOutboundStopStreams?: number

/**
* Incoming STOP requests (e.g. when a remote peer wants to dial us via a
* relay) must finish the initial protocol negotiation within this timeout in
* ms
*
* @deprecated Configure `connectionManager.inboundUpgradeTimeout` instead
*/
stopTimeout?: number

/**
* When creating a reservation it must complete within this number of ms
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ export interface WebRTCTransportInit {
* Any options here will be applied to any RTCDataChannels that are opened.
*/
dataChannel?: DataChannelOptions

/**
* Inbound connections must complete the upgrade within this many ms
*
* @default 30_000
* @deprecated configure `connectionManager.inboundUpgradeTimeout` instead
*/
inboundConnectionTimeout?: number
}

export interface WebRTCTransportComponents {
Expand Down
10 changes: 0 additions & 10 deletions packages/transport-webrtc/src/private-to-public/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ export interface WebRTCTransportDirectInit {
*/
dataChannel?: DataChannelOptions

/**
* @deprecated use `certificate` instead - this option will be removed in a future release
*/
certificates?: TransportCertificate[]

/**
* Use an existing TLS certificate to secure incoming connections or supply
* settings to generate one.
Expand All @@ -68,11 +63,6 @@ export interface WebRTCTransportDirectInit {
*/
certificate?: TransportCertificate

/**
* @deprecated this setting is ignored and will be removed in a future release
*/
useLibjuice?: boolean

/**
* The key the certificate is stored in the datastore under
*
Expand Down
38 changes: 0 additions & 38 deletions packages/transport-websockets/src/filters.ts

This file was deleted.

Loading
Loading