utilities

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: Unlicense Imports: 9 Imported by: 0

Documentation

Overview

Simple crypto utilities.

Simple file utilities.

Some helper functions used in various parts of the system.

Simple networking utilities. IsPrivateIP nabbed from https://stackoverflow.com/questions/41240761/go-check-if-ip-address-is-in-private-network-space, thanks Doug Nukem and Brad Peabody.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteArrayComparator

func ByteArrayComparator(a, b []byte) bool

Compares two byte arrays for sorting purposes. Return: true if a should come first in ascending order, false otherwise.

func ByteArrayContains

func ByteArrayContains(array [][]byte, lookFor []byte) bool

Returns true if the given array of byte arrays contains lookFor

func ByteArrayCopy

func ByteArrayCopy(source []byte, length int) []byte

Make a clean copy of the <source> byte array with the given length to reduce memory footprint.

func CopyFile

func CopyFile(src, dst string) error

Copy the src file to dst. Any existing file will be overwritten.

func DoubleSha256

func DoubleSha256(input []byte) [32]byte

func DownloadFile

func DownloadFile(source, destination string) error

Download a file via http(s) and store it locally.

func FileDoesNotExists

func FileDoesNotExists(file string) bool

FileDoesNotExists returns 'true' if we can safely assume that the given file does not exist.

func IsPrivateIP

func IsPrivateIP(ip net.IP) bool

func StringToFile

func StringToFile(s string, file string) error

Helper to create a file and write the given text to it. If the file exists, it will be overwritten.

Types

This section is empty.

Jump to

Keyboard shortcuts

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