mirror of
https://github.com/fluencelabs/js-libp2p-tcp
synced 2025-04-24 16:32:29 +00:00
bump dependencies
This commit is contained in:
parent
d39ad01e96
commit
b2b6906fb2
@ -46,7 +46,7 @@
|
||||
"err-code": "^2.0.0",
|
||||
"libp2p-utils": "^0.2.0",
|
||||
"mafmt": "^8.0.0",
|
||||
"multiaddr": "^8.0.0",
|
||||
"multiaddr": "^9.0.1",
|
||||
"stream-to-it": "^0.2.2"
|
||||
},
|
||||
"contributors": [
|
||||
|
@ -16,7 +16,7 @@ function multiaddrToNetConfig (addr) {
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -12,9 +12,9 @@ describe('interface-transport compliance', () => {
|
||||
setup ({ upgrader }) {
|
||||
const tcp = new TCP({ upgrader })
|
||||
const addrs = [
|
||||
multiaddr('/ip4/127.0.0.1/tcp/9091'),
|
||||
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/9091'),
|
||||
new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9092'),
|
||||
new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9093')
|
||||
]
|
||||
|
||||
// Used by the dial tests to simulate a delayed connect
|
||||
|
@ -17,7 +17,7 @@ describe('valid localAddr and remoteAddr', () => {
|
||||
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 () => {
|
||||
// Create a Promise that resolves when a connection is handled
|
||||
|
@ -16,14 +16,14 @@ describe('filter addrs', () => {
|
||||
})
|
||||
|
||||
it('filter valid addrs for this transport', () => {
|
||||
const ma1 = multiaddr(base + '/tcp/9090')
|
||||
const ma2 = multiaddr(base + '/udp/9090')
|
||||
const ma3 = multiaddr(base + '/tcp/9090/http')
|
||||
const ma4 = multiaddr(base + '/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
|
||||
const ma5 = multiaddr(base + '/tcp/9090/http' + ipfs)
|
||||
const ma6 = multiaddr('/ip4/127.0.0.1/tcp/9090/p2p-circuit' + ipfs)
|
||||
const ma7 = multiaddr('/dns4/libp2p.io/tcp/9090')
|
||||
const ma8 = multiaddr('/dnsaddr/libp2p.io/tcp/9090')
|
||||
const ma1 = new multiaddr.Multiaddr(base + '/tcp/9090')
|
||||
const ma2 = new multiaddr.Multiaddr(base + '/udp/9090')
|
||||
const ma3 = new multiaddr.Multiaddr(base + '/tcp/9090/http')
|
||||
const ma4 = new multiaddr.Multiaddr(base + '/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
|
||||
const ma5 = new multiaddr.Multiaddr(base + '/tcp/9090/http' + ipfs)
|
||||
const ma6 = new multiaddr.Multiaddr('/ip4/127.0.0.1/tcp/9090/p2p-circuit' + ipfs)
|
||||
const ma7 = new multiaddr.Multiaddr('/dns4/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])
|
||||
expect(valid.length).to.equal(4)
|
||||
@ -32,7 +32,7 @@ describe('filter addrs', () => {
|
||||
})
|
||||
|
||||
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)
|
||||
expect(valid.length).to.equal(1)
|
||||
|
@ -37,7 +37,7 @@ describe('listen', () => {
|
||||
})
|
||||
|
||||
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) => {
|
||||
pipe(conn, conn)
|
||||
})
|
||||
@ -62,14 +62,14 @@ describe('listen', () => {
|
||||
|
||||
// Windows doesn't support unix paths
|
||||
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) => {})
|
||||
await listener.listen(mh)
|
||||
})
|
||||
|
||||
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) => {})
|
||||
await listener.listen(mh)
|
||||
})
|
||||
@ -78,19 +78,19 @@ describe('listen', () => {
|
||||
if (isCI) {
|
||||
return
|
||||
}
|
||||
const mh = multiaddr('/ip6/::/tcp/9090')
|
||||
const mh = new multiaddr.Multiaddr('/ip6/::/tcp/9090')
|
||||
listener = tcp.createListener((conn) => {})
|
||||
await listener.listen(mh)
|
||||
})
|
||||
|
||||
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) => {})
|
||||
await listener.listen(mh)
|
||||
})
|
||||
|
||||
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) => {})
|
||||
await listener.listen(mh)
|
||||
|
||||
@ -100,7 +100,7 @@ describe('listen', () => {
|
||||
})
|
||||
|
||||
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) => {})
|
||||
await listener.listen(mh)
|
||||
|
||||
@ -109,7 +109,7 @@ describe('listen', () => {
|
||||
})
|
||||
|
||||
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) => {})
|
||||
await listener.listen(mh)
|
||||
|
||||
@ -119,7 +119,7 @@ describe('listen', () => {
|
||||
})
|
||||
|
||||
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) => {})
|
||||
await listener.listen(mh)
|
||||
|
||||
@ -129,7 +129,7 @@ describe('listen', () => {
|
||||
})
|
||||
|
||||
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) => {})
|
||||
await listener.listen(mh)
|
||||
|
||||
@ -142,7 +142,7 @@ describe('listen', () => {
|
||||
describe('dial', () => {
|
||||
let tcp
|
||||
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 () => {
|
||||
tcp = new TCP({
|
||||
@ -177,7 +177,7 @@ describe('dial', () => {
|
||||
return
|
||||
}
|
||||
|
||||
const ma = multiaddr('/ip6/::/tcp/9066')
|
||||
const ma = new multiaddr.Multiaddr('/ip6/::/tcp/9066')
|
||||
const listener = tcp.createListener((conn) => {
|
||||
pipe(conn, conn)
|
||||
})
|
||||
@ -195,7 +195,7 @@ describe('dial', () => {
|
||||
|
||||
// Windows doesn't support unix paths
|
||||
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) => {
|
||||
pipe(conn, conn)
|
||||
@ -220,7 +220,7 @@ describe('dial', () => {
|
||||
handled = resolve
|
||||
})
|
||||
|
||||
const ma = multiaddr('/ip6/::/tcp/0')
|
||||
const ma = new multiaddr.Multiaddr('/ip6/::/tcp/0')
|
||||
|
||||
const listener = tcp.createListener(async (conn) => {
|
||||
await pipe(
|
||||
@ -248,7 +248,7 @@ describe('dial', () => {
|
||||
handled = resolve
|
||||
})
|
||||
|
||||
const ma = multiaddr('/ip6/::/tcp/0')
|
||||
const ma = new multiaddr.Multiaddr('/ip6/::/tcp/0')
|
||||
|
||||
const listener = tcp.createListener(async (conn) => {
|
||||
// pull(conn, pull.onEnd(destroyed))
|
||||
@ -265,7 +265,7 @@ describe('dial', () => {
|
||||
})
|
||||
|
||||
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 res = await pipe(
|
||||
|
Loading…
x
Reference in New Issue
Block a user