Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

fix: add tests for ipv6 wildcard support #203

Merged
merged 1 commit into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/compliance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ describe('interface-transport compliance', () => {
const addrs = [
new Multiaddr('/ip4/127.0.0.1/tcp/9091'),
new Multiaddr('/ip4/127.0.0.1/tcp/9092'),
new Multiaddr('/ip4/127.0.0.1/tcp/9093')
new Multiaddr('/ip4/127.0.0.1/tcp/9093'),
new Multiaddr('/ip6/::/tcp/9094')
]

// Used by the dial tests to simulate a delayed connect
Expand Down
12 changes: 12 additions & 0 deletions test/listen-dial.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ describe('listen', () => {
expect(multiaddrs[0].toString().indexOf('0.0.0.0')).to.equal(-1)
})

it('getAddrs from listening on ip6 \'::\'', async () => {
const mh = new Multiaddr('/ip6/::/tcp/9090')
listener = tcp.createListener({
upgrader
})
await listener.listen(mh)

const multiaddrs = listener.getAddrs()
expect(multiaddrs.length > 0).to.equal(true)
expect(multiaddrs[0].toOptions().host).to.not.equal('::')
})

it('getAddrs preserves IPFS Id', async () => {
const mh = new Multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
listener = tcp.createListener({
Expand Down