package sock

import "github.com/tetratelabs/wazero/internal/sock"

Index

Constants

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

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.

Source Files

sock.go sock_supported.go

Version
v1.9.0 (latest)
Published
Feb 18, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
4 days ago

Tools for package owners.