Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #103 from libp2p/update-transport-upgrader
Browse files Browse the repository at this point in the history
chore: update go-libp2p-transport-upgrader and go-libp2p-core
  • Loading branch information
marten-seemann authored Jul 24, 2021
2 parents 666bbbe + 9a4184a commit fe86bc4
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 66 deletions.
16 changes: 13 additions & 3 deletions browser_integration_browser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,32 @@ import (
"testing"
"time"

"github.com/libp2p/go-libp2p-core/sec/insecure"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/test"
mplex "github.com/libp2p/go-libp2p-mplex"
tptu "github.com/libp2p/go-libp2p-transport-upgrader"
ma "github.com/multiformats/go-multiaddr"
)

func TestInBrowser(t *testing.T) {
priv, _, err := test.RandTestKeyPair(crypto.Ed25519, 256)
if err != nil {
t.Fatal(err)
}
id, err := peer.IDFromPrivateKey(priv)
if err != nil {
t.Fatal(err)
}
tpt := New(&tptu.Upgrader{
Secure: insecure.New("browserPeer"),
Secure: newSecureMuxer(t, id),
Muxer: new(mplex.Transport),
})
addr, err := ma.NewMultiaddr("/ip4/127.0.0.1/tcp/5555/ws")
if err != nil {
t.Fatal("could not parse multiaddress:" + err.Error())
}
conn, err := tpt.Dial(context.Background(), addr, "serverPeer")
conn, err := tpt.Dial(context.Background(), addr, id)
if err != nil {
t.Fatal("could not dial server:" + err.Error())
}
Expand Down
3 changes: 1 addition & 2 deletions browser_integration_native_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"strings"
"testing"

"github.com/libp2p/go-libp2p-core/sec/insecure"
mplex "github.com/libp2p/go-libp2p-mplex"
tptu "github.com/libp2p/go-libp2p-transport-upgrader"
ma "github.com/multiformats/go-multiaddr"
Expand Down Expand Up @@ -53,7 +52,7 @@ func TestInBrowser(t *testing.T) {
close(serverDoneSignal)
}()
tpt := New(&tptu.Upgrader{
Secure: insecure.New("serverPeer"),
Secure: newSecureMuxer(t, "serverPeer"),
Muxer: new(mplex.Transport),
})
addr, err := ma.NewMultiaddr("/ip4/127.0.0.1/tcp/5555/ws")
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ module github.com/libp2p/go-ws-transport

require (
github.com/gorilla/websocket v1.4.2
github.com/libp2p/go-libp2p-core v0.8.0
github.com/libp2p/go-libp2p-mplex v0.4.0
github.com/libp2p/go-conn-security-multistream v0.2.1
github.com/libp2p/go-libp2p-core v0.9.0
github.com/libp2p/go-libp2p-mplex v0.4.1
github.com/libp2p/go-libp2p-testing v0.4.0
github.com/libp2p/go-libp2p-transport-upgrader v0.2.0
github.com/libp2p/go-libp2p-transport-upgrader v0.4.3
github.com/multiformats/go-multiaddr v0.3.3
github.com/multiformats/go-multiaddr-fmt v0.1.0
)
Expand Down
Loading

0 comments on commit fe86bc4

Please sign in to comment.