Skip to content

Commit

Permalink
Merge pull request #122 from multiformats/feat/wss
Browse files Browse the repository at this point in the history
feat: add wss protocol
  • Loading branch information
Stebalien committed Feb 29, 2020
2 parents 41a8e2e + 7bffa37 commit 8ae68cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions multiaddr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ func TestConstructSucceeds(t *testing.T) {
"/ip4/127.0.0.1/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC/tcp/1234/unix/stdio",
"/ip4/127.0.0.1/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC/tcp/1234/unix/stdio",
"/ip4/127.0.0.1/tcp/9090/http/p2p-webrtc-direct",
"/ip4/127.0.0.1/tcp/127/ws",
"/ip4/127.0.0.1/tcp/127/ws",
"/ip4/127.0.0.1/tcp/127/wss",
"/ip4/127.0.0.1/tcp/127/wss",
}

for _, a := range cases {
Expand Down
7 changes: 7 additions & 0 deletions protocols.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const (
P_GARLIC32 = 0x01BF
P_P2P_WEBRTC_DIRECT = 0x0114
P_WS = 0x01DD
P_WSS = 0x01DE
)

var (
Expand Down Expand Up @@ -201,6 +202,11 @@ var (
Code: P_WS,
VCode: CodeToVarint(P_WS),
}
protoWSS = Protocol{
Name: "wss",
Code: P_WSS,
VCode: CodeToVarint(P_WSS),
}
)

func init() {
Expand Down Expand Up @@ -230,6 +236,7 @@ func init() {
protoUNIX,
protoP2P_WEBRTC_DIRECT,
protoWS,
protoWSS,
} {
if err := AddProtocol(p); err != nil {
panic(err)
Expand Down

0 comments on commit 8ae68cf

Please sign in to comment.