Documentation ¶
Index ¶
- func ListenAndServe(addr, certFile, keyFile string, handler http.Handler) error
- func ListenAndServeQUIC(addr, certFile, keyFile string, handler http.Handler) error
- type Client
- type QuicRoundTripper
- type Server
- func (s *Server) Close() error
- func (s *Server) CloseGracefully(timeout time.Duration) error
- func (s *Server) ListenAndServe() error
- func (s *Server) ListenAndServeTLS(certFile, keyFile string) error
- func (s *Server) Serve(conn *net.UDPConn) error
- func (s *Server) SetQuicHeaders(hdr http.Header) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
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.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a HTTP2 client doing QUIC requests
type QuicRoundTripper ¶
type QuicRoundTripper 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 // contains filtered or unexported fields }
QuicRoundTripper implements the http.RoundTripper interface
type Server ¶
type Server struct { *http.Server // Private flag for demo, do not use CloseAfterFirstRequest bool // contains filtered or unexported fields }
Server is a HTTP2 server listening for QUIC connections.
func (*Server) Close ¶
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 ¶
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 ¶
ListenAndServe listens on the UDP address s.Addr and calls s.Handler to handle HTTP/2 requests on incoming connections.
func (*Server) ListenAndServeTLS ¶
ListenAndServeTLS listens on the UDP address s.Addr and calls s.Handler to handle HTTP/2 requests on incoming connections.
func (*Server) SetQuicHeaders ¶
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):
Alternate-Protocol: 443:quic Alt-Svc: quic=":443"; ma=2592000; v="33,32,31,30"