Documentation
¶
Overview ¶
Package server provides an easy to use HTTP/HTTPS server. It provides some benefits over using the standard library directly, such as the ability to gracefully shut down active connections, and to do low (zero?) downtime restarts.
Index ¶
- Constants
- type DetachedListeners
- type Server
- func (s *Server) AddTLSCertificate(certPEMBlock, keyPEMBlock []byte) error
- func (s *Server) AddTLSCertificateFromFile(certFile, keyFile string) error
- func (s *Server) Detach() DetachedListeners
- func (s *Server) ForceShutdown()
- func (s *Server) Listen(addr string) error
- func (s *Server) ReuseListeners(listeners DetachedListeners)
- func (s *Server) Serve()
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) Shutdown()
Constants ¶
const ( TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x0016 TLS_DHE_RSA_WITH_AES_128_CBC_SHA uint16 = 0x0033 TLS_DHE_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0039 TLS_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0x003c TLS_RSA_WITH_AES_256_CBC_SHA256 uint16 = 0x003d TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0x0067 TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 uint16 = 0x006b TLS_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x009c TLS_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0x009d TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x009e TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0x009f TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xc008 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 uint16 = 0xc023 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 uint16 = 0xc024 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0xc027 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 uint16 = 0xc028 TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 uint16 = 0xc02c TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0xc030 )
A list of strong cipher suite IDs that are not defined by the crypto/tls package in the current stable version of Go. Values taken from http://www.iana.org/assignments/tls-parameters/tls-parameters.xml
Note that the reason they are not defined by the crypto/tls package is because they are not (yet?) supported by Go. Defining them here allows us to immediately start using them, should Go support them in the future.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DetachedListeners ¶
DetachedListeners is an address to file descriptor mapping of listeners that have been detached.
type Server ¶
Server is a simple HTTP/HTTPS server.
func (*Server) AddTLSCertificate ¶
AddTLSCertificate reads the certificate and private key from the provided PEM blocks, and adds the certificate to the list of certificates that the server can use.
func (*Server) AddTLSCertificateFromFile ¶
AddTLSCertificateFromFile reads the certificate and private key from the provided file paths, and adds the certificate to the list of certificates that the server can use.
func (*Server) Detach ¶
func (s *Server) Detach() DetachedListeners
Detach returns an address to file descriptor mapping for all listeners.
func (*Server) ForceShutdown ¶
func (s *Server) ForceShutdown()
ForceShutdown forcefully closes all currently active connections. Little care is shown in making sure things are cleaned up, so this should generally only be used as a last resort.
func (*Server) Listen ¶
Listen will begin listening on the given address, either by reusing an existing listener, or by creating a new one.
func (*Server) ReuseListeners ¶
func (s *Server) ReuseListeners(listeners DetachedListeners)
ReuseListeners provides an address to file descriptor mapping of listeners that the server can reuse instead of creating a new listener.