server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package server provides a restful TCP interface to manage bingo games and boards.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// HTTPSRedirect causes the server to run a redirect from HTTPPORT to HTTPSPort when set
	HTTPSRedirect bool
	// HTTPPort is the HTTP port the server runs on.
	HTTPPort string
	// HTTPSPort is the HTTPS port the server runs on.
	HTTPSPort string
	// TLSCertFile is the public HTTPS TLS certificate file name.
	TLSCertFile string
	// TLSKeyFile is the private HTTPS TLS key file name.
	TLSKeyFile string
	// GameCount is the number of game states kept in the game list.
	GameCount int
	// Time is a function that can add a timestamp to parts of the site.
	Time func() string
}

Config is used to create a server.

func (Config) NewServer

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

NewServer initializes HTTP and HTTPS TCP servers from the Configs

func (Config) QRCode

func (Config) QRCode(text string, width, height int) (image.Image, error)

QRCode uses a real qr code encoder to create an image of the desired size.

type Server

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

Server manages bingo games and creates boards.

func (*Server) Run

func (s *Server) Run() <-chan error

Run starts the HTTP and HTTPS TCP servers.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown waits for the HTTP and HTTPS servers to shut down.

Directories

Path Synopsis
Package handler evaluates site requests.
Package handler evaluates site requests.
qr
Package qr encodes board text into images
Package qr encodes board text into images

Jump to

Keyboard shortcuts

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