mmsg

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MPL-2.0 Imports: 4 Imported by: 2

README

github.com/anacrolix/mmsg exposes the batching methods from golang.org/x/net/internal/socket, falling back on OSs that don't implement them.

golang.org/x/net does expose the batching APIs but you have to be explicit about whether you're using ipv4 or ipv6, and IDGAF, it shouldn't be exposed like that.

./socket is taken from golang.org/x/net/internal/socket because we need access to the package and it's internal to golang.org/x/net/internal/socket.
./internal/nettest is taken from golang.org/x/net/nettest. I think because ./socket expects it and we don't want to unnecessarily introduce extra dependencies to golang.org/x/net.

The LICENSE file is taken from golang.org/x/net and put into the respective directories sourced from that module.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

func NewConn

func NewConn(pr PacketReader) *Conn

pr must implement net.Conn for mmsg to be enabled.

func (*Conn) Err

func (me *Conn) Err() error

Returns not nil if message batching is not working.

func (*Conn) RecvMsg

func (me *Conn) RecvMsg(m *Message) error

func (*Conn) RecvMsgs

func (me *Conn) RecvMsgs(ms []Message) (n int, err error)

type Message

type Message struct {
	Buffers [][]byte
	N       int
	Addr    net.Addr
}

func (*Message) Payload

func (me *Message) Payload() (p []byte)

type PacketReader

type PacketReader interface {
	ReadFrom([]byte) (int, net.Addr, error)
}

Directories

Path Synopsis
internal
nettest
Package nettest provides utilities for network testing.
Package nettest provides utilities for network testing.
Package socket provides a portable interface for socket system calls.
Package socket provides a portable interface for socket system calls.

Jump to

Keyboard shortcuts

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