Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update webrtc protocols after rename #195

Merged
merged 1 commit into from
Mar 31, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions multiaddr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ func TestConstructSucceeds(t *testing.T) {
"/ip4/127.0.0.1/tcp/127/noise",
"/ip4/127.0.0.1/tcp/127/wss",
"/ip4/127.0.0.1/tcp/127/wss",
"/ip4/127.0.0.1/tcp/127/webrtc-direct",
"/ip4/127.0.0.1/tcp/127/webrtc",
}

for _, a := range cases {
Expand Down
11 changes: 9 additions & 2 deletions protocols.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ const (
P_ONION3 = 445
P_GARLIC64 = 446
P_GARLIC32 = 447
P_P2P_WEBRTC_DIRECT = 276
P_P2P_WEBRTC_DIRECT = 276 // Deprecated. use webrtc-direct instead
P_TLS = 448
P_SNI = 449
P_NOISE = 454
P_WS = 477
P_WSS = 478 // deprecated alias for /tls/ws
P_PLAINTEXTV2 = 7367777
P_WEBRTC = 280
P_WEBRTC_DIRECT = 280
P_WEBRTC = 281
)

var (
Expand Down Expand Up @@ -262,6 +263,11 @@ var (
Code: P_WSS,
VCode: CodeToVarint(P_WSS),
}
protoWebRTCDirect = Protocol{
Name: "webrtc-direct",
Code: P_WEBRTC_DIRECT,
VCode: CodeToVarint(P_WEBRTC_DIRECT),
}
protoWebRTC = Protocol{
Name: "webrtc",
Code: P_WEBRTC,
Expand Down Expand Up @@ -305,6 +311,7 @@ func init() {
protoWS,
protoWSS,
protoPlaintextV2,
protoWebRTCDirect,
protoWebRTC,
} {
if err := AddProtocol(p); err != nil {
Expand Down