Giter Site home page Giter Site logo

libp2p / go-libp2p-webrtc-direct Goto Github PK

View Code? Open in Web Editor NEW
81.0 29.0 18.0 184 KB

A libp2p transport that enables browser-to-server, and server-to-server, direct communication over WebRTC without requiring signalling servers

License: MIT License

Go 100.00%
libp2p webrtc direct transport go

go-libp2p-webrtc-direct's Introduction

⚠️⚠️⚠️⚠️⚠️⚠️

Status:

Archived and not maintained

Alternatives:

WebRTC Browser-to-Server is being implemented in go-libp2p here libp2p/specs#412 per the specification: libp2p/specs#412

WebRTC Browser-to-Browser is being tracked here: libp2p/specs#475

Questions:

Please direct any questions about the specification to: https://github.com/libp2p/specs/issues

Please direct any questions about the go-libp2p WebRTC implementation to: https://github.com/libp2p/go-libp2p/issues

⚠️⚠️⚠️⚠️⚠️⚠️

go-libp2p-webrtc-direct

GoDoc Coverage Status Build Status

A transport that enables browser-to-server, and server-to-server, direct communication over WebRTC without requiring signalling servers. This is the Go counterpart to js-libp2p-webrtc-direct.

Lead maintainer: @backkem

Special thanks to @pion for their fantastic WebRTC Go library, which made this libp2p transport possible.

Install

This package supports gomod builds.

go get github.com/libp2p/go-libp2p-webrtc-direct

Usage

Check out the GoDocs.

Examples

Check the examples folder for usage and integration examples.

Contribute

Feel free to join in. All welcome. Open an issue or send a PR.

This repository falls under the IPFS Code of Conduct.

License

MIT

go-libp2p-webrtc-direct's People

Contributors

albrow avatar backkem avatar libp2p-mgmt-read-write[bot] avatar marten-seemann avatar mearaj avatar p-shahi avatar raulk avatar tobowers avatar web3-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-libp2p-webrtc-direct's Issues

golang client

if you get time you you make a golang client too using libp2p ?

WASM Support

Support js/wasm build target.

TODO

  • Support js/wasm build target in pions/datachannel
  • DataChannel.Detach support using the js/wasm build target in pions/webrtc.
  • Test to see if the Dial side works from WASM. (+ Document as example).

ALTERNATIVE
We could also build this library using the OnMessage callback instead of using Detach (when targetting js/wasm). However, it seems easier to maintain the wiring around OnMessage in pions/datachannel instead.

Setup CI

TODO:

  • Figure out dependency management, see initial discussion in #11.
    • use go modules.
    • libp2p/multiformats/... uses gx.
    • We could just vendor the main dependencies for now.
  • Setup Travis

SCTP reliability

The current SCTP implementation seems to get into trouble because/when the reader starts lagging behind on incoming traffic. Related issues:

TODO

  • Improve reliability so we pass the entire libp2p/go-libp2p-transport/test suite.
  • Update the pions/webrtc & pions/datachannel dependencies once the SCTP improvements land in master (or the v2.0.0 release).

Failed to run when trying out the standalone example

Hi there,

I was trying out the exact code in examples/standalone in my PC(Ubuntu), and it failed when run (go run . -listen). The error messages showed below.

# github.com/libp2p/go-libp2p-webrtc-direct
/home/root/go/pkg/mod/github.com/libp2p/[email protected]/conn.go:269:29: not enough arguments in call to muxer.NewConn
        have (net.Conn, bool)
        want (net.Conn, bool, network.PeerScope)
/home/root/go/pkg/mod/github.com/libp2p/[email protected]/listener.go:140:2: cannot use conn (type *Conn) as type transport.CapableConn in return argument:
        *Conn does not implement transport.CapableConn (missing Scope method)
/home/root/go/pkg/mod/github.com/libp2p/[email protected]/transport.go:63:2: cannot use conn (type *Conn) as type transport.CapableConn in return argument:
        *Conn does not implement transport.CapableConn (missing Scope method)
