Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

deps(dev): bump aegir from 38.1.8 to 39.0.9 #245

Merged
merged 2 commits into from
Jun 6, 2023
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
"devDependencies": {
"@libp2p/interface-mocks": "^11.0.0",
"@libp2p/interface-transport-compliance-tests": "^4.0.0",
"aegir": "^38.1.7",
"aegir": "^39.0.9",
"is-loopback-addr": "^2.0.1",
"it-all": "^3.0.1",
"it-drain": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/filters.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as mafmt from '@multiformats/mafmt'
import type { Multiaddr } from '@multiformats/multiaddr'
import {
CODE_CIRCUIT,
CODE_P2P,
CODE_TCP,
CODE_WS,
CODE_WSS
} from './constants.js'
import type { Multiaddr } from '@multiformats/multiaddr'

export function all (multiaddrs: Multiaddr[]): Multiaddr[] {
return multiaddrs.filter((ma) => {
Expand Down
20 changes: 8 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { connect, WebSocketOptions } from 'it-ws/client'
import { multiaddrToUri as toUri } from '@multiformats/multiaddr-to-uri'
import { type Transport, type MultiaddrFilter, symbol, type CreateListenerOptions, type DialOptions, type Listener } from '@libp2p/interface-transport'
import { AbortError } from '@libp2p/interfaces/errors'
import pDefer from 'p-defer'
import { logger } from '@libp2p/logger'
import { multiaddrToUri as toUri } from '@multiformats/multiaddr-to-uri'
import { connect, type WebSocketOptions } from 'it-ws/client'
import pDefer from 'p-defer'
import { isBrowser, isWebWorker } from 'wherearewe'
import * as filters from './filters.js'
import { createListener } from './listener.js'
import { socketToMaConn } from './socket-to-conn.js'
import * as filters from './filters.js'
import { Transport, MultiaddrFilter, symbol, CreateListenerOptions, DialOptions, Listener } from '@libp2p/interface-transport'
import type { Connection } from '@libp2p/interface-connection'
import type { AbortOptions } from '@libp2p/interfaces'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { Server } from 'http'
import type { DuplexWebSocket } from 'it-ws/duplex'
import type { ClientOptions } from 'ws'
import type { Server } from 'http'

const log = logger('libp2p:websockets')

Expand All @@ -30,13 +30,9 @@ class WebSockets implements Transport {
this.init = init
}

get [Symbol.toStringTag] (): string {
return '@libp2p/websockets'
}
readonly [Symbol.toStringTag] = '@libp2p/websockets'

get [symbol] (): true {
return true
}
readonly [symbol] = true

async dial (ma: Multiaddr, options: DialOptions): Promise<Connection> {
log('dialing %s', ma)
Expand Down
12 changes: 6 additions & 6 deletions src/listener.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import os from 'os'
import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events'
import { logger } from '@libp2p/logger'
import { ipPortToMultiaddr as toMultiaddr } from '@libp2p/utils/ip-port-to-multiaddr'
import { multiaddr, protocols } from '@multiformats/multiaddr'
import { createServer } from 'it-ws/server'
import { logger } from '@libp2p/logger'
import { socketToMaConn } from './socket-to-conn.js'
import { ipPortToMultiaddr as toMultiaddr } from '@libp2p/utils/ip-port-to-multiaddr'
import type { Connection } from '@libp2p/interface-connection'
import type { Listener, ListenerEvents, CreateListenerOptions } from '@libp2p/interface-transport'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { Server } from 'http'
import type { WebSocketServer } from 'it-ws/server'
import type { DuplexWebSocket } from 'it-ws/duplex'
import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events'
import type { Connection } from '@libp2p/interface-connection'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { WebSocketServer } from 'it-ws/server'

const log = logger('libp2p:websockets:listener')

Expand Down
6 changes: 3 additions & 3 deletions src/socket-to-conn.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { logger } from '@libp2p/logger'
import { abortableSource } from 'abortable-iterator'
import { CLOSE_TIMEOUT } from './constants.js'
import pTimeout from 'p-timeout'
import { logger } from '@libp2p/logger'
import type { AbortOptions } from '@libp2p/interfaces'
import { CLOSE_TIMEOUT } from './constants.js'
import type { MultiaddrConnection } from '@libp2p/interface-connection'
import type { AbortOptions } from '@libp2p/interfaces'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { DuplexWebSocket } from 'it-ws/duplex'

Expand Down
16 changes: 8 additions & 8 deletions test/browser.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/* eslint-env mocha */

import { expect } from 'aegir/chai'
import { mockUpgrader } from '@libp2p/interface-mocks'
import { EventEmitter } from '@libp2p/interfaces/events'
import { multiaddr } from '@multiformats/multiaddr'
import { pipe } from 'it-pipe'
import { expect } from 'aegir/chai'
import all from 'it-all'
import { pipe } from 'it-pipe'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { webSockets } from '../src/index.js'
import { mockUpgrader } from '@libp2p/interface-mocks'
import { isBrowser, isWebWorker } from 'wherearewe'
import { webSockets } from '../src/index.js'
import type { Connection } from '@libp2p/interface-connection'
import type { Transport } from '@libp2p/interface-transport'
import { EventEmitter } from '@libp2p/interfaces/events'

const protocol = '/echo/1.0.0'

Expand Down Expand Up @@ -39,7 +39,7 @@ describe('libp2p-websockets', () => {
const res = await pipe(
[data],
stream,
async (source) => await all(source)
async (source) => all(source)
)

expect(res[0].subarray()).to.equalBytes(data)
Expand Down Expand Up @@ -69,7 +69,7 @@ describe('libp2p-websockets', () => {
const res = await pipe(
[data],
stream,
async (source) => await all(source)
async (source) => all(source)
)

expect(res[0].subarray()).to.deep.equal(data)
Expand All @@ -85,7 +85,7 @@ describe('libp2p-websockets', () => {
const res = await pipe(
data,
stream,
async (source) => await all(source)
async (source) => all(source)
)

expect(res.map(list => list.subarray())).to.deep.equal(data)
Expand Down
4 changes: 2 additions & 2 deletions test/compliance.node.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-env mocha */

import http from 'http'
import tests from '@libp2p/interface-transport-compliance-tests'
import { multiaddr } from '@multiformats/multiaddr'
import http from 'http'
import { webSockets } from '../src/index.js'
import * as filters from '../src/filters.js'
import { webSockets } from '../src/index.js'
import type { WebSocketListenerInit } from '../src/listener.js'
import type { Listener } from '@libp2p/interface-transport'

Expand Down
20 changes: 10 additions & 10 deletions test/node.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
/* eslint-env mocha */
/* eslint max-nested-callbacks: ["error", 6] */

import https from 'https'
import http from 'http'
import fs from 'fs'
import { expect } from 'aegir/chai'
import http from 'http'
import https from 'https'
import { mockRegistrar, mockUpgrader } from '@libp2p/interface-mocks'
import { EventEmitter } from '@libp2p/interfaces/events'
import { multiaddr } from '@multiformats/multiaddr'
import { goodbye } from 'it-goodbye'
import { expect } from 'aegir/chai'
import { isLoopbackAddr } from 'is-loopback-addr'
import all from 'it-all'
import drain from 'it-drain'
import { goodbye } from 'it-goodbye'
import { pipe } from 'it-pipe'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { mockRegistrar, mockUpgrader } from '@libp2p/interface-mocks'
import defer from 'p-defer'
import waitFor from 'p-wait-for'
import { webSockets } from '../src/index.js'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import * as filters from '../src/filters.js'
import drain from 'it-drain'
import { webSockets } from '../src/index.js'
import type { Listener, Transport } from '@libp2p/interface-transport'
import type { Uint8ArrayList } from 'uint8arraylist'
import type { Source } from 'it-stream-types'
import type { Uint8ArrayList } from 'uint8arraylist'
import './compliance.node.js'
import { EventEmitter } from '@libp2p/interfaces/events'

async function * toBuffers (source: Source<Uint8ArrayList>): AsyncGenerator<Uint8Array, void, undefined> {
for await (const list of source) {
Expand Down