server

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

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

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package server contains HTTP servers for the website.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Log is used to log errors and other information
	Log *log.Logger
	// Version is used to bust caches of files from older server versions.
	Version string
	// HTTPPort is the TCP port for server http requests.  All traffic is redirected to the https port.
	HTTPPort int
	// HTTPSPORT is the TCP port for server https requests.
	HTTPSPort int
	// The public HTTPS certificate file.
	TLSCertFile string
	// The private HTTPS key file.
	TLSKeyFile string
}

Config contains fields which describe the server.

func (Config) NewServer

func (cfg Config) NewServer() (*Server, error)

NewServer creates a Server from the Config.

type Server

type Server struct {
	Data interface{}

	Config
	// contains filtered or unexported fields
}

Server runs the site.

func (Server) Run

func (s Server) Run(ctx context.Context) <-chan error

Run the server asynchronously until it receives a shutdown signal. When the HTTP/HTTPS servers stop, errors are logged to the error channel.

func (Server) Stop

func (s Server) Stop(ctx context.Context) error

Stop asks the server to shutdown and waits for the shutdown to complete. An error is returned if the server if the context times out.

Jump to

Keyboard shortcuts

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