Skip to content

Commit

Permalink
fix: update to new interfaces (#218)
Browse files Browse the repository at this point in the history
libp2p/js-libp2p-interfaces#294 made the outbound
peer id optional in the connection encrypter interface so apply that
change to the noise codebase.
  • Loading branch information
achingbrain authored Oct 3, 2022
1 parent 77a95fd commit 2a04b51
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,20 @@
"uint8arrays": "^3.1.0"
},
"devDependencies": {
"@libp2p/daemon-client": "2.0.4",
"@libp2p/daemon-client": "^3.0.1",
"@libp2p/daemon-server": "^3.0.0",
"@libp2p/interface-connection-encrypter-compliance-tests": "^2.0.1",
"@libp2p/interop": "^2.1.0",
"@libp2p/interop": "^3.0.1",
"@libp2p/mplex": "^5.0.0",
"@libp2p/peer-id-factory": "^1.0.8",
"@libp2p/tcp": "^3.0.3",
"@multiformats/multiaddr": "^10.3.3",
"@multiformats/multiaddr": "^11.0.3",
"aegir": "^37.3.0",
"benchmark": "^2.1.4",
"execa": "^6.1.0",
"go-libp2p": "^0.0.6",
"iso-random-stream": "^2.0.2",
"libp2p": "0.39.1",
"libp2p": "0.39.2",
"mkdirp": "^1.0.4",
"p-defer": "^4.0.0",
"protons": "^5.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/noise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class Noise implements INoiseConnection {
* @param {PeerId} remotePeer - PeerId of the remote peer. Used to validate the integrity of the remote peer.
* @returns {Promise<SecuredConnection>}
*/
public async secureOutbound (localPeer: PeerId, connection: Duplex<Uint8Array>, remotePeer: PeerId): Promise<SecuredConnection> {
public async secureOutbound (localPeer: PeerId, connection: Duplex<Uint8Array>, remotePeer?: PeerId): Promise<SecuredConnection> {
const wrappedConnection = pbStream(
connection,
{
Expand Down
6 changes: 3 additions & 3 deletions test/interop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createServer } from '@libp2p/daemon-server'
import { createClient } from '@libp2p/daemon-client'
import { createLibp2p, Libp2pOptions } from 'libp2p'
import { TCP } from '@libp2p/tcp'
import { Multiaddr } from '@multiformats/multiaddr'
import { multiaddr } from '@multiformats/multiaddr'
import { path as p2pd } from 'go-libp2p'
import { execa } from 'execa'
import pDefer from 'p-defer'
Expand All @@ -18,7 +18,7 @@ import { Noise } from '../src/index.js'

async function createGoPeer (options: SpawnOptions): Promise<Daemon> {
const controlPort = Math.floor(Math.random() * (50000 - 10000 + 1)) + 10000
const apiAddr = new Multiaddr(`/ip4/0.0.0.0/tcp/${controlPort}`)
const apiAddr = multiaddr(`/ip4/0.0.0.0/tcp/${controlPort}`)

const log = logger(`go-libp2p:${controlPort}`)

Expand Down Expand Up @@ -82,7 +82,7 @@ async function createJsPeer (options: SpawnOptions): Promise<Daemon> {
}

const node = await createLibp2p(opts)
const server = await createServer(new Multiaddr('/ip4/0.0.0.0/tcp/0'), node as any)
const server = await createServer(multiaddr('/ip4/0.0.0.0/tcp/0'), node as any)
await server.start()

return {
Expand Down

0 comments on commit 2a04b51

Please sign in to comment.