httpServer

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(bind string, port int, env *Environment)

Types

type AddMessage

type AddMessage struct {
	Type   string
	HostId string
	Host   Host
}

type Container

type Container struct {
	ID      string         `json:"Id"`
	Created time.Time      `json:"Created,omitempty"`
	Image   string         `json:"Image,omitempty"`
	Mounts  []docker.Mount `json:"Mounts,omitempty"`
}

type Environment

type Environment struct {
	Storage *dnsStorage.DnsStorage
}

type Error

type Error interface {
	error
	Status() int
}

Error represents a handler error. It provides methods for a HTTP status code and embeds the built-in error interface.

func HandleApiNotFound

func HandleApiNotFound(env *Environment, w http.ResponseWriter, r *http.Request) Error

func HandleGetHosts

func HandleGetHosts(env *Environment, w http.ResponseWriter, r *http.Request) Error

func HandleWsHosts

func HandleWsHosts(env *Environment, w http.ResponseWriter, r *http.Request) Error

type Handler

type Handler struct {
	Env    *Environment
	Handle HandlerHandleFunc
}

func (Handler) ServeHTTP

func (handler Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HandlerHandleFunc

type HandlerHandleFunc func(e *Environment, w http.ResponseWriter, r *http.Request) Error

type Host

type Host struct {
	Name      string
	Address   string
	Aliases   []string
	Container Container
	Ports     []Port
}

type HttpRoute

type HttpRoute struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc HandlerHandleFunc
}

type HttpRoutes

type HttpRoutes []HttpRoute

type Port

type Port struct {
	Port     int
	Protocol string
}

type RemoveMessage

type RemoveMessage struct {
	Type   string
	HostId string
}

type StatusError

type StatusError struct {
	Code int
	Err  error
}

StatusError represents an error with an associated HTTP status code.

func (StatusError) Error

func (statusError StatusError) Error() string

func (StatusError) Status

func (statusError StatusError) Status() int

type WsRoute

type WsRoute struct {
	Name        string
	Pattern     string
	HandlerFunc HandlerHandleFunc
}

type WsRoutes

type WsRoutes []WsRoute

Jump to

Keyboard shortcuts

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