status-go/vendor/github.com/quic-go/webtransport-go
RichΛrd 0babdad17b
chore: upgrade go-waku to v0.5 (#3213)
* chore: upgrade go-waku to v0.5
* chore: add println and logs to check what's being stored in the enr, and preemptively delete the multiaddr field (#3219)
* feat: add wakuv2 test (#3218)
2023-02-22 17:58:17 -04:00
..
.gitignore chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
LICENSE chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
README.md chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
client.go chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
codecov.yml chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
errors.go chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
protocol.go chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
server.go chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
session.go chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
session_manager.go chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
stream.go chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
streams_map.go chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
version.json chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00

README.md

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. 
})

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.