api

package
v0.0.0-...-91ea87c Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: BSD-2-Clause Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuthHost string = ""
View Source
var HTTPListener net.Listener
View Source
var HTTPSListener net.Listener
View Source
var SH = &staticHandler{}

Functions

func CertInit

func CertInit()

func ListenHTTP

func ListenHTTP()

func ListenHTTPS

func ListenHTTPS()

func MakeConsolePassword

func MakeConsolePassword()

func Middleware

func Middleware(next http.Handler) http.Handler

ANY / captures all requests

func RedirectHTTPS

func RedirectHTTPS(w http.ResponseWriter, r *http.Request)

safely redirect non-secure requests.

func RouterInit

func RouterInit()

Types

type Json_cache

type Json_cache struct {
	// Base Name, URI_Prefix "/", and Suffix ".json" are assumed
	// ex "gdlemonitor"
	BaseName string
	// Required Access to GET resource (Default is 0)
	// ex -1, 0, 6
	GetAccess int
	// Required Access to PUT resource (Default is 0)
	// ex -1, 0, 6
	PutAccess int
	// cache Valid Duration (Default is 0, effectively no cache; but it hangs out in memory... meh)
	// ex 30 * time.Minute
	Exp time.Duration
	// (optional) Dynamic Get function- should only populate cache.Content; handler will update
	//  last modified to time.Now().UTC()., unless cache.modified is modified in function.
	Get func(cache *Json_cache) error
	// (optional) Dynamic Put function- should only act on cache.Content; handler will update
	//  last modified to time.Now().UTC()., unless cache.modified is modified in function.
	Put func(cache *Json_cache) error

	sync.Mutex
	// contains filtered or unexported fields
}

func (*Json_cache) Invalidate

func (cache *Json_cache) Invalidate()

func (*Json_cache) ReadFile

func (cache *Json_cache) ReadFile() (err error)

func (*Json_cache) UpdateModified

func (cache *Json_cache) UpdateModified(mod time.Time)

func (*Json_cache) WriteFile

func (cache *Json_cache) WriteFile() (err error)

Jump to

Keyboard shortcuts

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