WebTransport implementation based on quic-go (https://datatracker.ietf.org/doc/draft-ietf-webtrans-http3/)

webtransport-go

PkgGoDev Code Coverage

webtransport-go is an implementation of the WebTransport protocol, based on quic-go. It currently implements draft-02 of the specification.

Running a Server

// create a new webtransport.Server, listening on (UDP) port 443
s := webtransport.Server{
    H3: http3.Server{Addr: ":443"},
}

// Create a new HTTP endpoint /webtransport.
http.HandleFunc("/webtransport", func(w http.ResponseWriter, r *http.Request) {
    conn, err := s.Upgrade(w, r)
    if err != nil {
        log.Printf("upgrading failed: %s", err)
        w.WriteHeader(500)
        return
    }
    // Handle the connection. Here goes the application logic. 
    // Once this function returns, the WebTransport connection is closed.
    // If the connection is handled async, it is possible to block until it closed
    // by using the connection's context: <-conn.Context().Done().
})

s.ListenAndServeTLS(certFile, keyFile)

Now that the server is running, Chrome can be used to establish a new WebTransport session as described in this tutorial.

Running a Client

var d webtransport.Dialer
rsp, conn, err := d.Dial(ctx, "https://example.com/webtransport", nil)
// err is only nil if rsp.StatusCode is a 2xx
// Handle the connection. Here goes the application logic.
Owner
Marten Seemann
libp2p maintainer
Marten Seemann
Comments
  • feat: Implement datagram send/receive support

    feat: Implement datagram send/receive support

    Only thing it required that I'm "eh" about is the cast to quic.Connection. Maybe we are missing some interface surface in quic-go that should be added?

  • use a buffered channel in the acceptQueue

    use a buffered channel in the acceptQueue

    There's a race condition here. A user might call Next to obtain the next stream, and get a nil result. He then calls Chan get notified about new incoming streams. If a new stream is accepted between the call to Next and the call to Chan, he won't be notified about that stream, unless the channel is buffered.

  • webtransport.Stream implementing net.Conn

    webtransport.Stream implementing net.Conn

    Hi,

    Context:

    Thank you for a great library. I have started implementing a layer on top of webtransport-go (when HTTP/3 connectivity is available on the network) with a fallback to yamux over HTTP/1.1 upgraded connections (when HTTP/3 fails to connect).

    Proposal:

    yamux multiplexed streams implement net.Conn. webtransport.Stream almost implements net.Conn - it is missing LocalAddr() net.Addr and RemoteAddr() net.Addr. These could be implemented by just returning the values of the underlying webtransport.Session. This would be valuable to me as then I can have a wrapper that returns net.Conn in either scenario.

    Do you see any reason why this would be undesirable? Was not implementing these methods intentional, or just a use case that had yet to be considered?

  • Typescript bindings for webtransport

    Typescript bindings for webtransport

    I realize this is all about golang, but connecting from the browser in typescript projects would be nice. Anybody got ideas? Next time I'll post questions like this in discussions, once they are enabled.

  • flaky TestOpenStreamSyncShutdown/bidirectional_streams

    flaky TestOpenStreamSyncShutdown/bidirectional_streams

    === RUN   TestOpenStreamSyncShutdown/bidirectional_streams
        webtransport_test.go:445: 
            	Error Trace:	/home/runner/work/webtransport-go/webtransport-go/webtransport_test.go:433
            	            				/home/runner/work/webtransport-go/webtransport-go/webtransport_test.go:445
            	Error:      	Should be in error chain:
            	            	expected: %!q(**webtransport.ConnectionError=0xc0000102b0)
            	            	in chain: 
            	Test:       	TestOpenStreamSyncShutdown/bidirectional_streams
    === RUN   TestOpenStreamSyncShutdown/unidirectional_streams
    --- FAIL: TestOpenStreamSyncShutdown (0.23s)
        --- FAIL: TestOpenStreamSyncShutdown/bidirectional_streams (0.12s)
        --- PASS: TestOpenStreamSyncShutdown/unidirectional_streams (0.12s)
  • flaky TestBidirectionalStreamsDataTransfer/server-initiated test

    flaky TestBidirectionalStreamsDataTransfer/server-initiated test

    === RUN   TestBidirectionalStreamsDataTransfer/server-initiated
        webtransport_test.go:88: 
            	Error Trace:	/Users/runner/work/webtransport-go/webtransport-go/webtransport_test.go:88
            	            				/Users/runner/work/webtransport-go/webtransport-go/webtransport_test.go:158
            	Error:      	Received unexpected error:
            	            	timeout: no recent network activity
            	Test:       	TestBidirectionalStreamsDataTransfer/server-initiated
    --- FAIL: TestBidirectionalStreamsDataTransfer (5.06s)
        --- PASS: TestBidirectionalStreamsDataTransfer/client-initiated (0.01s)
        --- FAIL: TestBidirectionalStreamsDataTransfer/server-initiated (5.06s)
  • Media streaming problem

    Media streaming problem

    In the uniStream, io.ReadAll for receiving each video frames always causes "deadline exceeded" error. How can i receive the frames simply without collecting partial packets? This is the case that client and server are coded in golang.

  • flaky TestStreamsImmediateReset

    flaky TestStreamsImmediateReset

    === RUN   TestStreamsImmediateReset
        webtransport_test.go:257: 
            	Error Trace:	webtransport_test.go:257
            	Error:      	Received unexpected error:
            	            	Application error 0x105: received HTTP/3 frame on bidirectional stream
            	Test:       	TestStreamsImmediateReset
    --- FAIL: TestStreamsImmediateReset (0.01s)
  • Goroutine Leak monitoring request

    Goroutine Leak monitoring request

    I am experimenting with the codebase and I noticed goroutine leak regarding a goroutine quic-go http3/client.go monitoring the request after it was hijacked.

    //`http3/client.go
    func (c *client) RoundTrip(req *http.Request) (*http.Response, error) {
    ...
    	// Request Cancellation:
    	// This go routine keeps running even after RoundTrip() returns.
    	// It is shut down when the application is done processing the body.
    	reqDone := make(chan struct{})
    	go func() {
    		select {
    		case <-req.Context().Done():
    			str.CancelWrite(quic.StreamErrorCode(errorRequestCanceled))
    			str.CancelRead(quic.StreamErrorCode(errorRequestCanceled))
    		case <-reqDone:
    		}
    	}()
    ...
    }
    

    I got around this by making the context sent to Dial canceled-able and cleaning it up.

  • Support a transport listener interface

    Support a transport listener interface

    It would be interesting for this module to just return the listener and its connection to the application and let the application to have the fun, can we?

    type interface TransportListener
    {
      func Listen() (net.Listener, error)
    }
    
  • return the correct error from OpenStreamSync when context is canceled

    return the correct error from OpenStreamSync when context is canceled

    This might have been the cause of https://github.com/libp2p/go-libp2p/issues/1958.

    cc @Jorropo Would be great if you could do a quick review of this PR, so we can get this landed and released.

  • WebTransport Datagrams

    WebTransport Datagrams

    There are "datagrams" in webtransport:

    https://github.com/w3c/webtransport/blob/main/explainer.md#example-of-sending-unreliable-game-state-to-server-using-datagrams

    But I can't find implementation of this in webtransport-go. Is it a feature that haven't implemented, or I have missed something?

    Thanks!

QUIC-PING: A UDP client for sending QUIC PINGs.

QUIC-PING A UDP client for sending "QUIC PING"s. What is a QUIC PING? A QUIC Initial packet with random payload and the version 0xbabababa to force Ve

Dec 14, 2022
A QUIC implementation in pure go
A QUIC implementation in pure go

A QUIC implementation in pure Go quic-go is an implementation of the QUIC protocol in Go. It implements the IETF QUIC draft-29 and draft-32. Version c

Jan 9, 2023
quiwi 🥝 - QUIC implementation in Go.

Quiwi ?? QUIC transport protocol (https://quicwg.org/) implementation in Go. The goal is to provide low level APIs for applications or protocols using

Nov 16, 2022
Antenna RPC is an RPC protocol for distributed computing, it's based on QUIC and Colfer. its currently an WIP.

aRPC - Antenna Remote Procedure Call Antenna remote procedure call (aRPC) is an RPC protocol focused on distributed processing and HPC. aRPC is implem

Jun 16, 2021
apiDocSrvc - Provide embeded doc server

apiDocSrvc - Provide embeded doc server

Oct 30, 2021
An Etsy StatsD (https://github.com/etsy/statsd) implementation in Go

STATSD-GO Port of Etsy's statsd, written in Go. This was forked from https://github.com/amir/gographite to provide Ganglia submission support. USAGE U

Mar 5, 2021
A framework for building chat interfaces with gioui.org.

chat A framework for building chat interfaces with gioui.org. The canonical copy of this repository is hosted on Sourcehut. We also have: An issue tra

Dec 1, 2022
my fork from google.golang.org/protobuf

Go support for Protocol Buffers This project hosts the Go implementation for protocol buffers, which is a language-neutral, platform-neutral, extensib

Dec 22, 2021
May 8, 2022
Openldap (LDAP) binding for Golang (go) ; no more support ; you may have a look at https://github.com/go-ldap/ldap

OpenLDAP this is Openldap binding in GO language. I don't work any more with golang, so, please fork this project. Installation : Installation is easy

Mar 4, 2021
screen sharing for developers https://screego.net/
screen sharing for developers https://screego.net/

screego/server screen sharing for developers Huge thanks to sipgate for sponsoring this project! Intro In the past I've had some problems sharing my s

Jan 1, 2023
MOSN is a cloud native proxy for edge or service mesh. https://mosn.io
MOSN is a cloud native proxy for edge or service mesh. https://mosn.io

中文 MOSN is a network proxy written in Golang. It can be used as a cloud-native network data plane, providing services with the following proxy functio

Dec 30, 2022
HTTP, HTTP2, HTTPS, Websocket debugging proxy
HTTP, HTTP2, HTTPS, Websocket debugging proxy

English | 简体中文 We recommend updating whistle and Node to ensure that you receive important features, bugfixes and performance improvements. Some versi

Dec 31, 2022
Super fault-tolerant gateway for HTTP clusters, written in Go. White paper for reference - https://github.com/gptankit/serviceq-paper
Super fault-tolerant gateway for HTTP clusters, written in Go. White paper for reference - https://github.com/gptankit/serviceq-paper

ServiceQ ServiceQ is a fault-tolerant gateway for HTTP clusters. It employs probabilistic routing to distribute load during partial cluster shutdown (

Jul 16, 2022
Native ZooKeeper client for Go. This project is no longer maintained. Please use https://github.com/go-zookeeper/zk instead.

Native Go Zookeeper Client Library License 3-clause BSD. See LICENSE file. This Repository is No Longer Maintained Please use https://github.com/go-zo

Dec 19, 2022
inlets-connect is a proxy that supports HTTPS and the CONNECT method

inlets-connect inlets-connect is a proxy that supports HTTPS and the CONNECT method. It can be deployed as a side-car or stand-alone to proxy to a sin

Nov 7, 2022
High performance DNS over HTTPS client & server

DNS-over-HTTPS Client and server software to query DNS over HTTPS, using Google DNS-over-HTTPS protocol and IETF DNS-over-HTTPS (RFC 8484). Guides Tut

Jan 7, 2023
Local Portable HTTP/HTTPS Proxy

SkelgoKey Portable Local Web Proxy - Creates a local proxy that bypasses any network certificate checks - USAGES Windows .\SkeletonKey.exe (web addres

Oct 13, 2021