mirror of
https://github.com/fluencelabs/js-libp2p-websockets
synced 2025-03-16 13:50:55 +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) => {
|
||||
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) => {
|
||||
socket.pipe(socket)
|
||||
}, done)
|
||||
|
@ -34,8 +34,8 @@
|
||||
},
|
||||
"homepage": "https://github.com/diasdavid/js-libp2p-websockets#readme",
|
||||
"dependencies": {
|
||||
"mafmt": "^1.0.1",
|
||||
"multiaddr": "^1.1.1",
|
||||
"mafmt": "^2.0.0",
|
||||
"multiaddr": "^2.0.0",
|
||||
"run-parallel": "^1.1.6",
|
||||
"simple-websocket": "github:diasdavid/simple-websocket#ec31437"
|
||||
},
|
||||
@ -52,4 +52,4 @@
|
||||
"Francisco Baio Dias <xicombd@gmail.com>",
|
||||
"Friedel Ziegelmayer <dignifiedquire@gmail.com>"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ describe('libp2p-websockets', function () {
|
||||
})
|
||||
|
||||
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 message = 'Hello World!'
|
||||
conn.write(message)
|
||||
@ -29,7 +29,7 @@ describe('libp2p-websockets', function () {
|
||||
|
||||
describe('stress', () => {
|
||||
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 message = new Buffer(1000000).fill('a').toString('hex')
|
||||
conn.write(message)
|
||||
@ -41,7 +41,7 @@ describe('libp2p-websockets', function () {
|
||||
})
|
||||
|
||||
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)
|
||||
let expected = ''
|
||||
let counter = 0
|
||||
|
14
test/node.js
14
test/node.js
@ -16,7 +16,7 @@ describe('libp2p-websockets', function () {
|
||||
})
|
||||
|
||||
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) => {
|
||||
expect(socket).to.exist
|
||||
socket.end()
|
||||
@ -28,8 +28,8 @@ describe('libp2p-websockets', function () {
|
||||
})
|
||||
|
||||
it('listen on several', (done) => {
|
||||
const mh1 = multiaddr('/ip4/127.0.0.1/tcp/9090/websockets')
|
||||
const mh2 = multiaddr('/ip4/127.0.0.1/tcp/9091/websockets')
|
||||
const mh1 = multiaddr('/ip4/127.0.0.1/tcp/9090/ws')
|
||||
const mh2 = multiaddr('/ip4/127.0.0.1/tcp/9091/ws')
|
||||
const ws = new WSlibp2p()
|
||||
|
||||
ws.createListener([mh1, mh2], (socket) => {}, () => {
|
||||
@ -38,7 +38,7 @@ describe('libp2p-websockets', function () {
|
||||
})
|
||||
|
||||
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) => {
|
||||
expect(socket).to.exist
|
||||
socket.end()
|
||||
@ -53,7 +53,7 @@ describe('libp2p-websockets', function () {
|
||||
it('filter', (done) => {
|
||||
const mh1 = multiaddr('/ip4/127.0.0.1/tcp/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])
|
||||
expect(valid.length).to.equal(1)
|
||||
@ -62,7 +62,7 @@ describe('libp2p-websockets', function () {
|
||||
})
|
||||
|
||||
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) => {
|
||||
conn.pipe(conn)
|
||||
}, () => {
|
||||
@ -78,7 +78,7 @@ describe('libp2p-websockets', function () {
|
||||
})
|
||||
|
||||
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) => {
|
||||
conn.pipe(conn)
|
||||
}, () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user