utils

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// LetterBytes are the letters of an alphabet used to generate a random number
	LetterBytes = "abcdefghijklmnopqrstuvwxyz"
)

Variables

This section is empty.

Functions

func CalculateGarbageCollectDate

func CalculateGarbageCollectDate(holdTimeInMonths int) time.Time

CalculateGarbageCollectDate is used to calculate the date at which a file will be removed from our inventory. To prepare data for input use `strconv.Atoi(fmt.Sprintf("%v", .....")"`

func GenerateMultiAddrFromString

func GenerateMultiAddrFromString(addr string) (ma.Multiaddr, error)

GenerateMultiAddrFromString is used to take a string, and convert it to a multiformat based address

func ParseMultiAddrForIPFSPeer added in v1.0.6

func ParseMultiAddrForIPFSPeer(address ma.Multiaddr) (bool, error)

ParseMultiAddrForIPFSPeer is used to parse a multiaddress to determine whether its a valid ipfs address

func ParsePeerIDFromIPFSMultiAddr

func ParsePeerIDFromIPFSMultiAddr(address ma.Multiaddr) (string, error)

ParsePeerIDFromIPFSMultiAddr is used to parse a multiaddress and extract the IPFS peer id

Types

type RandomUtils

type RandomUtils struct {
	Seed       *rand.Rand
	SecureSeed *rand.Rand
}

RandomUtils is our helper struct for random related utilities

func GenerateRandomUtils

func GenerateRandomUtils() *RandomUtils

GenerateRandomUtils is used to generate our random utils struct

func (*RandomUtils) GenerateString

func (u *RandomUtils) GenerateString(length int, charset string) string

GenerateString is used to generate a fixed length random string from the specified charset, using a fresh seed each time

func (*RandomUtils) ReSeed

func (u *RandomUtils) ReSeed()

ReSeed is used to reseed our RNG

Jump to

Keyboard shortcuts

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