This repository has been archived by the owner on Jun 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
SDP munging #10
Merged
Merged
SDP munging #10
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0aa9dc4
This looks right-ish to me. Need better error type and testing.
John-LittleBearLabs fbce43c
Added an SDP test to get started.
John-LittleBearLabs 2a8f5af
Testing was indeed quite useful.
John-LittleBearLabs 42e393e
Error types
John-LittleBearLabs f694dbf
Merge remote-tracking branch 'origin/develop' into jt/con-427_munge
John-LittleBearLabs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export class WebRTCTransportError extends Error { | ||
constructor(msg: string) { | ||
super(msg); | ||
this.name = 'WebRTCTransportError'; | ||
} | ||
} | ||
|
||
export class InvalidArgumentError extends WebRTCTransportError { | ||
constructor(msg: string) { | ||
super(msg); | ||
this.name = 'WebRTC/InvalidArgumentError'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Multiaddr } from '@multiformats/multiaddr'; | ||
import { expect } from 'chai'; | ||
import * as underTest from '../src/sdp.js'; | ||
|
||
const an_sdp = ` | ||
v=0 | ||
o=- 0 0 IN IP4 192.168.0.152 | ||
s=- | ||
c=IN IP4 192.168.0.152 | ||
t=0 0 | ||
m=application 2345 UDP/DTLS/SCTP webrtc-datachannel | ||
a=mid:0 | ||
a=ice-options:ice2 | ||
a=ice-ufrag:MyUserFragment | ||
a=ice-pwd:MyUserFragment | ||
a=fingerprint:mTXVsdGliYXNlIGlzIGF3ZXNvbWUhIFxvLw | ||
a=setup:actpass | ||
a=sctp-port:5000 | ||
a=max-message-size:100000 | ||
`; | ||
|
||
describe('SDP creation', () => { | ||
it('handles simple blue sky easily enough', async () => { | ||
let ma = new Multiaddr('/ip4/192.168.0.152/udp/2345/webrtc/certhash/zYAjKoNbau5KiqmHPmSxYCvn66dA1vLmwbt'); | ||
let ufrag = 'MyUserFragment'; | ||
let sdp = underTest.fromMultiAddr(ma, ufrag); | ||
expect(sdp.sdp).to.equal(an_sdp); | ||
}); | ||
}); | ||
|
||
describe('SDP munging', () => { | ||
it('does a simple replacement', () => { | ||
let result = underTest.munge({type:'answer',sdp: an_sdp},'someotheruserfragmentstring'); | ||
expect(result.sdp).to.equal(` | ||
v=0 | ||
o=- 0 0 IN IP4 192.168.0.152 | ||
s=- | ||
c=IN IP4 192.168.0.152 | ||
t=0 0 | ||
m=application 2345 UDP/DTLS/SCTP webrtc-datachannel | ||
a=mid:0 | ||
a=ice-options:ice2 | ||
a=ice-ufrag:someotheruserfragmentstring | ||
a=ice-pwd:someotheruserfragmentstring | ||
a=fingerprint:mTXVsdGliYXNlIGlzIGF3ZXNvbWUhIFxvLw | ||
a=setup:actpass | ||
a=sctp-port:5000 | ||
a=max-message-size:100000 | ||
`); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watch out for this. It expects that repo to be there on your local drive, and on my branch.
TODO: