Skip to content

Commit

Permalink
feat: Add webtransport component (#271)
Browse files Browse the repository at this point in the history
This adds the webtransport protocol here
  • Loading branch information
MarcoPolo committed Sep 20, 2022
1 parent 1079427 commit 210f156
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/protocols-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const table: Array<[number, number, string, boolean?, boolean?]> = [
[445, 296, 'onion3'],
[446, V, 'garlic64'],
[460, 0, 'quic'],
[465, 0, 'webtransport'],
[466, V, 'certhash'],
[477, 0, 'ws'],
[478, 0, 'wss'],
Expand Down
14 changes: 14 additions & 0 deletions test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,20 @@ describe('variants', () => {
expect(addr.toString()).to.equal(str)
})

it('webtransport', () => {
const str = '/ip6/2001:8a0:7ac5:4201:3ac9:86ff:fe31:7095/udp/4001/quic/webtransport'
const addr = new Multiaddr(str)
expect(addr).to.have.property('bytes')
expect(addr.toString()).to.equal(str)
})

it('ip4 webtransport', () => {
const str = '/ip4/1.2.3.4/udp/4001/quic/webtransport'
const addr = new Multiaddr(str)
expect(addr).to.have.property('bytes')
expect(addr.toString()).to.equal(str)
})

it('unix', () => {
const str = '/unix/a/b/c/d/e'
const addr = new Multiaddr(str)
Expand Down

0 comments on commit 210f156

Please sign in to comment.