http

package
v0.0.0-...-5c8b849 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package http manages the motki application web server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SSL        SSLConfig       `toml:"ssl"`
	Session    session.Config  `toml:"sessions"`
	Templating template.Config `toml:"templates"`

	ListenAddr string `toml:"listen"`
	Redirect   bool   `toml:"redirect"`
	// contains filtered or unexported fields
}

Config defines the basic configuration for the web server.

type SSLConfig

type SSLConfig struct {
	ListenAddr string   `toml:"listen"`
	AutoCert   bool     `toml:"autocert"`
	CertFile   string   `toml:"certfile"`
	CertKey    string   `toml:"keyfile"`
	RequireSSL bool     `toml:"require"`
	ExtraHosts []string `toml:"extra_hosts"`
	// contains filtered or unexported fields
}

SSLConfig defines a TLS configuration for the web server.

func (SSLConfig) TLSConfig

func (c SSLConfig) TLSConfig() (*tls.Config, error)

TLSConfig attempts to load the configured certificate.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is a wrapper used to orchestrate functions of the web server.

func New

func New(c Config, l log.Logger) (*Server, error)

New creates a new web server instance with the given configuration.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe begins listening for HTTP requests.

func (*Server) ListenAndServeTLS

func (s *Server) ListenAndServeTLS() error

ListenAndServeTLS begins listening for HTTPS requests.

func (*Server) Register

func (s *Server) Register(mods ...module) error

Register initializes the given modules.

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown attempts to shutdown both the HTTP and HTTPS servers gracefully.

Directories

Path Synopsis
Package auth manages authentication for the motki application.
Package auth manages authentication for the motki application.
Package middleware contains HTTP middlewares for Session and Auth.
Package middleware contains HTTP middlewares for Session and Auth.
module
assets
Package assets is the web module responsible for serving static assets.
Package assets is the web module responsible for serving static assets.
home
Package home contains the basic public functionality of the MOTKI app.
Package home contains the basic public functionality of the MOTKI app.
industry
Package industry contains functionality related to market and industry.
Package industry contains functionality related to market and industry.
market
Package market contains functionality related to market and industry.
Package market contains functionality related to market and industry.
Package route encapsulates HTTP routing and handlers.
Package route encapsulates HTTP routing and handlers.
Package session provides session management capabilities.
Package session provides session management capabilities.
Package template provides template rendering capabilities.
Package template provides template rendering capabilities.

Jump to

Keyboard shortcuts

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