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

Upgradable MultiaddrConnection #29

Merged
merged 4 commits into from
Oct 12, 2022
Merged

Upgradable MultiaddrConnection #29

merged 4 commits into from
Oct 12, 2022

Conversation

ckousik
Copy link
Collaborator

@ckousik ckousik commented Sep 28, 2022

We use the new Upgrader interface to use in-built encryption and multiplexing of a WebRTC connection.

src/sdp.ts Outdated
@@ -6,7 +6,7 @@ import { bases } from 'multiformats/basics';

const log = logger('libp2p:webrtc:sdp');

const mbdecoder = (function () {
export const mbdecoder = (function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why's this exported?

@@ -44,7 +45,7 @@ export class WebRTCStream implements Stream {
metadata: Record<string, any>;
private readonly channel: RTCDataChannel;

source: Source<Uint8ArrayList> = pushable();
_src: Source<Uint8ArrayList> = pushable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I misremember "source" being part of the interface or has the interface changed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we just use a getter/setter pattern for accessing source.

@@ -168,6 +179,9 @@ export class WebRTCStream implements Stream {
this.readClosed = true;
this.writeClosed = true;
this.channel.close();
if (this.closeCb) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to think for a second about what cb might stand for. Perhaps the name could be more verbose.

src/options.ts Outdated
@@ -6,5 +6,4 @@ export interface WebRTCListenerOptions extends CreateListenerOptions {
// channelOptions?: WebRTCReceiverInit
}

export interface WebRTCDialOptions extends DialOptions {
}
export interface WebRTCDialOptions extends DialOptions {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't there be something here specifying your upgrader as the default one?

@github-actions
Copy link

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants