util

package
v0.0.0-...-a8acacb Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const OnceTimeout = 10 * time.Second

OnceTimeout is the general timeout used for network requests (the request inside a backoff once function).

Variables

View Source
var ErrAddressOverflow = errors.New("overflowed network")
View Source
var ErrEndBackoff = errors.New("internal: end backoff")

Functions

func AssignAddress

func AssignAddress(ipNet *net.IPNet, usedIPs []net.IPNet) (ip net.IP, err error)

func Backoff

func Backoff(once func() (resetBackoff bool, err error), singleError func(backoff time.Duration, err error) error) error

func Notify

func Notify(state string) (err error)

func ParseCIDR

func ParseCIDR(s string) (net.IPNet, error)

func SetupLog

func SetupLog()

func ShowCurrent

func ShowCurrent()

Types

type Base64Bytes

type Base64Bytes []byte

Base64Bytes is a byte slice with methods for (un)marshalling to YAML (using base64.StdEncoding).

func (*Base64Bytes) MarshalYAML

func (b *Base64Bytes) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*Base64Bytes) UnmarshalYAML

func (b *Base64Bytes) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

type HexBytes

type HexBytes []byte

HexBytes is a byte slice with methods for (un)marshalling to YAML (using hex).

func (*HexBytes) MarshalJSON

func (b *HexBytes) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*HexBytes) MarshalYAML

func (b *HexBytes) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*HexBytes) UnmarshalJSON

func (b *HexBytes) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*HexBytes) UnmarshalYAML

func (b *HexBytes) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

type Token

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

func ParseToken

func ParseToken(s string) (*Token, error)

func RandomToken

func RandomToken() (*Token, error)

func (*Token) Empty

func (t *Token) Empty() bool

func (*Token) GobDecode

func (t *Token) GobDecode(data []byte) error

GobDecode implements gob.GobDecoder.

func (*Token) GobEncode

func (t *Token) GobEncode() ([]byte, error)

GobEncode implements gob.GobDecoder.

func (*Token) Hash

func (t *Token) Hash() *TokenHash

func (*Token) MarshalJSON

func (t *Token) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Token) MarshalYAML

func (t *Token) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*Token) String

func (t *Token) String() string

func (*Token) UnmarshalJSON

func (t *Token) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Token) UnmarshalYAML

func (t *Token) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

type TokenHash

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

func ParseTokenHash

func ParseTokenHash(s string) (*TokenHash, error)

func (*TokenHash) GobDecode

func (h *TokenHash) GobDecode(data []byte) error

GobDecode implements gob.GobDecoder.

func (*TokenHash) GobEncode

func (h *TokenHash) GobEncode() ([]byte, error)

GobEncode implements gob.GobDecoder.

func (*TokenHash) MarshalJSON

func (h *TokenHash) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*TokenHash) MarshalYAML

func (h *TokenHash) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*TokenHash) String

func (h *TokenHash) String() string

func (*TokenHash) UnmarshalJSON

func (h *TokenHash) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*TokenHash) UnmarshalYAML

func (h *TokenHash) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

Jump to

Keyboard shortcuts

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