bump dependencies

This commit is contained in:
Pavel Murygin 2021-04-09 17:59:25 +03:00
parent d39ad01e96
commit b2b6906fb2
6 changed files with 31 additions and 31 deletions

View File

@ -46,7 +46,7 @@
"err-code": "^2.0.0", "err-code": "^2.0.0",
"libp2p-utils": "^0.2.0", "libp2p-utils": "^0.2.0",
"mafmt": "^8.0.0", "mafmt": "^8.0.0",
"multiaddr": "^8.0.0", "multiaddr": "^9.0.1",
"stream-to-it": "^0.2.2" "stream-to-it": "^0.2.2"
}, },
"contributors": [ "contributors": [

View File

@ -16,7 +16,7 @@ function multiaddrToNetConfig (addr) {
} }
function getMultiaddrs (proto, ip, port) { function getMultiaddrs (proto, ip, port) {
const toMa = ip => multiaddr(`/${proto}/${ip}/tcp/${port}`) const toMa = ip => new multiaddr.Multiaddr(`/${proto}/${ip}/tcp/${port}`)
return (isAnyAddr(ip) ? getNetworkAddrs(ProtoFamily[proto]) : [ip]).map(toMa) return (isAnyAddr(ip) ? getNetworkAddrs(ProtoFamily[proto]) : [ip]).map(toMa)
} }

View File

@ -12,9 +12,9 @@ describe('interface-transport compliance', () => {
setup ({ upgrader }) { setup ({ upgrader }) {
const tcp = new TCP({ upgrader }) const tcp = new TCP({ upgrader })
const addrs = [ const addrs = [
multiaddr('/ip4/127.0.0.1/tcp/9091'), new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9091'),
multiaddr('/ip4/127.0.0.1/tcp/9092'), new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9092'),
multiaddr('/ip4/127.0.0.1/tcp/9093') new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9093')
] ]
// Used by the dial tests to simulate a delayed connect // Used by the dial tests to simulate a delayed connect

View File

@ -17,7 +17,7 @@ describe('valid localAddr and remoteAddr', () => {
tcp = new TCP({ upgrader: mockUpgrader }) tcp = new TCP({ upgrader: mockUpgrader })
}) })
const ma = multiaddr('/ip4/127.0.0.1/tcp/0') const ma = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/0')
it('should resolve port 0', async () => { it('should resolve port 0', async () => {
// Create a Promise that resolves when a connection is handled // Create a Promise that resolves when a connection is handled

View File

@ -16,14 +16,14 @@ describe('filter addrs', () => {
}) })
it('filter valid addrs for this transport', () => { it('filter valid addrs for this transport', () => {
const ma1 = multiaddr(base + '/tcp/9090') const ma1 = new multiaddr.Multiaddr(base + '/tcp/9090')
const ma2 = multiaddr(base + '/udp/9090') const ma2 = new multiaddr.Multiaddr(base + '/udp/9090')
const ma3 = multiaddr(base + '/tcp/9090/http') const ma3 = new multiaddr.Multiaddr(base + '/tcp/9090/http')
const ma4 = multiaddr(base + '/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw') const ma4 = new multiaddr.Multiaddr(base + '/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
const ma5 = multiaddr(base + '/tcp/9090/http' + ipfs) const ma5 = new multiaddr.Multiaddr(base + '/tcp/9090/http' + ipfs)
const ma6 = multiaddr('/ip4/127.0.0.1/tcp/9090/p2p-circuit' + ipfs) const ma6 = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9090/p2p-circuit' + ipfs)
const ma7 = multiaddr('/dns4/libp2p.io/tcp/9090') const ma7 = new multiaddr.Multiaddr('/dns4/libp2p.io/tcp/9090')
const ma8 = multiaddr('/dnsaddr/libp2p.io/tcp/9090') const ma8 = new multiaddr.Multiaddr('/dnsaddr/libp2p.io/tcp/9090')
const valid = tcp.filter([ma1, ma2, ma3, ma4, ma5, ma6, ma7, ma8]) const valid = tcp.filter([ma1, ma2, ma3, ma4, ma5, ma6, ma7, ma8])
expect(valid.length).to.equal(4) expect(valid.length).to.equal(4)
@ -32,7 +32,7 @@ describe('filter addrs', () => {
}) })
it('filter a single addr for this transport', () => { it('filter a single addr for this transport', () => {
const ma1 = multiaddr(base + '/tcp/9090') const ma1 = new multiaddr.Multiaddr(base + '/tcp/9090')
const valid = tcp.filter(ma1) const valid = tcp.filter(ma1)
expect(valid.length).to.equal(1) expect(valid.length).to.equal(1)

View File

@ -37,7 +37,7 @@ describe('listen', () => {
}) })
it('close listener with connections, through timeout', async () => { it('close listener with connections, through timeout', async () => {
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw') const mh = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
listener = tcp.createListener((conn) => { listener = tcp.createListener((conn) => {
pipe(conn, conn) pipe(conn, conn)
}) })
@ -62,14 +62,14 @@ describe('listen', () => {
// Windows doesn't support unix paths // Windows doesn't support unix paths
skipOnWindows('listen on path', async () => { skipOnWindows('listen on path', async () => {
const mh = multiaddr(`/unix${path.resolve(os.tmpdir(), '/tmp/p2pd.sock')}`) const mh = new multiaddr.Multiaddr(`/unix${path.resolve(os.tmpdir(), '/tmp/p2pd.sock')}`)
listener = tcp.createListener((conn) => {}) listener = tcp.createListener((conn) => {})
await listener.listen(mh) await listener.listen(mh)
}) })
it('listen on port 0', async () => { it('listen on port 0', async () => {
const mh = multiaddr('/ip4/127.0.0.1/tcp/0') const mh = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/0')
listener = tcp.createListener((conn) => {}) listener = tcp.createListener((conn) => {})
await listener.listen(mh) await listener.listen(mh)
}) })
@ -78,19 +78,19 @@ describe('listen', () => {
if (isCI) { if (isCI) {
return return
} }
const mh = multiaddr('/ip6/::/tcp/9090') const mh = new multiaddr.Multiaddr('/ip6/::/tcp/9090')
listener = tcp.createListener((conn) => {}) listener = tcp.createListener((conn) => {})
await listener.listen(mh) await listener.listen(mh)
}) })
it('listen on any Interface', async () => { it('listen on any Interface', async () => {
const mh = multiaddr('/ip4/0.0.0.0/tcp/9090') const mh = new multiaddr.Multiaddr('/ip4/0.0.0.0/tcp/9090')
listener = tcp.createListener((conn) => {}) listener = tcp.createListener((conn) => {})
await listener.listen(mh) await listener.listen(mh)
}) })
it('getAddrs', async () => { it('getAddrs', async () => {
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090') const mh = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9090')
listener = tcp.createListener((conn) => {}) listener = tcp.createListener((conn) => {})
await listener.listen(mh) await listener.listen(mh)
@ -100,7 +100,7 @@ describe('listen', () => {
}) })
it('getAddrs on port 0 listen', async () => { it('getAddrs on port 0 listen', async () => {
const mh = multiaddr('/ip4/127.0.0.1/tcp/0') const mh = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/0')
listener = tcp.createListener((conn) => {}) listener = tcp.createListener((conn) => {})
await listener.listen(mh) await listener.listen(mh)
@ -109,7 +109,7 @@ describe('listen', () => {
}) })
it('getAddrs from listening on 0.0.0.0', async () => { it('getAddrs from listening on 0.0.0.0', async () => {
const mh = multiaddr('/ip4/0.0.0.0/tcp/9090') const mh = new multiaddr.Multiaddr('/ip4/0.0.0.0/tcp/9090')
listener = tcp.createListener((conn) => {}) listener = tcp.createListener((conn) => {})
await listener.listen(mh) await listener.listen(mh)
@ -119,7 +119,7 @@ describe('listen', () => {
}) })
it('getAddrs from listening on 0.0.0.0 and port 0', async () => { it('getAddrs from listening on 0.0.0.0 and port 0', async () => {
const mh = multiaddr('/ip4/0.0.0.0/tcp/0') const mh = new multiaddr.Multiaddr('/ip4/0.0.0.0/tcp/0')
listener = tcp.createListener((conn) => {}) listener = tcp.createListener((conn) => {})
await listener.listen(mh) await listener.listen(mh)
@ -129,7 +129,7 @@ describe('listen', () => {
}) })
it('getAddrs preserves IPFS Id', async () => { it('getAddrs preserves IPFS Id', async () => {
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw') const mh = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
listener = tcp.createListener((conn) => {}) listener = tcp.createListener((conn) => {})
await listener.listen(mh) await listener.listen(mh)
@ -142,7 +142,7 @@ describe('listen', () => {
describe('dial', () => { describe('dial', () => {
let tcp let tcp
let listener let listener
const ma = multiaddr('/ip4/127.0.0.1/tcp/9090') const ma = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9090')
beforeEach(async () => { beforeEach(async () => {
tcp = new TCP({ tcp = new TCP({
@ -177,7 +177,7 @@ describe('dial', () => {
return return
} }
const ma = multiaddr('/ip6/::/tcp/9066') const ma = new multiaddr.Multiaddr('/ip6/::/tcp/9066')
const listener = tcp.createListener((conn) => { const listener = tcp.createListener((conn) => {
pipe(conn, conn) pipe(conn, conn)
}) })
@ -195,7 +195,7 @@ describe('dial', () => {
// Windows doesn't support unix paths // Windows doesn't support unix paths
skipOnWindows('dial on path', async () => { skipOnWindows('dial on path', async () => {
const ma = multiaddr(`/unix${path.resolve(os.tmpdir(), '/tmp/p2pd.sock')}`) const ma = new multiaddr.Multiaddr(`/unix${path.resolve(os.tmpdir(), '/tmp/p2pd.sock')}`)
const listener = tcp.createListener((conn) => { const listener = tcp.createListener((conn) => {
pipe(conn, conn) pipe(conn, conn)
@ -220,7 +220,7 @@ describe('dial', () => {
handled = resolve handled = resolve
}) })
const ma = multiaddr('/ip6/::/tcp/0') const ma = new multiaddr.Multiaddr('/ip6/::/tcp/0')
const listener = tcp.createListener(async (conn) => { const listener = tcp.createListener(async (conn) => {
await pipe( await pipe(
@ -248,7 +248,7 @@ describe('dial', () => {
handled = resolve handled = resolve
}) })
const ma = multiaddr('/ip6/::/tcp/0') const ma = new multiaddr.Multiaddr('/ip6/::/tcp/0')
const listener = tcp.createListener(async (conn) => { const listener = tcp.createListener(async (conn) => {
// pull(conn, pull.onEnd(destroyed)) // pull(conn, pull.onEnd(destroyed))
@ -265,7 +265,7 @@ describe('dial', () => {
}) })
it('dial on IPv4 with IPFS Id', async () => { it('dial on IPv4 with IPFS Id', async () => {
const ma = multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw') const ma = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
const conn = await tcp.dial(ma) const conn = await tcp.dial(ma)
const res = await pipe( const res = await pipe(