helpers

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPermEmptyList                = errors.New("cannot permute an empty list of mixes")
	ErrTooBigSampleSize             = errors.New("cannot take a sample larger than the given list")
	ErrExponentialDistributionParam = errors.New("the parameter of exponential distribution has to be larger than zero")
)
View Source
var (
	ErrInvalidLocalIP = errors.New("couldn't find a valid IP for your machine, check your internet connection")
)

Functions

func DirExists

func DirExists(path string) (bool, error)

DirExists checks whether a directory exists at the given path.

func EnsureDir

func EnsureDir(dir string, mode os.FileMode) error

EnsureDir checks whether a directory exists at the given path. If not, it will be created.

func FromPEMFile

func FromPEMFile(o encoding.BinaryUnmarshaler, f, pemType string) error

func GetLocalIP

func GetLocalIP() (string, error)

GetLocalIP attempts to figure out a valid IP address for this machine.

func IsZeroElement

func IsZeroElement(el sphinx.CryptoElement) bool

func RandomExponential

func RandomExponential(expParam float64) (float64, error)

func RandomMix

func RandomMix(mixes []config.MixConfig) config.MixConfig

RandomMix returns a single pseudorandomly chosen mix from given slices of mixes.

func RandomString

func RandomString(length int) string

a very dummy implementation of getting "random" string of given length could be improved in number of ways but for the test sake it's good enough

func RegisterMixNodePresence

func RegisterMixNodePresence(publicKey *sphinx.PublicKey, layer int, host ...string) error

RegisterMixNodePresence registers server presence at the directory server.

func RegisterMixProviderPresence

func RegisterMixProviderPresence(publicKey *sphinx.PublicKey, clients []models.RegisteredClient, host ...string) error

RegisterMixProviderPresence registers server presence at the directory server.

func ResolveTCPAddress

func ResolveTCPAddress(host, port string) (*net.TCPAddr, error)

ResolveTCPAddress returns an address of TCP end point given a host and port.

func SHA256

func SHA256(arg []byte) ([]byte, error)

SHA256 computes the hash value of a given argument using SHA256 algorithm.

func SendMixMetrics

func SendMixMetrics(metric models.MixMetric, host ...string) error

SendMixMetrics sends the mixnode related packet metrics to the directory server.

func ToPEMFile

func ToPEMFile(o encoding.BinaryMarshaler, f, pemType string) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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