Documentation ¶
Overview ¶
Copyright (c) 2024 RethinkDNS and its authors.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Index ¶
Constants ¶
const ( // Anew is the value returned by Barrier.Do when the function was // executed and its results are stored in the Barrier. Anew = iota // results are already stored in the Barrier. Shared )
const ( // BMAX is slab of size 64k; also the max BMAX = 64 * 1024 // B65536 is slab of size 64k B65536 = BMAX // B32768 is slab of size 32k B32768 = 32 * 1024 // B16384 is slab of size 16k B16384 = 16 * 1024 // B8192 is slab of size 8k B8192 = 8 * 1024 // B4096 is slab of size 4k B4096 = 4 * 1024 // B2048 is slab of size 2k; also the min B2048 = 2 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func AllocRegion ¶
AllocRegion returns a truncated byte slice at least size big
func NewConnMap ¶
func NewConnMap() *cm
Types ¶
type Barrier ¶
type Barrier[T any] struct { // contains filtered or unexported fields }
Barrier represents a class of work and forms a namespace in which units of work can be executed with duplicate suppression.
func NewBarrier ¶
NewBarrier returns a new Barrier with the given time-to-live for completed Vs.
type ConnMapper ¶
type ExpMap ¶
ExpMap holds expiring keys and read hits.
type Hangover ¶
type Hangover struct {
// contains filtered or unexported fields
}
func NewHangover ¶
func NewHangover() *Hangover
type P2QuantileEstimator ¶
type P2QuantileEstimator interface { // Add a sample to the estimator. Add(float64) // Get the estimation for p. Get() int64 // Get the percentile, p. P() float64 }
P2QuantileEstimator is an interface for the P2 quantile estimator.
func NewP2QuantileEstimator ¶
func NewP2QuantileEstimator(samples int, probability float64) P2QuantileEstimator
NewP90Estimator returns a new estimator with percentile p.
func NewP50Estimator ¶
func NewP50Estimator() P2QuantileEstimator
NewP50Estimator returns a new P50 (median) estimator.
type PcapHeader ¶
type PcapHeader struct { MagicNumber uint32 VersionMajor uint16 VersionMinor uint16 Thiszone int32 Sigfigs uint32 Snaplen uint32 Network uint32 }
from: github.com/google/gvisor/blob/596e8d22/pkg/tcpip/link/sniffer/pcap.go#L26
type TCPConn ¶
type TCPConn interface { // RemoteAddr returns the destination network address. RemoteAddr() net.Addr // LocalAddr returns the local client network address. LocalAddr() net.Addr // confirms to protect.Conn Write(data []byte) (int, error) Read(data []byte) (int, error) Close() error // CloseWrite closes the writing side by sending a FIN // segment to local peer. That means we can write no further // data to TUN. CloseWrite() error // CloseRead closes the reading side. That means we can no longer // read more from TUN. CloseRead() error SetDeadline(t time.Time) error SetReadDeadline(t time.Time) error SetWriteDeadline(t time.Time) error }
TCPConn abstracts a TCP connection comming from TUN. This connection should be handled by a registered TCP proxy handler.
type UDPConn ¶
type UDPConn interface { // LocalAddr returns the local client network address. LocalAddr() net.Addr RemoteAddr() net.Addr // confirms to protect.Conn Write(data []byte) (int, error) Read(data []byte) (int, error) // confirms to net.PacketConn WriteTo(data []byte, addr net.Addr) (int, error) ReadFrom(data []byte) (int, net.Addr, error) // Close closes the connection. Close() error // Implements net.Conn SetDeadline(t time.Time) error SetReadDeadline(t time.Time) error SetWriteDeadline(t time.Time) error }
UDPConn abstracts a UDP connection comming from TUN. This connection should be handled by a registered UDP proxy handler.
type Volatile ¶
func NewVolatile ¶
NewVolatile returns a new Volatile with the value t. Panics if t is nil.
func (*Volatile[T]) Cas ¶
Cas compares and swaps the value of a with new, returns true if the value was swapped. Panics if new is nil.
func (*Volatile[T]) Load ¶
func (a *Volatile[T]) Load() (t T)
Load returns the value of a. May return nil.