# README
webtransport-go
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.
})
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.
# Packages
No description provided by the author
# Constants
WebTransportBufferedStreamRejectedErrorCode is the error code of the H3_WEBTRANSPORT_BUFFERED_STREAM_REJECTED error.
# Structs
ConnectionError is a WebTransport connection error.
No description provided by the author
No description provided by the author
No description provided by the author
StreamError is the error that is returned from stream operations (Read, Write) when the stream is canceled.
# Interfaces
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
SessionErrorCode is an error code for session termination.
StreamErrorCode is an error code used for stream termination.