Documentation ¶
Index ¶
- 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(port int)
- func RunSecure(port int, securePort int, cert, key, caCert string)
- func SecureServe(addr string, certFile, keyFile, caFile string)
- func ServeRPC()
- type ThrottledListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.
func Run ¶
func Run(port int)
Run starts listening for RPC and HTTP requests on the given port, and blocks until it the process gets a signal.
func RunSecure ¶
RunSecure is like Run, but it additionally listens for RPC and HTTP requests using TLS on securePort, using the passed certificate, key, and CA certificate.
func SecureServe ¶
SecureListen obtains a listener that accepts secure connections
Types ¶
type ThrottledListener ¶
ThrottledListener throttles the number connections accepted to the specified rate.