mirror of
https://github.com/fluencelabs/js-libp2p-websockets
synced 2025-04-03 01:11:20 +00:00
update multiaddr and mafmt to support websockets name change
This commit is contained in:
parent
9e7568b825
commit
2fe87d0bfb
@ -8,7 +8,7 @@ let ws
|
|||||||
|
|
||||||
gulp.task('test:browser:before', (done) => {
|
gulp.task('test:browser:before', (done) => {
|
||||||
ws = new WSlibp2p()
|
ws = new WSlibp2p()
|
||||||
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/ws')
|
||||||
ws.createListener(mh, (socket) => {
|
ws.createListener(mh, (socket) => {
|
||||||
socket.pipe(socket)
|
socket.pipe(socket)
|
||||||
}, done)
|
}, done)
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/diasdavid/js-libp2p-websockets#readme",
|
"homepage": "https://github.com/diasdavid/js-libp2p-websockets#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"mafmt": "^1.0.1",
|
"mafmt": "^2.0.0",
|
||||||
"multiaddr": "^1.1.1",
|
"multiaddr": "^2.0.0",
|
||||||
"run-parallel": "^1.1.6",
|
"run-parallel": "^1.1.6",
|
||||||
"simple-websocket": "github:diasdavid/simple-websocket#ec31437"
|
"simple-websocket": "github:diasdavid/simple-websocket#ec31437"
|
||||||
},
|
},
|
||||||
|
@ -16,7 +16,7 @@ describe('libp2p-websockets', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('echo', (done) => {
|
it('echo', (done) => {
|
||||||
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/ws')
|
||||||
const conn = ws.dial(mh)
|
const conn = ws.dial(mh)
|
||||||
const message = 'Hello World!'
|
const message = 'Hello World!'
|
||||||
conn.write(message)
|
conn.write(message)
|
||||||
@ -29,7 +29,7 @@ describe('libp2p-websockets', function () {
|
|||||||
|
|
||||||
describe('stress', () => {
|
describe('stress', () => {
|
||||||
it('one big write', (done) => {
|
it('one big write', (done) => {
|
||||||
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/ws')
|
||||||
const conn = ws.dial(mh)
|
const conn = ws.dial(mh)
|
||||||
const message = new Buffer(1000000).fill('a').toString('hex')
|
const message = new Buffer(1000000).fill('a').toString('hex')
|
||||||
conn.write(message)
|
conn.write(message)
|
||||||
@ -41,7 +41,7 @@ describe('libp2p-websockets', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('many writes in 2 batches', (done) => {
|
it('many writes in 2 batches', (done) => {
|
||||||
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/ws')
|
||||||
const conn = ws.dial(mh)
|
const conn = ws.dial(mh)
|
||||||
let expected = ''
|
let expected = ''
|
||||||
let counter = 0
|
let counter = 0
|
||||||
|
14
test/node.js
14
test/node.js
@ -16,7 +16,7 @@ describe('libp2p-websockets', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('listen and dial', (done) => {
|
it('listen and dial', (done) => {
|
||||||
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/ws')
|
||||||
ws.createListener(mh, (socket) => {
|
ws.createListener(mh, (socket) => {
|
||||||
expect(socket).to.exist
|
expect(socket).to.exist
|
||||||
socket.end()
|
socket.end()
|
||||||
@ -28,8 +28,8 @@ describe('libp2p-websockets', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('listen on several', (done) => {
|
it('listen on several', (done) => {
|
||||||
const mh1 = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
const mh1 = multiaddr('/ip4/127.0.0.1/tcp/9090/ws')
|
||||||
const mh2 = multiaddr('/ip4/127.0.0.1/tcp/9091/websockets')
|
const mh2 = multiaddr('/ip4/127.0.0.1/tcp/9091/ws')
|
||||||
const ws = new WSlibp2p()
|
const ws = new WSlibp2p()
|
||||||
|
|
||||||
ws.createListener([mh1, mh2], (socket) => {}, () => {
|
ws.createListener([mh1, mh2], (socket) => {}, () => {
|
||||||
@ -38,7 +38,7 @@ describe('libp2p-websockets', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('get observed addrs', (done) => {
|
it('get observed addrs', (done) => {
|
||||||
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/ws')
|
||||||
ws.createListener(mh, (socket) => {
|
ws.createListener(mh, (socket) => {
|
||||||
expect(socket).to.exist
|
expect(socket).to.exist
|
||||||
socket.end()
|
socket.end()
|
||||||
@ -53,7 +53,7 @@ describe('libp2p-websockets', function () {
|
|||||||
it('filter', (done) => {
|
it('filter', (done) => {
|
||||||
const mh1 = multiaddr('/ip4/127.0.0.1/tcp/9090')
|
const mh1 = multiaddr('/ip4/127.0.0.1/tcp/9090')
|
||||||
const mh2 = multiaddr('/ip4/127.0.0.1/udp/9090')
|
const mh2 = multiaddr('/ip4/127.0.0.1/udp/9090')
|
||||||
const mh3 = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
const mh3 = multiaddr('/ip4/127.0.0.1/tcp/9090/ws')
|
||||||
|
|
||||||
const valid = ws.filter([mh1, mh2, mh3])
|
const valid = ws.filter([mh1, mh2, mh3])
|
||||||
expect(valid.length).to.equal(1)
|
expect(valid.length).to.equal(1)
|
||||||
@ -62,7 +62,7 @@ describe('libp2p-websockets', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('echo', (done) => {
|
it('echo', (done) => {
|
||||||
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/ws')
|
||||||
ws.createListener(mh, (conn) => {
|
ws.createListener(mh, (conn) => {
|
||||||
conn.pipe(conn)
|
conn.pipe(conn)
|
||||||
}, () => {
|
}, () => {
|
||||||
@ -78,7 +78,7 @@ describe('libp2p-websockets', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('echo with connect event and send', (done) => {
|
it('echo with connect event and send', (done) => {
|
||||||
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
const mh = multiaddr('/ip4/127.0.0.1/tcp/9090/ws')
|
||||||
ws.createListener(mh, (conn) => {
|
ws.createListener(mh, (conn) => {
|
||||||
conn.pipe(conn)
|
conn.pipe(conn)
|
||||||
}, () => {
|
}, () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user