srvhttp

package
v7.0.0-rc1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 13 Imported by: 21

Documentation

Index

Constants

View Source
const CommonAPIDataDateFormat = "Mon Jan 02 15:04:05 UTC 2006"

CommonAPIDataDataFormat is a common Date format for the API

Variables

This section is empty.

Functions

func DateStr

func DateStr(t time.Time) string

DateStr returns the given time in the format expected by Traffic Monitor 1.0 API users

func GetCommonAPIData

func GetCommonAPIData(params url.Values, t time.Time) tc.CommonAPIData

GetCommonAPIData calculates and returns API data common to most endpoints

func ParametersStr

func ParametersStr(params url.Values) string

ParametersStr takes the URL query parameters, and returns a string as used by the Traffic Monitor 1.0 endpoints "pp" key.

Types

type Server

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

Server is a re-runnable HTTP server. Server.Run() may be called repeatedly, and each time the previous running server will be stopped, and the server will be restarted with the new port address and data request channel.

func (*Server) Run

func (s *Server) Run(endpoints map[string]http.HandlerFunc, addr string, readTimeout time.Duration, writeTimeout time.Duration, staticFileDir string, tls bool, certFile string, keyFile string) error

Run runs a new HTTP service at the given addr, making data requests to the given c. Run may be called repeatedly, and each time, will shut down any existing service first. Run is NOT threadsafe, and MUST NOT be called concurrently by multiple goroutines.

func (*Server) RunHTTPSRedirect

func (s *Server) RunHTTPSRedirect(addr string, addrForRedirect string, readTimeout time.Duration, writeTimeout time.Duration, staticFileDir string) error

Jump to

Keyboard shortcuts

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