/home/root/go/pkg/mod/github.com/libp2p/[email protected]/webrtcdirect.go:16:5: cannot use &Conn{} (type *Conn) as type transport.CapableConn in assignment:
        *Conn does not implement transport.CapableConn (missing Scope method)

Could anyone have a look at it and give me a hint where I did it wrong, please? Thank you.

transport tests failing

When updating go-libp2p-testing, the transport tests fail:

func TestTransport(t *testing.T) {
logging.SetLogLevel("*", "warning")
ta := NewTransport(
webrtc.Configuration{},
new(mplex.Transport),
)
tb := NewTransport(
webrtc.Configuration{},
new(mplex.Transport),
)
addr := "/ip4/127.0.0.1/tcp/0/http/p2p-webrtc-direct"
utils.SubtestTransport(t, ta, tb, addr, "peerA")
}

=== RUN   TestTransport/github.com/libp2p/go-libp2p-testing/suites/transport.SubtestStress1Conn1Stream100Msg
panic: Fail in goroutine after TestTransport/github.com/libp2p/go-libp2p-testing/suites/transport.SubtestStress1Conn1Stream1Msg has completed

goroutine 533 [running]:
testing.(*common).Fail(0xc000357680)
        /usr/local/Cellar/go/1.15.5/libexec/src/testing/testing.go:688 +0x125
testing.(*common).Error(0xc000357680, 0xc0004d0f98, 0x1, 0x1)
        /usr/local/Cellar/go/1.15.5/libexec/src/testing/testing.go:788 +0x78
github.com/libp2p/go-libp2p-testing/suites/transport.echoStream(0xc000357680, 0x18c05e0, 0xc00047a0d0)
        /Users/marten/src/go/pkg/mod/github.com/libp2p/[email protected]/suites/transport/stream_suite.go:109 +0x26d
created by github.com/libp2p/go-libp2p-testing/suites/transport.goServe.func1.1
        /Users/marten/src/go/pkg/mod/github.com/libp2p/[email protected]/suites/transport/stream_suite.go:145 +0x4b
exit status 2

Flesh out ConnSecurity

The implementation of the ConnSecurity interface needs to be completed.

TODO

  • Figure out how this works on the JS side.
  • Implement.
  • If not already so, investigate if we can use the security built into WebRTC (DTLS).

Investigate muxing using data channels

Right now the user has to provide a muxer to create streams. It may be worth investigating if we can mux using WebRTC DataChannels. Note that there are some remainders of this idea still in the code.

To check:

Broken Import

Error when running go get github.com/libp2p/go-libp2p-webrtc-direct

go version go1.18 linux/amd64

soh@soh-MS-7B46:~/go_dev/libp2p_test/publisher$ go get github.com/libp2p/go-libp2p-webrtc-direct
github.com/libp2p/go-libp2p-webrtc-direct imports
        github.com/libp2p/go-libp2p-core/mux: cannot find module providing package github.com/libp2p/go-libp2p-core/mux

It seems that github.com/libp2p/go-libp2p-core has moved to github.com/libp2p/go-libp2p/core and github.com/libp2p/go-libp2p-core/mux has migrated to github.com/libp2p/go-libp2p/core/network.

Please Add A License

Hello, I saw your comment on an issue on the libp2p/go-libp2p#188, and would like to use this libp2p transport for an experimental feature in one of my projects. If that feature goes well, more than likely can contribute to this library as I would need to use it a lot.

Projects that do not include a license, are technically not usable by other projects https://choosealicense.com/no-permission/

Thanks!

Other signaling strategies

go-libp2p-webrtc-direct contains the first step towards WebRTC support in go-ipfs: a port of js-libp2p-webrtc-direct which is the simplest WebRTC transport on the JS side. The drawback of *-libp2p-webrtc-direct is that the signaling is done over HTTP. This requires a direct connection between the peers and therefore can't make use of WebRTC's NAT traversal capabilities.

This ticket aims to explore other signaling strategies. For example, strategies that would also work when both peers are behind a NAT. I think it would be preferable to explore strategies that work across libp2p implementations.

'Centralized' signaling

Signaling over connected peers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.