server

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2019 License: Unlicense Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(options ...Option)

Run takes an arbitrary number of options and runs a server. The important steps here are that it configured a storage interface and wires that into a router to be used by the server handler. The runtime also leverages the Shutdown method to attempt a graceful shutdown in the event of an Interrupt signal. The shutdown process attempts to wait for all connections to close but is limited by the server timeout configuration which is passed into the context for the shutdown.

Types

type Option

type Option func(*options)

Option is func signature used for setting Server Options

func WithBaseRoute

func WithBaseRoute(b string) Option

WithBaseRoute takes a string and returns an Option func for setting options.baseRoute

func WithCertFile

func WithCertFile(f string) Option

WithCertFile takes a string and returns an Option func for setting options.certFile

func WithCorsAllowedHeaders

func WithCorsAllowedHeaders(headers []string) Option

WithCorsAllowedHeaders takes cors pointer and returns an Option func for setting cors

func WithCorsAllowedOrigins

func WithCorsAllowedOrigins(origins []string) Option

WithCorsAllowedOrigins takes cors pointer and returns an Option func for setting cors

func WithHost

func WithHost(host string) Option

WithHost takes a string and returns an Option func for setting options.host

func WithKeyFile

func WithKeyFile(f string) Option

WithKeyFile takes a string and returns an Option func for setting options.keyFile

func WithPort

func WithPort(port int) Option

WithPort takes a string and returns an Option func for setting options.port

func WithStorageOptions

func WithStorageOptions(opts ...storage.Option) Option

WithStorageOptions takes a set of storage options and returns an Option func for setting options.storage

func WithTLS

func WithTLS(b bool) Option

WithTLS takes a boolean and returns an Option func for setting options.tls

func WithThrottle

func WithThrottle(t int) Option

WithThrottle takes an int and returns an Option func for setting options.limit

func WithThrottleBacklog

func WithThrottleBacklog(t int) Option

WithThrottleBacklog takes an int and returns an Option func for setting options.backlog

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout takes a string and returns an Option func for setting options.timeout

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL