util

package
v0.0.0-...-bbc9ce3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAny

func IsAny(a tcpip.Address) bool

func Parse

func Parse(src string) tcpip.Address

Parse parses the string representation of an IPv4 or IPv6 address.

func PointSubnet

func PointSubnet(a tcpip.Address) tcpip.Subnet

PointSubnet creates a subnet which contains only the passed address.

Types

type CircularLogs

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

CircularLogs is a circular array of logs.

It must be created using the MakeCircularLogs function.

func MakeCircularLogs

func MakeCircularLogs(capacity int) CircularLogs

MakeCircularLogs initializes a CircularLogs struct with the given capacity.

This function will panic if it is called with a zero capacity.

func (*CircularLogs) BuildLogs

func (c *CircularLogs) BuildLogs() []LogEntry

BuildLogs copies the content of the circular array in a new slice.

The log entries are ordered from oldest to newest.

func (*CircularLogs) Push

func (c *CircularLogs) Push(content string)

Push records a new entry in the logs.

The timestamp of the entry is set to the current monotonic time.

If the capacity of the logs has been reached, the new entry will replace the oldest entry.

type LogEntry

type LogEntry struct {
	Timestamp zx.Time
	Content   string
}

Jump to

Keyboard shortcuts

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