listener

package
v0.0.0-...-53df4c2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package listener ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(l *net.TCPListener, keepAlive time.Duration) net.Listener

Wrap wraps a *net.TCPListener to enable the ability to specify a "keep alive" on the connection.

Types

type Listener

type Listener struct {
	// Network is the network type to use.
	Network Network
	// Address is the address to bind to.
	Address string

	// KeepAlive is a duration to keep the connection alive for.
	// Only used for NetworkTCP, NetworkTCP4, and NetworkTCP6.
	KeepAlive time.Duration

	// CertPath is a path to a SSL certificate.
	CertPath string
	// KeyPath is a path to a SSL private key.
	KeyPath string

	// Metrics determines if a metrics endpoint will be exposed on this listener.
	Metrics string
}

Listener .

type Network

type Network string

Network represents a network type.

const (
	NetworkTCP        Network = "tcp"
	NetworkTCP4       Network = "tcp4"
	NetworkTCP6       Network = "tcp6"
	NetworkUNIX       Network = "unix"
	NetworkUNIXPacket Network = "unixpacket"
)

func (Network) String

func (n Network) String() string

type TCPKeepAliveListener

type TCPKeepAliveListener struct {
	*net.TCPListener

	// KeepAlive .
	KeepAlive time.Duration
}

TCPKeepAliveListener is a TCPListener with a keep alive.

func (TCPKeepAliveListener) AcceptTCP

func (l TCPKeepAliveListener) AcceptTCP() (*net.TCPConn, error)

Jump to

Keyboard shortcuts

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