socket

package
v0.0.0-...-e3e3546 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: BSD-3-Clause Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatePassive = iota
	StateConnected
	StateConnecting
	StateListening
	StateClosed
)

Variables

This section is empty.

Functions

func Init

func Init() error

Types

type ImmutableState

type ImmutableState struct {
	// contains filtered or unexported fields
}

type Inode

type Inode struct {
	Domain int
	Number uint64
	// contains filtered or unexported fields
}

func (*Inode) LogValue

func (ino *Inode) LogValue() slog.Value

type InodeTable

type InodeTable struct {
	// contains filtered or unexported fields
}

func NewInodeTable

func NewInodeTable() *InodeTable

func (*InodeTable) Add

func (t *InodeTable) Add(ino *Inode)

func (*InodeTable) Get

func (t *InodeTable) Get(number uint64) (*Inode, bool)

type Socket

type Socket struct {
	Inode *Inode
	FD    *fd.FD
	// contains filtered or unexported fields
}

func CreateSocket

func CreateSocket(global *global.Global, tmpl *event.Event, domain int, typ int) (*Socket, error)

func NewSocket

func NewSocket(global *global.Global, tmpl *event.Event, inode *Inode, fd *fd.FD) *Socket

func (*Socket) Accept

func (s *Socket) Accept(flags int) (*Socket, syscall.Errno, error)

func (*Socket) Bind

func (s *Socket) Bind(addr netip.AddrPort) (syscall.Errno, error)

Bind binds the socket to the given address. Internally, it uses a dummy temporary socket in order to check if the address is bindable and also reserve the address for future operations.

func (*Socket) BindAddr

func (s *Socket) BindAddr() (netip.AddrPort, syscall.Errno, error)

func (*Socket) Close

func (s *Socket) Close() syscall.Errno

func (*Socket) Connect

func (s *Socket) Connect(addr netip.AddrPort) (syscall.Errno, error)

func (*Socket) Errno

func (s *Socket) Errno() unix.Errno

func (*Socket) Listen

func (s *Socket) Listen(backlog int) (syscall.Errno, error)

func (*Socket) LogValue

func (s *Socket) LogValue() slog.Value

func (*Socket) PeerAddr

func (s *Socket) PeerAddr() (netip.AddrPort, syscall.Errno, error)

Jump to

Keyboard shortcuts

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