kcm

package module
v0.0.0-...-4bb647e Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 6 Imported by: 0

README

kcm Test Status Go Reference Go Report Card

Package kcm provides access to Linux Kernel Connection Multiplexor sockets (AF_KCM). MIT Licensed.

Documentation

Overview

Package kcm provides access to Linux Kernel Connection Multiplexor sockets (AF_KCM).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConn

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

A ClientConn is a client TCP connection which has been attached to a KCM Conn multiplexor. A ClientConn is created using the Conn.Attach method.

func (*ClientConn) Wait

func (cc *ClientConn) Wait() error

Wait waits for a client TCP connection to terminate, then unattaches it from the underlying Conn's multiplexor. Wait should be used to clean up resources from completed client connections.

type Config

type Config struct{}

Config contains options for a Conn.

type Conn

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

A Conn is a Linux Kernel Connection Multiplexor (AF_KCM) connection.

func Listen

func Listen(typ Type, cfg *Config) (*Conn, error)

Listen opens a Kernel Connection Multiplexor socket using the given socket type.

The socket type must be one of the Type constants: Datagram or SequencedPacket.

The Config specifies optional configuration for the Conn. A nil *Config applies the default configuration.

func (*Conn) Attach

func (c *Conn) Attach(sc syscall.Conn, bpfFD int) (*ClientConn, error)

Attach attaches a given client TCP connection to the multiplexor attached to Conn, using the input eBPF program file descriptor to frame incoming network protocol bytes into atomic messages.

The ClientConn produced by Attach takes ownership of the TCP connection; no further methods (including Close) should be called on that connection. See ClientConn.Wait to clean up a completed client connection.

func (*Conn) Clone

func (c *Conn) Clone() (*Conn, error)

Clone produces a cloned Conn which is attached to the same kernel multiplexor as the existing Conn. Connections will be distributed by the kernel to any Conn attached to the same multiplexor.

func (*Conn) Close

func (c *Conn) Close() error

Close implements io.Closer.

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

Read implements io.Reader.

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

SetDeadline sets a read and write deadline for Conn.

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

SetReadDeadline sets a read deadline for Conn.

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets a write deadline for Conn.

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

Write implements io.Writer.

type Type

type Type int

Type is a socket type used when creating a Conn with Listen.

const (
	Datagram Type
	SequencedPacket
)

Possible Type values. Note that the zero value is not valid: callers must always specify one of Datagram or SequencedPacket when calling Listen.

Jump to

Keyboard shortcuts

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