network

package
v0.0.0-...-5607d3c Latest Latest
Warning

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

Go to latest
Published: May 13, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrListenerStopped = errors.New("listener was stopped")

Functions

func CreateHTTPListener

func CreateHTTPListener(conf *config.Config) (l net.Listener, err error)

CreateHTTPListener creates a net.Listener for main http webapp given main config

func CreateScraperSocket

func CreateScraperSocket(conf *config.Config) (pc net.PacketConn, err error)

CreateScraperSocket creates a UDP Scraper socket

func WrapListener

func WrapListener(l net.Listener) net.Listener

WrapListener wraps a net.Listener such that it can be closed gracefully

Types

type GracefulHttpCloser

type GracefulHttpCloser struct {
	Server   *http.Server
	Listener net.Listener
}

implements io.Closer that gracefully closes an http server

func (*GracefulHttpCloser) Close

func (c *GracefulHttpCloser) Close() error

type GracefulListener

type GracefulListener struct {
	// contains filtered or unexported fields
}

GracefulListener provides safe and graceful net.Listener wrapper that prevents error on graceful shutdown

func (*GracefulListener) Accept

func (l *GracefulListener) Accept() (net.Conn, error)

func (*GracefulListener) Addr

func (l *GracefulListener) Addr() net.Addr

func (*GracefulListener) Close

func (l *GracefulListener) Close() (err error)

Jump to

Keyboard shortcuts

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