Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultShutdownTimeout is the default ShutdownTimeout (see Config). DefaultShutdownTimeout = time.Second * 10 )
Variables ¶
This section is empty.
Functions ¶
func BaseTLSConfig ¶
BaseTLSConfig returns a tls.Config with some good default settings for security.
Types ¶
type Config ¶
type Config struct { // Name is the name of the server. It is only used for logging. It can // be empty. Name string // Address is the address to bind the server to. It must be set. Address string // AddressTLS is the address to bind the https server to. It must be set, but is not used if TLS is not configured. AddressTLS string // Whether requests and responses are logged or not. Sometimes you might provide your own logging middleware instead. TrafficLogging bool // TLSConfig is the TLS configuration for the server. It is optional. TLSConfig *TLSConfig // ShutdownTimeout controls how long to wait for requests to finish before // returning from Run() after the context is canceled. It defaults to // 10 seconds if unset. If set to a negative value, the server will be // closed immediately. ShutdownTimeout time.Duration }
Config holds the HTTP server configuration.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the HTTP server.
architecture: Endpoint
func New ¶
func New(log *zap.Logger, handler http.Handler, txtRecords *sharing.TXTRecords, config Config) (*Server, error)
New creates a new URL Service Server.
type TLSConfig ¶
type TLSConfig struct { // CertMagic obtains and renews TLS certificates and staples OCSP responses // Setting this to true will mean the server obtains certificate through Certmagic // and no other config such as CertDir, or CertFile will be considered. CertMagic bool // CertMagicKeyFile is a path to a file containing the CertMagic service account key. CertMagicKeyFile string // CertMagicEmail is the email address to use when creating an ACME account CertMagicEmail string // CertMagicStaging use staging CA endpoints CertMagicStaging bool // CertMagicBucket bucket to use for certstorage CertMagicBucket string // PublicURLs is a list of URLs to issue on a Let's Encrypt cert if enabled. PublicURLs []string // ConfigDir is a path for storing certificate cache data for Let's Encrypt. ConfigDir string // CertDir provides a path containing one or more certificates that should // be loaded. Certs and key files must have the same filename so they can be // paired, e.g. mycert.key, and mycert.crt. This config setting is mutually // exclusive from CertFile and KeyFile. CertDir string // CertFile is a path to a file containing a corresponding cert for KeyFile. CertFile string // KeyFile is a path to a file containing a corresponding key for CertFile. KeyFile string // Ctx context for the oauth2 package which gcslock and gcsops use. // oauth2 stores the context passed into its constructors. Ctx context.Context }
TLSConfig is a struct to handle the preferred/configured TLS options.
Click to show internal directories.
Click to hide internal directories.