Skip to content

Commit 7bffa37

Browse files
committed
feat: add wss protocol
Now that we define all protocols in this package, we might as well add wss. fixes #72
1 parent d3472d6 commit 7bffa37

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

multiaddr_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ func TestConstructSucceeds(t *testing.T) {
149149
"/ip4/127.0.0.1/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC/tcp/1234/unix/stdio",
150150
"/ip4/127.0.0.1/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC/tcp/1234/unix/stdio",
151151
"/ip4/127.0.0.1/tcp/9090/http/p2p-webrtc-direct",
152+
"/ip4/127.0.0.1/tcp/127/ws",
153+
"/ip4/127.0.0.1/tcp/127/ws",
154+
"/ip4/127.0.0.1/tcp/127/wss",
155+
"/ip4/127.0.0.1/tcp/127/wss",
152156
}
153157

154158
for _, a := range cases {

protocols.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const (
2929
P_GARLIC32 = 0x01BF
3030
P_P2P_WEBRTC_DIRECT = 0x0114
3131
P_WS = 0x01DD
32+
P_WSS = 0x01DE
3233
)
3334

3435
var (
@@ -201,6 +202,11 @@ var (
201202
Code: P_WS,
202203
VCode: CodeToVarint(P_WS),
203204
}
205+
protoWSS = Protocol{
206+
Name: "wss",
207+
Code: P_WSS,
208+
VCode: CodeToVarint(P_WSS),
209+
}
204210
)
205211

206212
func init() {
@@ -230,6 +236,7 @@ func init() {
230236
protoUNIX,
231237
protoP2P_WEBRTC_DIRECT,
232238
protoWS,
239+
protoWSS,
233240
} {
234241
if err := AddProtocol(p); err != nil {
235242
panic(err)

0 commit comments

Comments
 (0)