Documentation ¶
Index ¶
- func ListenAndServeQUIC(addr, certFile, keyFile string, handler http.Handler) error
- 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 ¶
Types ¶
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
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.
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"