util

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package util provides utilities to be used across packages

Logrus Logger

Utilities for "net"

Utilities for "slice"

Custom Ticker

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRandomUDPAddress

func GetRandomUDPAddress(min, max int) (addr *net.UDPAddr, err error)

Generates a UDP Address with localhost:random-port

func NewLogger

func NewLogger(level logrus.Level) (log *logrus.Logger)

Creates a new logrus instance with the provided level

func RemoveDuplicatesFromSlice

func RemoveDuplicatesFromSlice(s []string) []string

Deduplicate a slice of strings

Types

type Ticker

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

Ticker is a wrapper over the native time.Ticker implementation

func NewTicker

func NewTicker(d time.Duration, f TickerFunction) *Ticker

Creates a new ticker which runs every d time.Duration and executes the provided f TickerFunction

func (*Ticker) Start

func (t *Ticker) Start()

Start the ticker

func (*Ticker) Stop

func (t *Ticker) Stop()

Stop the ticker

type TickerFunction

type TickerFunction func()

Jump to

Keyboard shortcuts

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