mirror of
https://github.com/fluencelabs/js-libp2p-tcp
synced 2025-06-14 16:21:35 +00:00
feat: relay filtering
* feat: filter IPFS addrs correctly * feat: mafmt addrs now support /ipfs no need for ad-hoc filtering * feat: skip p2p-circuit addresses
This commit is contained in:
committed by
David Dias
parent
7572279838
commit
11c4f451f4
@ -273,8 +273,11 @@ describe('filter addrs', () => {
|
||||
const mh2 = multiaddr('/ip4/127.0.0.1/udp/9090')
|
||||
const mh3 = multiaddr('/ip4/127.0.0.1/tcp/9090/http')
|
||||
const mh4 = multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
|
||||
const mh5 = multiaddr('/ip4/127.0.0.1/tcp/9090/http/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
|
||||
const mh6 = multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw' +
|
||||
'/p2p-circuit/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
|
||||
|
||||
const valid = tcp.filter([mh1, mh2, mh3, mh4])
|
||||
const valid = tcp.filter([mh1, mh2, mh3, mh4, mh5, mh6])
|
||||
expect(valid.length).to.equal(2)
|
||||
expect(valid[0]).to.deep.equal(mh1)
|
||||
expect(valid[1]).to.deep.equal(mh4)
|
||||
@ -349,6 +352,7 @@ describe('valid Connection', () => {
|
||||
const conn = tcp.dial(ma)
|
||||
|
||||
pull(conn, pull.onEnd(endHandler))
|
||||
|
||||
function endHandler () {
|
||||
conn.getPeerInfo((err, peerInfo) => {
|
||||
expect(err).to.exist()
|
||||
@ -375,6 +379,7 @@ describe('valid Connection', () => {
|
||||
const conn = tcp.dial(ma)
|
||||
|
||||
pull(conn, pull.onEnd(endHandler))
|
||||
|
||||
function endHandler () {
|
||||
conn.setPeerInfo('arroz')
|
||||
conn.getPeerInfo((err, peerInfo) => {
|
||||
|
Reference in New Issue
Block a user