Skip to content

Commit d94957f

Browse files
committed
Update webrtc protocols after rename
1 parent 9bc1395 commit d94957f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

multiaddr_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ func TestConstructSucceeds(t *testing.T) {
190190
"/ip4/127.0.0.1/tcp/127/noise",
191191
"/ip4/127.0.0.1/tcp/127/wss",
192192
"/ip4/127.0.0.1/tcp/127/wss",
193+
"/ip4/127.0.0.1/tcp/127/webrtc-direct",
194+
"/ip4/127.0.0.1/tcp/127/webrtc",
193195
}
194196

195197
for _, a := range cases {

protocols.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ const (
3131
P_ONION3 = 445
3232
P_GARLIC64 = 446
3333
P_GARLIC32 = 447
34-
P_P2P_WEBRTC_DIRECT = 276
34+
P_P2P_WEBRTC_DIRECT = 276 // Deprecated. use webrtc-direct instead
3535
P_TLS = 448
3636
P_SNI = 449
3737
P_NOISE = 454
3838
P_WS = 477
3939
P_WSS = 478 // deprecated alias for /tls/ws
4040
P_PLAINTEXTV2 = 7367777
41-
P_WEBRTC = 280
41+
P_WEBRTC_DIRECT = 280
42+
P_WEBRTC = 281
4243
)
4344

4445
var (
@@ -262,6 +263,11 @@ var (
262263
Code: P_WSS,
263264
VCode: CodeToVarint(P_WSS),
264265
}
266+
protoWebRTCDirect = Protocol{
267+
Name: "webrtc-direct",
268+
Code: P_WEBRTC_DIRECT,
269+
VCode: CodeToVarint(P_WEBRTC_DIRECT),
270+
}
265271
protoWebRTC = Protocol{
266272
Name: "webrtc",
267273
Code: P_WEBRTC,
@@ -305,6 +311,7 @@ func init() {
305311
protoWS,
306312
protoWSS,
307313
protoPlaintextV2,
314+
protoWebRTCDirect,
308315
protoWebRTC,
309316
} {
310317
if err := AddProtocol(p); err != nil {

0 commit comments

Comments
 (0)