From d94957f30734459db66182208f75ff2f430b1869 Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Thu, 30 Mar 2023 12:04:28 -0700 Subject: [PATCH] Update webrtc protocols after rename --- multiaddr_test.go | 2 ++ protocols.go | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/multiaddr_test.go b/multiaddr_test.go index fc0f2a9..5690a8c 100644 --- a/multiaddr_test.go +++ b/multiaddr_test.go @@ -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 { diff --git a/protocols.go b/protocols.go index db0b121..b01e6cb 100644 --- a/protocols.go +++ b/protocols.go @@ -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 ( @@ -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, @@ -305,6 +311,7 @@ func init() { protoWS, protoWSS, protoPlaintextV2, + protoWebRTCDirect, protoWebRTC, } { if err := AddProtocol(p); err != nil {