internal

package
v0.0.0-...-5a35483 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnToPacketConn

func ConnToPacketConn(conn net.Conn) net.PacketConn

ConnToPacketConn wraps around a dialed UDP connection. Its only purpose is to wrap around WriteTo and make it call Write instead, because WriteTo is invalid on a dialed connection.

Types

type DiscardHandler

type DiscardHandler struct{}

DiscardHandler implements a slog.Handler that is always disabled. Each of its methods return immediately without any code running.

func (DiscardHandler) Enabled

func (DiscardHandler) Handle

func (DiscardHandler) WithAttrs

func (d DiscardHandler) WithAttrs([]slog.Attr) slog.Handler

func (DiscardHandler) WithGroup

func (d DiscardHandler) WithGroup(string) slog.Handler

type ElasticChan

type ElasticChan[T any] struct {
	// contains filtered or unexported fields
}

ElasticChan is a channel that grows if its capacity is reached. ElasticChan is safe for concurrent use with multiple readers and 1 sender. Calling Send from multiple goroutines simultaneously is unsafe.

func Chan

func Chan[T any](size, max int) *ElasticChan[T]

Chan creates an ElasticChan of a size.

func (*ElasticChan[T]) Recv

func (c *ElasticChan[T]) Recv(cancel <-chan struct{}) (val T, ok bool)

Recv attempts to read a value from the channel. If cancel is closed, Recv will return ok = false.

func (*ElasticChan[T]) Send

func (c *ElasticChan[T]) Send(val T)

Send sends a value to the channel. Send never blocks, because if the maximum capacity of the underlying channel is reached, a larger one is created.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