Documentation ¶
Overview ¶
Package raw provides the implementation of raw sockets (see raw(7)). Raw sockets allow applications to:
- manually write and inspect transport layer headers and payloads
- receive all traffic of a given transport protocol (e.g. ICMP or UDP)
- optionally write and inspect network layer headers of packets
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 ¶
- func NewEndpoint(stack *stack.Stack, netProto tcpip.NetworkProtocolNumber, ...) (tcpip.Endpoint, tcpip.Error)
- type CreateOnlyFactory
- func (CreateOnlyFactory) NewPacketEndpoint(*stack.Stack, bool, tcpip.NetworkProtocolNumber, *waiter.Queue) (tcpip.Endpoint, tcpip.Error)
- func (CreateOnlyFactory) NewUnassociatedEndpoint(stk *stack.Stack, _ tcpip.NetworkProtocolNumber, ...) (tcpip.Endpoint, tcpip.Error)
- func (c *CreateOnlyFactory) StateFields() []string
- func (c *CreateOnlyFactory) StateLoad(ctx context.Context, stateSourceObject state.Source)
- func (c *CreateOnlyFactory) StateSave(stateSinkObject state.Sink)
- func (c *CreateOnlyFactory) StateTypeName() string
- type EndpointFactory
- func (EndpointFactory) NewPacketEndpoint(stack *stack.Stack, cooked bool, netProto tcpip.NetworkProtocolNumber, ...) (tcpip.Endpoint, tcpip.Error)
- func (EndpointFactory) NewUnassociatedEndpoint(stack *stack.Stack, netProto tcpip.NetworkProtocolNumber, ...) (tcpip.Endpoint, tcpip.Error)
- func (e *EndpointFactory) StateFields() []string
- func (e *EndpointFactory) StateLoad(ctx context.Context, stateSourceObject state.Source)
- func (e *EndpointFactory) StateSave(stateSinkObject state.Sink)
- func (e *EndpointFactory) StateTypeName() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 ¶
func (CreateOnlyFactory) NewPacketEndpoint(*stack.Stack, bool, tcpip.NetworkProtocolNumber, *waiter.Queue) (tcpip.Endpoint, tcpip.Error)
NewPacketEndpoint implements stack.RawFactory.NewPacketEndpoint.
func (CreateOnlyFactory) NewUnassociatedEndpoint ¶
func (CreateOnlyFactory) NewUnassociatedEndpoint(stk *stack.Stack, _ tcpip.NetworkProtocolNumber, _ tcpip.TransportProtocolNumber, _ *waiter.Queue) (tcpip.Endpoint, tcpip.Error)
NewUnassociatedEndpoint implements stack.RawFactory.NewUnassociatedEndpoint.
func (*CreateOnlyFactory) StateFields ¶
func (c *CreateOnlyFactory) StateFields() []string
func (*CreateOnlyFactory) StateLoad ¶
func (c *CreateOnlyFactory) StateLoad(ctx context.Context, stateSourceObject state.Source)
+checklocksignore
func (*CreateOnlyFactory) StateSave ¶
func (c *CreateOnlyFactory) StateSave(stateSinkObject state.Sink)
+checklocksignore
func (*CreateOnlyFactory) StateTypeName ¶
func (c *CreateOnlyFactory) StateTypeName() string
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.
func (*EndpointFactory) StateFields ¶
func (e *EndpointFactory) StateFields() []string
func (*EndpointFactory) StateLoad ¶
func (e *EndpointFactory) StateLoad(ctx context.Context, stateSourceObject state.Source)
+checklocksignore
func (*EndpointFactory) StateSave ¶
func (e *EndpointFactory) StateSave(stateSinkObject state.Sink)
+checklocksignore
func (*EndpointFactory) StateTypeName ¶
func (e *EndpointFactory) StateTypeName() string