quic-go: github.com/lucas-clemente/quic-go/http3 Index | Files

package http3

import "github.com/lucas-clemente/quic-go/http3"

Index

Package Files

body.go client.go error_codes.go frames.go gzip_reader.go request.go request_writer.go response_writer.go roundtrip.go server.go

Variables

var ErrNoCachedConn = errors.New("http3: no cached connection was available")

ErrNoCachedConn is returned when RoundTripper.OnlyCachedConn is set

func ListenAndServe Uses

func ListenAndServe(addr, certFile, keyFile string, handler http.Handler) error

ListenAndServe listens on the given network address for both, TLS and QUIC connetions in parallel. It returns if one of the two returns an error. http.DefaultServeMux is used when handler is nil. The correct Alt-Svc headers for QUIC are set.

func ListenAndServeQUIC Uses

func ListenAndServeQUIC(addr, certFile, keyFile string, handler http.Handler) error

ListenAndServeQUIC listens on the UDP network address addr and calls the handler for HTTP/3 requests on incoming connections. http.DefaultServeMux is used when handler is nil.

type RoundTripOpt Uses

type RoundTripOpt struct {
    // OnlyCachedConn controls whether the RoundTripper may
    // create a new QUIC connection. If set true and
    // no cached connection is available, RoundTrip
    // will return ErrNoCachedConn.
    OnlyCachedConn bool
}

RoundTripOpt are options for the Transport.RoundTripOpt method.

type RoundTripper Uses

type RoundTripper struct {

    // DisableCompression, if true, prevents the Transport from
    // requesting compression with an "Accept-Encoding: gzip"
    // request header when the Request contains no existing
    // Accept-Encoding value. If the Transport requests gzip on
    // its own and gets a gzipped response, it's transparently
    // decoded in the Response.Body. However, if the user
    // explicitly requested gzip it is not automatically
    // uncompressed.
    DisableCompression bool

    // TLSClientConfig specifies the TLS configuration to use with
    // tls.Client. If nil, the default configuration is used.
    TLSClientConfig *tls.Config

    // QuicConfig is the quic.Config used for dialing new connections.
    // If nil, reasonable default values will be used.
    QuicConfig *quic.Config

    // Dial specifies an optional dial function for creating QUIC
    // connections for requests.
    // If Dial is nil, quic.DialAddr will be used.
    Dial func(network, addr string, tlsCfg *tls.Config, cfg *quic.Config) (quic.Session, error)

    // MaxResponseHeaderBytes specifies a limit on how many response bytes are
    // allowed in the server's response header.
    // Zero means to use a default limit.
    MaxResponseHeaderBytes int64
    // contains filtered or unexported fields
}

RoundTripper implements the http.RoundTripper interface

func (*RoundTripper) Close Uses

func (r *RoundTripper) Close() error

Close closes the QUIC connections that this RoundTripper has used

func (*RoundTripper) RoundTrip Uses

func (r *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip does a round trip.

func (*RoundTripper) RoundTripOpt Uses

func (r *RoundTripper) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Response, error)

RoundTripOpt is like RoundTrip, but takes options.

type Server Uses

type Server struct {
    *http.Server

    // By providing a quic.Config, it is possible to set parameters of the QUIC connection.
    // If nil, it uses reasonable default values.
    QuicConfig *quic.Config
    // contains filtered or unexported fields
}

Server is a HTTP2 server listening for QUIC connections.

func (*Server) Close Uses

func (s *Server) Close() error

Close the server immediately, aborting requests and sending CONNECTION_CLOSE frames to connected clients. Close in combination with ListenAndServe() (instead of Serve()) may race if it is called before a UDP socket is established.

func (*Server) CloseGracefully Uses

func (s *Server) CloseGracefully(timeout time.Duration) error

CloseGracefully shuts down the server gracefully. The server sends a GOAWAY frame first, then waits for either timeout to trigger, or for all running requests to complete. CloseGracefully in combination with ListenAndServe() (instead of Serve()) may race if it is called before a UDP socket is established.

func (*Server) ListenAndServe Uses

func (s *Server) ListenAndServe() error

ListenAndServe listens on the UDP address s.Addr and calls s.Handler to handle HTTP/3 requests on incoming connections.

func (*Server) ListenAndServeTLS Uses

func (s *Server) ListenAndServeTLS(certFile, keyFile string) error

ListenAndServeTLS listens on the UDP address s.Addr and calls s.Handler to handle HTTP/3 requests on incoming connections.

func (*Server) Serve Uses

func (s *Server) Serve(conn net.PacketConn) error

Serve an existing UDP connection. It is possible to reuse the same connection for outgoing connections. Closing the server does not close the packet conn.

func (*Server) SetQuicHeaders Uses

func (s *Server) SetQuicHeaders(hdr http.Header) error

SetQuicHeaders can be used to set the proper headers that announce that this server supports QUIC. The values that are set depend on the port information from s.Server.Addr, and currently look like this (if Addr has port 443):

Alt-Svc: quic=":443"; ma=2592000; v="33,32,31,30"

Package http3 imports 25 packages (graph) and is imported by 12 packages. Updated 2019-09-17. Refresh now. Tools for package owners.