netutil

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

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetServerTLSConfig

func GetServerTLSConfig(tlsCertFile, tlsKeyFile, tlsMinVersion string, tlsCipherSuites []string) (*tls.Config, error)

GetServerTLSConfig returns TLS config for the server.

func GetTCPNetwork

func GetTCPNetwork() string

GetTCPNetwork returns current tcp network.

func GetUDPNetwork

func GetUDPNetwork() string

GetUDPNetwork returns current udp network.

func ParseTLSVersion

func ParseTLSVersion(s string) (uint16, error)

ParseTLSVersion returns tls version from the given string s.

func TCP6Enabled

func TCP6Enabled() bool

TCP6Enabled returns true if dialing and listening for IPv4 TCP is enabled.

Types

type TCPListener

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

TCPListener listens for the addr passed to NewTCPListener.

It also gathers various stats for the accepted connections.

func NewTCPListener

func NewTCPListener(name, addr string, tlsConfig *tls.Config) (*TCPListener, error)

NewTCPListener returns new TCP listener for the given addr and optional tlsConfig.

name is used for metrics registered in ms. Each listener in the program must have distinct name.

func (*TCPListener) Accept

func (ln *TCPListener) Accept() (net.Conn, error)

Accept accepts connections from the addr passed to NewTCPListener.

Jump to

Keyboard shortcuts

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