sock

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SHUT_RD   = syscall.SHUT_RD
	SHUT_RDWR = syscall.SHUT_RDWR
	SHUT_WR   = syscall.SHUT_WR
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// TCPAddresses is a slice of the configured host:port pairs.
	TCPAddresses []TCPAddress
}

Config is an internal struct meant to implement the interface in experimental/sock/Config.

func (*Config) BuildTCPListeners

func (c *Config) BuildTCPListeners() (tcpListeners []*net.TCPListener, err error)

BuildTCPListeners build listeners from the current configuration.

func (*Config) WithTCPListener

func (c *Config) WithTCPListener(host string, port int) *Config

WithTCPListener implements the method of the same name in experimental/sock/Config.

However, to avoid cyclic dependencies, this is returning the *Config in this scope. The interface is implemented in experimental/sock/Config via delegation.

type ConfigKey

type ConfigKey struct{}

ConfigKey is a context.Context Value key. Its associated value should be a Config.

type TCPAddress

type TCPAddress struct {
	// Host is the host name for this listener.
	Host string
	// Port is the port number for this listener.
	Port int
}

TCPAddress is a host:port pair to pre-open.

func (TCPAddress) String

func (t TCPAddress) String() string

type TCPConn

type TCPConn interface {
	sys.File

	// Recvfrom only supports the flag sysfs.MSG_PEEK
	// TODO: document this like sys.File with known sys.Errno
	Recvfrom(p []byte, flags int) (n int, errno sys.Errno)

	// TODO: document this like sys.File with known sys.Errno
	Shutdown(how int) sys.Errno
}

TCPConn is a pseudo-file representing a TCP connection.

type TCPSock

type TCPSock interface {
	sys.File

	Accept() (TCPConn, sys.Errno)
}

TCPSock is a pseudo-file representing a TCP socket.

Jump to

Keyboard shortcuts

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