package raw

import "gvisor.dev/gvisor/pkg/tcpip/transport/raw"

Package raw provides the implementation of raw sockets (see raw(7)). Raw sockets allow applications to:

Raw sockets don't have any notion of ports, and incoming packets are demultiplexed solely by protocol number. Thus, a raw UDP endpoint will receive every UDP packet received by netstack. bind(2) and connect(2) can be used to filter incoming packets by source and destination.

Index

Functions

func NewEndpoint

func NewEndpoint(stack *stack.Stack, netProto tcpip.NetworkProtocolNumber, transProto tcpip.TransportProtocolNumber, waiterQueue *waiter.Queue) (tcpip.Endpoint, tcpip.Error)

NewEndpoint returns a raw endpoint for the given protocols.

Types

type CreateOnlyFactory

type CreateOnlyFactory struct{}

CreateOnlyFactory implements stack.RawFactory. It allows creation of raw endpoints that do not support reading, writing, binding, etc.

+stateify savable

func (CreateOnlyFactory) NewPacketEndpoint

NewPacketEndpoint implements stack.RawFactory.NewPacketEndpoint.

func (CreateOnlyFactory) NewUnassociatedEndpoint

NewUnassociatedEndpoint implements stack.RawFactory.NewUnassociatedEndpoint.

type EndpointFactory

type EndpointFactory struct{}

EndpointFactory implements stack.RawFactory.

+stateify savable

func (EndpointFactory) NewPacketEndpoint

func (EndpointFactory) NewPacketEndpoint(stack *stack.Stack, cooked bool, netProto tcpip.NetworkProtocolNumber, waiterQueue *waiter.Queue) (tcpip.Endpoint, tcpip.Error)

NewPacketEndpoint implements stack.RawFactory.NewPacketEndpoint.

func (EndpointFactory) NewUnassociatedEndpoint

func (EndpointFactory) NewUnassociatedEndpoint(stack *stack.Stack, netProto tcpip.NetworkProtocolNumber, transProto tcpip.TransportProtocolNumber, waiterQueue *waiter.Queue) (tcpip.Endpoint, tcpip.Error)

NewUnassociatedEndpoint implements stack.RawFactory.NewUnassociatedEndpoint.

Source Files

endpoint.go endpoint_state.go protocol.go

Version
v0.0.0-20250516225637-16bb0d3588bf (latest)
Published
May 16, 2025
Platform
linux/amd64
Imports
15 packages
Last checked
2 hours ago

Tools for package owners.