sysconn

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

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

Go to latest
Published: Feb 23, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Control

func Control(conn syscall.Conn, fn func(fd int) error) error

Control invokes conn.SyscallConn().Control.

func ControlInt

func ControlInt(conn syscall.Conn, fn func(fd int) (int, error)) (int, error)

ControlInt invokes conn.SyscallConn().Control and returns an integer.

func Filter

func Filter(conns []syscall.Conn, ps ...Predicate) ([]syscall.Conn, error)

Filter a list of conns with a list of predicates.

Returns a list of conns for which all predicates returned true.

func FilterConn

func FilterConn(conn syscall.Conn, ps ...Predicate) (keep bool, err error)

Apply a list of predicates to a conn.

Returns true if all predicates return true, false if no predicates were given.

func FilterFd

func FilterFd(fd int, ps ...Predicate) (keep bool, err error)

FilterFD is like FilterConn except that it takes a raw fd.

Types

type Predicate

type Predicate func(fd int) (keep bool, err error)

Predicate is a condition for keeping or rejecting a file.

func FirstReuseport

func FirstReuseport() Predicate

FirstReuseport filters out all but the first socket of a reuseport group.

Non-reuseport sockets and non-sockets are ignored.

func IgnoreENOTSOCK

func IgnoreENOTSOCK(p Predicate) Predicate

IgnoreENOTSOCK wraps a predicate and returns false instead of unix.ENOTSOCK.

func InetListener

func InetListener(network string) Predicate

InetListener returns a predicate that keeps listening TCP or connected UDP sockets.

It filters out any files that are not sockets.

func LocalAddress

func LocalAddress(ip netaddr.IP, port int) Predicate

LocalAddress filters for sockets with the given address and port.

Jump to

Keyboard shortcuts

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