Documentation ¶
Index ¶
- 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 Run()
- func ServeRPC()
- type ThrottledListener
Constants ¶
This section is empty.
Variables ¶
var ( Port = flag.Int("port", 0, "port for the server") // filled in when calling Run or RunSecure ListeningURL url.URL )
var (
SecurePort = flag.Int("secure-port", 0, "port for the secure server")
)
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. 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.
Types ¶
type ThrottledListener ¶
ThrottledListener throttles the number connections accepted to the specified rate.