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

Commit

Permalink
Migrate to webrtc v2.0.16 and go-libp2p-core
Browse files Browse the repository at this point in the history
Relates to #31
  • Loading branch information
backkem committed Aug 5, 2019
1 parent 2c7a102 commit c4aeaee
Show file tree
Hide file tree
Showing 9 changed files with 303 additions and 273 deletions.
18 changes: 7 additions & 11 deletions examples/libp2p-echo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@ module github.com/libp2p/go-libp2p-webrtc-direct/examples/libp2p-echo

go 1.12

replace github.com/libp2p/go-libp2p-webrtc-direct => ../../

require (
github.com/ipfs/go-log v0.0.1
github.com/libp2p/go-libp2p v0.0.3
github.com/libp2p/go-libp2p-core/crypto v0.0.1
github.com/libp2p/go-libp2p-host v0.0.1
github.com/libp2p/go-libp2p-net v0.0.1
github.com/libp2p/go-libp2p-core/peer v0.1.0
github.com/libp2p/go-libp2p-core/peerstore v0.0.1
github.com/libp2p/go-libp2p v0.1.1
github.com/libp2p/go-libp2p-core v0.0.3
github.com/libp2p/go-libp2p-mplex v0.2.1
github.com/libp2p/go-libp2p-webrtc-direct v0.0.0-00010101000000-000000000000
github.com/multiformats/go-multiaddr v0.0.2
github.com/pion/webrtc/v2 v2.0.5
github.com/multiformats/go-multiaddr v0.0.4
github.com/pion/webrtc/v2 v2.0.16
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc
github.com/whyrusleeping/go-smux-multiplex v3.0.16+incompatible
)

replace github.com/libp2p/go-libp2p-webrtc-direct => ../../
244 changes: 139 additions & 105 deletions examples/libp2p-echo/go.sum

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/libp2p-echo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import (
golog "github.com/ipfs/go-log"
libp2p "github.com/libp2p/go-libp2p"
crypto "github.com/libp2p/go-libp2p-core/crypto"
host "github.com/libp2p/go-libp2p-host"
net "github.com/libp2p/go-libp2p-net"
host "github.com/libp2p/go-libp2p-core/host"
net "github.com/libp2p/go-libp2p-core/network"
peer "github.com/libp2p/go-libp2p-core/peer"
pstore "github.com/libp2p/go-libp2p-core/peerstore"
ma "github.com/multiformats/go-multiaddr"
gologging "github.com/whyrusleeping/go-logging"

mplex "github.com/libp2p/go-libp2p-mplex"
direct "github.com/libp2p/go-libp2p-webrtc-direct"
"github.com/pion/webrtc/v2"
mplex "github.com/whyrusleeping/go-smux-multiplex"
)

// makeBasicHost creates a LibP2P host with a random peer ID listening on the
Expand Down
13 changes: 6 additions & 7 deletions examples/standalone/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ module github.com/libp2p/go-libp2p-webrtc-direct/examples/standalone

go 1.12

replace github.com/libp2p/go-libp2p-webrtc-direct => ../../

require (
github.com/libp2p/go-libp2p-core/transport v0.0.4
github.com/libp2p/go-libp2p-core v0.0.3
github.com/libp2p/go-libp2p-mplex v0.2.1
github.com/libp2p/go-libp2p-webrtc-direct v0.0.0-00010101000000-000000000000
github.com/libp2p/go-libp2p-core/mux v0.0.1
github.com/multiformats/go-multiaddr v0.0.2
github.com/pion/webrtc/v2 v2.0.5
github.com/whyrusleeping/go-smux-multiplex v3.0.16+incompatible
github.com/multiformats/go-multiaddr v0.0.4
github.com/pion/webrtc/v2 v2.0.16
)

replace github.com/libp2p/go-libp2p-webrtc-direct => ../../
133 changes: 67 additions & 66 deletions examples/standalone/go.sum

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions examples/standalone/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"fmt"
"io/ioutil"

smux "github.com/libp2p/go-libp2p-core/mux"
tpt "github.com/libp2p/go-libp2p-core/transport"
mplex "github.com/libp2p/go-libp2p-mplex"
direct "github.com/libp2p/go-libp2p-webrtc-direct"
smux "github.com/libp2p/go-libp2p-core/mux"
ma "github.com/multiformats/go-multiaddr"
"github.com/pion/webrtc/v2"
mplex "github.com/whyrusleeping/go-smux-multiplex"
)

const listenFlag = "listen"
Expand Down Expand Up @@ -63,7 +63,7 @@ func main() {
}
}

func handleConn(c tpt.Conn) {
func handleConn(c tpt.CapableConn) {
for {
s, err := c.AcceptStream()
if err != nil {
Expand All @@ -74,7 +74,7 @@ func handleConn(c tpt.Conn) {
go handleStream(s)
}
}
func handleStream(s smux.Stream) {
func handleStream(s smux.MuxedStream) {
b, err := ioutil.ReadAll(s)
check(err)
fmt.Println("[listener] Received:")
Expand Down
13 changes: 6 additions & 7 deletions examples/wasm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ module github.com/libp2p/go-libp2p-webrtc-direct/examples/wasm

go 1.12

replace github.com/libp2p/go-libp2p-webrtc-direct => ../../

require (
github.com/libp2p/go-libp2p-core/transport v0.0.4
github.com/libp2p/go-libp2p-core v0.0.3
github.com/libp2p/go-libp2p-mplex v0.2.1
github.com/libp2p/go-libp2p-webrtc-direct v0.0.0-00010101000000-000000000000
github.com/libp2p/go-libp2p-core/mux v0.0.1
github.com/multiformats/go-multiaddr v0.0.2
github.com/pion/webrtc/v2 v2.0.5
github.com/whyrusleeping/go-smux-multiplex v3.0.16+incompatible
github.com/multiformats/go-multiaddr v0.0.4
github.com/pion/webrtc/v2 v2.0.16
)

replace github.com/libp2p/go-libp2p-webrtc-direct => ../../
133 changes: 67 additions & 66 deletions examples/wasm/go.sum

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions examples/wasm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"fmt"
"io/ioutil"

smux "github.com/libp2p/go-libp2p-core/mux"
tpt "github.com/libp2p/go-libp2p-core/transport"
mplex "github.com/libp2p/go-libp2p-mplex"
direct "github.com/libp2p/go-libp2p-webrtc-direct"
smux "github.com/libp2p/go-libp2p-core/mux"
ma "github.com/multiformats/go-multiaddr"
"github.com/pion/webrtc/v2"
mplex "github.com/whyrusleeping/go-smux-multiplex"
)

func main() {
Expand Down Expand Up @@ -41,7 +41,7 @@ func main() {
check(err)
}

func handleConn(c tpt.Conn) {
func handleConn(c tpt.CapableConn) {
for {
s, err := c.AcceptStream()
if err != nil {
Expand All @@ -52,7 +52,7 @@ func handleConn(c tpt.Conn) {
go handleStream(s)
}
}
func handleStream(s smux.Stream) {
func handleStream(s smux.MuxedStream) {
b, err := ioutil.ReadAll(s)
check(err)
fmt.Println("[listener] Received:")
Expand Down

0 comments on commit c4aeaee

Please sign in to comment.