servenv

package
v0.0.0-...-7c5168d Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2013 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close runs any registered exit hooks in parallel.

func Init

func Init()

func NewThrottledListener

func NewThrottledListener(l net.Listener, maxRate int64, maxBuffer int) net.Listener

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

func RunSecure(port int, securePort int, cert, key, caCert string)

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

func SecureServe(addr string, certFile, keyFile, caFile string)

SecureListen obtains a listener that accepts secure connections

func ServeRPC

func ServeRPC()

Types

type ThrottledListener

type ThrottledListener struct {
	net.Listener
	// contains filtered or unexported fields
}

ThrottledListener throttles the number connections accepted to the specified rate.

func (*ThrottledListener) Accept

func (tln *ThrottledListener) Accept() (c net.Conn, err error)

Accept accepts a new connection, but ensures that the rate does not exceed the specified maxRate.

Jump to

Keyboard shortcuts

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