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

Commit

Permalink
deps(dev): bump aegir from 38.1.8 to 39.0.10 (#279)
Browse files Browse the repository at this point in the history
* deps(dev): bump aegir from 38.1.8 to 39.0.10

Bumps [aegir](https://github.com/ipfs/aegir) from 38.1.8 to 39.0.10.
- [Release notes](https://github.com/ipfs/aegir/releases)
- [Changelog](https://github.com/ipfs/aegir/blob/master/CHANGELOG.md)
- [Commits](ipfs/aegir@v38.1.8...v39.0.10)

---
updated-dependencies:
- dependency-name: aegir
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore: fix linting

* chore: fix build

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: achingbrain <[email protected]>
  • Loading branch information
dependabot[bot] and achingbrain authored Jun 15, 2023
1 parent ff5f44a commit 3ed1235
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 50 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@
"@libp2p/utils": "^3.0.2",
"@multiformats/mafmt": "^12.0.0",
"@multiformats/multiaddr": "^12.0.0",
"@types/sinon": "^10.0.15",
"stream-to-it": "^0.2.2"
},
"devDependencies": {
"@libp2p/interface-mocks": "^12.0.1",
"@libp2p/interface-transport-compliance-tests": "^4.0.0",
"aegir": "^38.1.0",
"aegir": "^39.0.10",
"it-all": "^3.0.1",
"it-pipe": "^3.0.1",
"p-defer": "^4.0.0",
Expand Down
24 changes: 10 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import net from 'net'
import * as mafmt from '@multiformats/mafmt'
import { type CreateListenerOptions, type DialOptions, type Listener, symbol, type Transport } from '@libp2p/interface-transport'
import { AbortError, CodeError } from '@libp2p/interfaces/errors'
import { logger } from '@libp2p/logger'
import * as mafmt from '@multiformats/mafmt'
import { CODE_CIRCUIT, CODE_P2P, CODE_UNIX } from './constants.js'
import { type CloseServerOnMaxConnectionsOpts, TCPListener } from './listener.js'
import { toMultiaddrConnection } from './socket-to-conn.js'
import { CloseServerOnMaxConnectionsOpts, TCPListener } from './listener.js'
import { multiaddrToNetConfig } from './utils.js'
import { AbortError, CodeError } from '@libp2p/interfaces/errors'
import { CODE_CIRCUIT, CODE_P2P, CODE_UNIX } from './constants.js'
import { CreateListenerOptions, DialOptions, Listener, symbol, Transport } from '@libp2p/interface-transport'
import type { AbortOptions, Multiaddr } from '@multiformats/multiaddr'
import type { Socket, IpcSocketConnectOpts, TcpSocketConnectOpts } from 'net'
import type { Connection } from '@libp2p/interface-connection'
import type { CounterGroup, Metrics } from '@libp2p/interface-metrics'
import type { AbortOptions, Multiaddr } from '@multiformats/multiaddr'
import type { Socket, IpcSocketConnectOpts, TcpSocketConnectOpts } from 'net'

const log = logger('libp2p:tcp')

Expand Down Expand Up @@ -94,13 +94,9 @@ class TCP implements Transport {
}
}

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

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

async dial (ma: Multiaddr, options: TCPDialOptions): Promise<Connection> {
options.keepAlive = options.keepAlive ?? true
Expand Down Expand Up @@ -149,7 +145,7 @@ class TCP implements Transport {
throw new AbortError()
}

return await new Promise<Socket>((resolve, reject) => {
return new Promise<Socket>((resolve, reject) => {
const start = Date.now()
const cOpts = multiaddrToNetConfig(ma) as (IpcSocketConnectOpts & TcpSocketConnectOpts)
const cOptsStr = cOpts.path ?? `${cOpts.host ?? ''}:${cOpts.port}`
Expand Down
10 changes: 5 additions & 5 deletions src/listener.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import net from 'net'
import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events'
import { logger } from '@libp2p/logger'
import { toMultiaddrConnection } from './socket-to-conn.js'
import { CODE_P2P } from './constants.js'
import { toMultiaddrConnection } from './socket-to-conn.js'
import {
getMultiaddrs,
multiaddrToNetConfig,
NetConfig
type NetConfig
} from './utils.js'
import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events'
import type { TCPCreateListenerOptions } from './index.js'
import type { MultiaddrConnection, Connection } from '@libp2p/interface-connection'
import type { CounterGroup, MetricGroup, Metrics } from '@libp2p/interface-metrics'
import type { Upgrader, Listener, ListenerEvents } from '@libp2p/interface-transport'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { TCPCreateListenerOptions } from './index.js'
import type { CounterGroup, MetricGroup, Metrics } from '@libp2p/interface-metrics'

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

Expand Down
8 changes: 4 additions & 4 deletions src/socket-to-conn.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { CodeError } from '@libp2p/interfaces/errors'
import { logger } from '@libp2p/logger'
import { ipPortToMultiaddr as toMultiaddr } from '@libp2p/utils/ip-port-to-multiaddr'
// @ts-expect-error no types
import toIterable from 'stream-to-it'
import { ipPortToMultiaddr as toMultiaddr } from '@libp2p/utils/ip-port-to-multiaddr'
import { CLOSE_TIMEOUT, SOCKET_TIMEOUT } from './constants.js'
import { multiaddrToNetConfig } from './utils.js'
import { CodeError } from '@libp2p/interfaces/errors'
import type { Socket } from 'net'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { MultiaddrConnection } from '@libp2p/interface-connection'
import type { CounterGroup } from '@libp2p/interface-metrics'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { Socket } from 'net'

const log = logger('libp2p:tcp:socket')

Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os from 'os'
import path from 'path'
import { multiaddr } from '@multiformats/multiaddr'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { ListenOptions, IpcSocketConnectOpts, TcpSocketConnectOpts } from 'net'
import os from 'os'
import path from 'path'

const ProtoFamily = { ip4: 'IPv4', ip6: 'IPv6' }

Expand Down
4 changes: 2 additions & 2 deletions test/compliance.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sinon from 'sinon'
import net from 'net'
import tests from '@libp2p/interface-transport-compliance-tests'
import { multiaddr } from '@multiformats/multiaddr'
import net from 'net'
import sinon from 'sinon'
import { tcp } from '../src/index.js'

describe('interface-transport compliance', () => {
Expand Down
6 changes: 3 additions & 3 deletions test/connection.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { mockUpgrader } from '@libp2p/interface-mocks'
import { EventEmitter } from '@libp2p/interfaces/events'
import { multiaddr } from '@multiformats/multiaddr'
import { expect } from 'aegir/chai'
import { tcp } from '../src/index.js'
import { multiaddr } from '@multiformats/multiaddr'
import { mockUpgrader } from '@libp2p/interface-mocks'
import type { Connection } from '@libp2p/interface-connection'
import type { Transport, Upgrader } from '@libp2p/interface-transport'
import { EventEmitter } from '@libp2p/interfaces/events'

describe('valid localAddr and remoteAddr', () => {
let transport: Transport
Expand Down
2 changes: 1 addition & 1 deletion test/filter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { multiaddr } from '@multiformats/multiaddr'
import { expect } from 'aegir/chai'
import { tcp } from '../src/index.js'
import { multiaddr } from '@multiformats/multiaddr'
import type { Transport } from '@libp2p/interface-transport'

describe('filter addrs', () => {
Expand Down
22 changes: 11 additions & 11 deletions test/listen-dial.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { expect } from 'aegir/chai'
import { tcp } from '../src/index.js'
import os from 'os'
import path from 'path'
import { mockRegistrar, 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 { mockRegistrar, mockUpgrader } from '@libp2p/interface-mocks'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import type { Transport, Upgrader } from '@libp2p/interface-transport'
import { pipe } from 'it-pipe'
import pDefer from 'p-defer'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { tcp } from '../src/index.js'
import type { MultiaddrConnection } from '@libp2p/interface-connection'
import { EventEmitter } from '@libp2p/interfaces/events'
import type { Transport, Upgrader } from '@libp2p/interface-transport'

const isCI = process.env.CI

Expand Down Expand Up @@ -196,7 +196,7 @@ describe('dial', () => {
const values = await pipe(
[uint8ArrayFromString('hey')],
stream,
async (source) => await all(source)
async (source) => all(source)
)

expect(values[0].subarray()).to.equalBytes(uint8ArrayFromString('hey'))
Expand All @@ -222,7 +222,7 @@ describe('dial', () => {
const values = await pipe(
[uint8ArrayFromString('hey')],
stream,
async (source) => await all(source)
async (source) => all(source)
)
expect(values[0].subarray()).to.equalBytes(uint8ArrayFromString('hey'))
await conn.close()
Expand All @@ -244,7 +244,7 @@ describe('dial', () => {
const values = await pipe(
[uint8ArrayFromString('hey')],
stream,
async (source) => await all(source)
async (source) => all(source)
)

expect(values[0].subarray()).to.equalBytes(uint8ArrayFromString('hey'))
Expand Down Expand Up @@ -326,7 +326,7 @@ describe('dial', () => {
const values = await pipe(
[uint8ArrayFromString('hey')],
stream,
async (source) => await all(source)
async (source) => all(source)
)
expect(values[0].subarray()).to.equalBytes(uint8ArrayFromString('hey'))

Expand Down
4 changes: 2 additions & 2 deletions test/max-connections-close.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import net from 'node:net'
import { promisify } from 'util'
import { expect } from 'aegir/chai'
import { mockUpgrader } from '@libp2p/interface-mocks'
import { EventEmitter } from '@libp2p/interfaces/events'
import { multiaddr } from '@multiformats/multiaddr'
import { expect } from 'aegir/chai'
import { tcp } from '../src/index.js'
import type { TCPListener } from '../src/listener.js'
import { EventEmitter } from '@libp2p/interfaces/events'

describe('close server on maxConnections', () => {
const afterEachCallbacks: Array<() => Promise<any> | any> = []
Expand Down
4 changes: 2 additions & 2 deletions test/max-connections.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { expect } from 'aegir/chai'
import net from 'node:net'
import { promisify } from 'node:util'
import { mockUpgrader } from '@libp2p/interface-mocks'
import { EventEmitter } from '@libp2p/interfaces/events'
import { multiaddr } from '@multiformats/multiaddr'
import { expect } from 'aegir/chai'
import { tcp } from '../src/index.js'
import { EventEmitter } from '@libp2p/interfaces/events'

describe('maxConnections', () => {
const afterEachCallbacks: Array<() => Promise<any> | any> = []
Expand Down
5 changes: 2 additions & 3 deletions test/socket-to-conn.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { createServer, Socket, type Server, type ServerOpts, type SocketConstructorOpts } from 'net'
import os from 'os'
import { expect } from 'aegir/chai'
import { createServer, Socket, Server } from 'net'
import defer from 'p-defer'
import { toMultiaddrConnection } from '../src/socket-to-conn.js'
import os from 'os'
import type { ServerOpts, SocketConstructorOpts } from 'net'

async function setup (opts?: { server?: ServerOpts, client?: SocketConstructorOpts }): Promise<{ server: Server, serverSocket: Socket, clientSocket: Socket }> {
const serverListening = defer()
Expand Down

0 comments on commit 3ed1235

Please sign in to comment.