libp2p / go-libp2p-webrtc-direct Goto Github PK
View Code? Open in Web Editor NEWA libp2p transport that enables browser-to-server, and server-to-server, direct communication over WebRTC without requiring signalling servers
License: MIT License
A libp2p transport that enables browser-to-server, and server-to-server, direct communication over WebRTC without requiring signalling servers
License: MIT 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!
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.
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
.
When updating go-libp2p-testing, the transport tests fail:
go-libp2p-webrtc-direct/webrtcdirect_test.go
Lines 14 to 29 in 0a5a6f1
=== 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
if you get time you you make a golang client too using libp2p ?
The current SCTP implementation seems to get into trouble because/when the reader starts lagging behind on incoming traffic. Related issues:
TODO
libp2p/go-libp2p-transport/test
suite.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:
Close
and Reset
using data channels.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
go-libp2p-core now holds the main interfaces and abstractions that make up go-libp2p, see libp2p/go-libp2p#602. We should use it to reduce the dependency graph.
We recently changed the way we close streams. The stream here doesn't implement CloseRead
yet.
We dual license our code under MIT and ASLv2 following the practices of the Permissive License Stack: https://protocol.ai/blog/announcing-the-permissive-license-stack/
Support js/wasm
build target.
TODO
js/wasm
build target in pions/datachannel
DataChannel.Detach
support using the js/wasm
build target in pions/webrtc
.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.
The implementation of the ConnSecurity interface needs to be completed.
TODO
Add JS equivalent of libp2p-echo example to show off compatibility.
Test integration with the JavaScript counterpart of this library: libp2p/js-libp2p-webrtc-direct.
Update: There are now integration examples under the examples directory.
TODO:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.