Documentation ¶
Index ¶
- Constants
- Variables
- func AddStatusFuncs(fmap template.FuncMap)
- func AddStatusPart(banner, frag string, f func() interface{})
- func AddStatusSection(banner string, f func() string)
- func Close()
- func Init()
- func NewThrottledListener(l net.Listener, maxRate int64, maxBuffer int) net.Listener
- func OnClose(f func())
- func OnRun(f func())
- func OnTerm(f func())
- func RegisterDefaultFlags()
- func RegisterDefaultSecureFlags()
- func RegisterDefaultSocketFileFlags()
- func Run(port int)
- func RunDefault()
- func ServeRPC()
- func ServeSecurePort(securePort int, certFile, keyFile, caCertFile string)
- func ServeSocketFile(name string)
- func StatusURLPath() string
- type ThrottledListener
Constants ¶
const JQueryIncludes = `` /* 287-byte string literal not displayed */
JQueryIncludes is the include to use to be able to use jquery and jquery-ui
Variables ¶
var ( // The flags used when calling RegisterDefaultSecureFlags. SecurePort *int CertFile *string KeyFile *string CACertFile *string )
var ( // The flags used when calling RegisterDefaultFlags. Port *int // filled in when calling Run ListeningURL url.URL )
var ( // The flags used when calling RegisterDefaultSocketFileFlags. SocketFile *string )
Functions ¶
func AddStatusFuncs ¶
AddStatusFuncs merges the provided functions into the set of functions used to render /debug/status. Call this before AddStatusPart if your template requires custom functions.
func AddStatusPart ¶
func AddStatusPart(banner, frag string, f func() interface{})
AddStatusPart adds a new section to status. frag is used as a subtemplate of the template used to render /debug/status, and will be executed using the value of invoking f at the time of the /debug/status request. frag is parsed and executed with the html/template package. Functions registered with AddStatusFuncs may be used in the template.
func AddStatusSection ¶
AddStatusSection registers a function that generates extra information for /debug/status. If banner is not empty, it will be used as a header before the information. If more complex output than a simple string is required use AddStatusPart instead.
func NewThrottledListener ¶
NewThrottledListener creates a ThrottledListener. maxRate specifies the maximum rate of accepts per second. If the backlog exceeds maxBuffer, the newly accepted connection is immediately closed.
func OnClose ¶
func OnClose(f func())
OnClose registers f to be run at the end of the app lifecycle. This happens after the lameduck period just before the program exits. All hooks are run in parallel.
func OnRun ¶
func OnRun(f func())
OnRun registers f to be run right at the beginning of Run. All hooks are run in parallel.
func OnTerm ¶
func OnTerm(f func())
OnTerm registers f to be run when the process receives a SIGTERM. All hooks are run in parallel. This allows the program to change its behavior during the lameduck period.
func RegisterDefaultFlags ¶
func RegisterDefaultFlags()
RegisterDefaultFlags registers the default flags for listening to a given port for standard connections. If calling this, then call RunDefault()
func RegisterDefaultSecureFlags ¶
func RegisterDefaultSecureFlags()
RegisterDefaultSecureFlags registers the default flags for listening to a different port for secure connections. It also registers an OnRun callback to enable the listening socket. This needs to be called before flags are parsed.
func RegisterDefaultSocketFileFlags ¶
func RegisterDefaultSocketFileFlags()
RegisterDefaultSocketFileFlags registers the default flags for listening to a socket. It also registers an OnRun callback to enable the listening socket. This needs to be called before flags are parsed.
func Run ¶
func Run(port int)
Run starts listening for RPC and HTTP requests, and blocks until it the process gets a signal.
func ServeSecurePort ¶
ServerSecurePort obtains a listener that accepts secure connections. If the provided port is zero, the listening is disabled.
func ServeSocketFile ¶
func ServeSocketFile(name string)
ServeSocketFile listen to the named socket and serves RPCs on it.
Types ¶
type ThrottledListener ¶
ThrottledListener throttles the number connections accepted to the specified rate.