utils

package
v3.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2019 License: BSD-2-Clause Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidStatePath = errors.New("Invalid state file path")
	ErrNoState          = errors.New("No state available")
)

Functions

func GetQuitChannel added in v3.3.3

func GetQuitChannel() chan os.Signal

GetQuitChannel registers and returns a channel that will be notified upon receipt of the following signals: SIGHUP, SIGINT, SIGQUIT, SIGTERM

func OpenBufferedFileReader

func OpenBufferedFileReader(p string, buffer int) (r io.ReadCloser, err error)

func OpenFileReader

func OpenFileReader(p string) (r io.ReadCloser, err error)

func ParseInt

func ParseInt(v string) (r uint64, err error)

func ParseSource

func ParseSource(v string) (ret net.IP, err error)

ParseSource attempts to parse a string as a source override The priority logic is:

  1. IP address
  2. Numeric ID
  3. hexadecimal hash

func WaitForQuit added in v3.3.3

func WaitForQuit() os.Signal

WaitForQuit waits until it receives one of the following signals: SIGHUP, SIGINT, SIGQUIT, SIGTERM It returns the received signal.

Types

type State added in v3.3.1

type State struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewState added in v3.3.1

func NewState(pth string, perm os.FileMode) (s *State, err error)

func (*State) Read added in v3.3.1

func (s *State) Read(f interface{}) (err error)

func (*State) Write added in v3.3.1

func (s *State) Write(f interface{}) (err error)

Jump to

Keyboard shortcuts

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