Versions in this module Expand all Collapse all v0 v0.1.3 Dec 27, 2019 v0.1.2 Oct 29, 2019 v0.1.1 Sep 25, 2019 v0.1.0 Sep 4, 2019 Changes in this version + const ANSIBgBlack + const ANSIBgBlue + const ANSIBgCyan + const ANSIBgGreen + const ANSIBgMagenta + const ANSIBgRed + const ANSIBgWhite + const ANSIBgYellow + const ANSIBlink + const ANSIBright + const ANSIDim + const ANSIFgBlack + const ANSIFgBlue + const ANSIFgCyan + const ANSIFgGreen + const ANSIFgMagenta + const ANSIFgRed + const ANSIFgWhite + const ANSIFgYellow + const ANSIHidden + const ANSIReset + const ANSIReverse + const ANSIUnderscore + const AddressLength + const HashLength + var Big0 = big.NewInt(0) + var Big1 = big.NewInt(1) + var Big2 = big.NewInt(2) + var Big256 = big.NewInt(256) + var Big257 = big.NewInt(257) + var Big3 = big.NewInt(3) + var Big32 = big.NewInt(32) + var EmptyAddress = Address + var EmptyHash = Hash + var ErrAlreadyStarted = errors.New("already started") + var ErrAlreadyStopped = errors.New("already stopped") + var Fmt = func(format string, a ...interface{}) string + var One256 = Word256 + var TimeLayout = "2006-01-02" + var Zero256 = Word256 + func ASCIITrim(s string) string + func AbsolutePath(datadir string, filename string) string + func Black(args ...interface{}) string + func Blue(args ...interface{}) string + func Bytes2Hex(d []byte) string + func Bytes2Uint(src []byte) (uint64, error) + func ColoredBytes(data []byte, textColor, bytesColor func(...interface{}) string) string + func Connect(protoAddr string) (net.Conn, error) + func CopyBytes(b []byte) (copiedBytes []byte) + func Cyan(args ...interface{}) string + func EnsureDir(dir string, mode os.FileMode) error + func Exit(s string) + func ExpUint64(a, b uint64) uint64 + func FileExists(filePath string) bool + func Fingerprint(slice []byte) []byte + func FromHex(s string) []byte + func GetInt64BE(src []byte) int64 + func GetInt64LE(src []byte) int64 + func GetUint64BE(src []byte) uint64 + func GetUint64LE(src []byte) uint64 + func GoPath() string + func Green(args ...interface{}) string + func HasHexPrefix(str string) bool + func Hex2Bytes(str string) []byte + func Hex2BytesFixed(str string, flen int) []byte + func Int64FromWord256(word Word256) int64 + func IntInSlice(a int, list []int) bool + func Is0xHex(s string) bool + func IsASCIIText(s string) bool + func IsDirEmpty(name string) (bool, error) + func IsEmpty(o interface{}) bool + func IsHex(str string) bool + func IsHexAddress(s string) bool + func IsLKC(addr Address) bool + func IsTypedNil(o interface{}) bool + func IsZeros(slice []byte) bool + func Kill() error + func LeftPadBytes(slice []byte, l int) []byte + func LoadJSON(file string, val interface{}) error + func Magenta(args ...interface{}) string + func MaxInt(a, b int) int + func MaxInt16(a, b int16) int16 + func MaxInt32(a, b int32) int32 + func MaxInt64(a, b int64) int64 + func MaxInt8(a, b int8) int8 + func MaxUint(a, b uint) uint + func MaxUint16(a, b uint16) uint16 + func MaxUint32(a, b uint32) uint32 + func MaxUint64(a, b uint64) uint64 + func MaxUint8(a, b uint8) uint8 + func MinInt(a, b int) int + func MinInt16(a, b int16) int16 + func MinInt32(a, b int32) int32 + func MinInt64(a, b int64) int64 + func MinInt8(a, b int8) int8 + func MinUint(a, b uint) uint + func MinUint16(a, b uint16) uint16 + func MinUint32(a, b uint32) uint32 + func MinUint64(a, b uint64) uint64 + func MinUint8(a, b uint8) uint8 + func MustReadFile(filePath string) []byte + func MustWriteFile(filePath string, contents []byte, mode os.FileMode) + func PanicConsensus(v interface{}) + func PanicCrisis(v interface{}) + func PanicQ(v interface{}) + func PanicSanity(v interface{}) + func ParseDateRange(dateRange string) (startDate, endDate time.Time, err error) + func PrefixEndBytes(prefix []byte) []byte + func Prompt(prompt string, defaultValue string) (string, error) + func ProtocolAndAddress(listenAddr string) (string, string) + func PutInt64BE(dest []byte, i int64) + func PutInt64LE(dest []byte, i int64) + func PutUint64BE(dest []byte, i uint64) + func PutUint64LE(dest []byte, i uint64) + func RandBytes(n int) []byte + func RandFloat32() float32 + func RandFloat64() float64 + func RandInt() int + func RandInt16() int16 + func RandInt31() int32 + func RandInt31n(n int32) int32 + func RandInt32() int32 + func RandInt63() int64 + func RandInt63n(n int64) int64 + func RandInt64() int64 + func RandIntn(n int) int + func RandPerm(n int) []int + func RandStr(length int) string + func RandTime() time.Time + func RandUint() uint + func RandUint16() uint16 + func RandUint32() uint32 + func RandUint64() uint64 + func ReadFile(filePath string) ([]byte, error) + func Red(args ...interface{}) string + func RightPadBytes(slice []byte, l int) []byte + func SearchUint64s(a []uint64, x uint64) int + func Seed(seed int64) + func SplitAndTrim(s, sep, cutset string) []string + func StringInSlice(a string, list []string) bool + func StripHex(s string) string + func Tempdir(prefix string) (*os.File, string) + func Tempfile(prefix string) (*os.File, string) + func ToHex(b []byte) string + func TrapSignal(cb func()) + func TrimmedString(b []byte) string + func Tuple256Split(t Tuple256) (Word256, Word256) + func Uint64FromWord256(word Word256) uint64 + func White(args ...interface{}) string + func WriteFile(filePath string, contents []byte, mode os.FileMode) error + func WriteFileAtomic(filename string, data []byte, perm os.FileMode) error + func Yellow(args ...interface{}) string + type Address [AddressLength]byte + func BigToAddress(b *big.Int) Address + func BytesToAddress(b []byte) Address + func HexToAddress(s string) Address + func (a *Address) SetBytes(b []byte) + func (a *Address) UnmarshalJSON(input []byte) error + func (a *Address) UnmarshalText(input []byte) error + func (a Address) Big() *big.Int + func (a Address) Bytes() []byte + func (a Address) Format(s fmt.State, c rune) + func (a Address) Hash() Hash + func (a Address) Hex() string + func (a Address) MarshalJSON() ([]byte, error) + func (a Address) MarshalText() ([]byte, error) + func (a Address) String() string + type BaseService struct + Logger log.Logger + func NewBaseService(logger log.Logger, name string, impl Service) *BaseService + func (bs *BaseService) IsRunning() bool + func (bs *BaseService) OnReset() error + func (bs *BaseService) OnStart() error + func (bs *BaseService) OnStop() + func (bs *BaseService) Quit() <-chan struct{} + func (bs *BaseService) Reset() error + func (bs *BaseService) SetLogger(l log.Logger) + func (bs *BaseService) Start() error + func (bs *BaseService) Stop() error + func (bs *BaseService) String() string + func (bs *BaseService) Wait() + type BitArray struct + Bits int + Elems []uint64 + func NewBitArray(bits int) *BitArray + func (bA *BitArray) And(o *BitArray) *BitArray + func (bA *BitArray) Bytes() []byte + func (bA *BitArray) Copy() *BitArray + func (bA *BitArray) GetIndex(i int) bool + func (bA *BitArray) IsEmpty() bool + func (bA *BitArray) IsFull() bool + func (bA *BitArray) MarshalJSON() ([]byte, error) + func (bA *BitArray) Not() *BitArray + func (bA *BitArray) Or(o *BitArray) *BitArray + func (bA *BitArray) PickRandom() (int, bool) + func (bA *BitArray) SetIndex(i int, v bool) bool + func (bA *BitArray) Size() int + func (bA *BitArray) String() string + func (bA *BitArray) StringIndented(indent string) string + func (bA *BitArray) Sub(o *BitArray) *BitArray + func (bA *BitArray) UnmarshalJSON(bz []byte) error + func (bA *BitArray) Update(o *BitArray) + type BufferCloser struct + Closed bool + func NewBufferCloser(buf []byte) *BufferCloser + func (bc *BufferCloser) Close() error + func (bc *BufferCloser) Write(p []byte) (n int, err error) + func (bc *BufferCloser) WriteByte(c byte) error + func (bc *BufferCloser) WriteRune(r rune) (n int, err error) + func (bc *BufferCloser) WriteString(s string) (n int, err error) + type CMap struct + func NewCMap() *CMap + func (cm *CMap) Clear() + func (cm *CMap) Delete(key string) + func (cm *CMap) Get(key string) interface{} + func (cm *CMap) Has(key string) bool + func (cm *CMap) Keys() []string + func (cm *CMap) Set(key string, value interface{}) + func (cm *CMap) Size() int + func (cm *CMap) Values() []interface{} + type Comparable interface + Less func(o interface{}) bool + type Error interface + Data func() interface{} + Error func() string + Stacktrace func() Error + Trace func(offset int, format string, args ...interface{}) Error + func ErrorWrap(cause interface{}, format string, args ...interface{}) Error + func NewError(format string, args ...interface{}) Error + func NewErrorWithData(data interface{}) Error + type FmtError struct + func (fe FmtError) Error() string + func (fe FmtError) Format() string + func (fe FmtError) String() string + type Hash [HashLength]byte + func BigToHash(b *big.Int) Hash + func BytesToHash(b []byte) Hash + func HexToHash(s string) Hash + func (h *Hash) SetBytes(b []byte) + func (h *Hash) UnmarshalJSON(input []byte) error + func (h *Hash) UnmarshalText(input []byte) error + func (h Hash) Big() *big.Int + func (h Hash) Bytes() []byte + func (h Hash) Format(s fmt.State, c rune) + func (h Hash) Generate(rand *rand.Rand, size int) reflect.Value + func (h Hash) Hex() string + func (h Hash) MarshalJSON() ([]byte, error) + func (h Hash) MarshalText() ([]byte, error) + func (h Hash) String() string + func (h Hash) TerminalString() string + type Heap struct + func NewHeap() *Heap + func (h *Heap) Len() int64 + func (h *Heap) Peek() interface{} + func (h *Heap) Pop() interface{} + func (h *Heap) Push(value interface{}, priority int) + func (h *Heap) PushBytes(value interface{}, priority []byte) + func (h *Heap) PushComparable(value interface{}, priority Comparable) + func (h *Heap) Update(value interface{}, priority Comparable) + type HexBytes []byte + func (bz *HexBytes) Unmarshal(data []byte) error + func (bz *HexBytes) UnmarshalJSON(data []byte) error + func (bz HexBytes) Bytes() []byte + func (bz HexBytes) Format(s fmt.State, verb rune) + func (bz HexBytes) Marshal() ([]byte, error) + func (bz HexBytes) MarshalJSON() ([]byte, error) + func (bz HexBytes) String() string + type KI64Pair struct + Key []byte + Value int64 + func (*KI64Pair) Descriptor() ([]byte, []int) + func (*KI64Pair) ProtoMessage() + func (m *KI64Pair) GetKey() []byte + func (m *KI64Pair) GetValue() int64 + func (m *KI64Pair) Reset() + func (m *KI64Pair) String() string + type KI64Pairs []KI64Pair + func (kvs KI64Pairs) Len() int + func (kvs KI64Pairs) Less(i, j int) bool + func (kvs KI64Pairs) Sort() + func (kvs KI64Pairs) Swap(i, j int) + type KVPair struct + Key []byte + Value []byte + func (*KVPair) Descriptor() ([]byte, []int) + func (*KVPair) ProtoMessage() + func (m *KVPair) GetKey() []byte + func (m *KVPair) GetValue() []byte + func (m *KVPair) Reset() + func (m *KVPair) String() string + type KVPairs []KVPair + func (kvs KVPairs) Len() int + func (kvs KVPairs) Less(i, j int) bool + func (kvs KVPairs) Sort() + func (kvs KVPairs) Swap(i, j int) + type MixedcaseAddress struct + func NewMixedcaseAddress(addr Address) MixedcaseAddress + func NewMixedcaseAddressFromString(hexaddr string) (*MixedcaseAddress, error) + func (ma *MixedcaseAddress) Address() Address + func (ma *MixedcaseAddress) MarshalJSON() ([]byte, error) + func (ma *MixedcaseAddress) Original() string + func (ma *MixedcaseAddress) String() string + func (ma *MixedcaseAddress) UnmarshalJSON(input []byte) error + func (ma *MixedcaseAddress) ValidChecksum() bool + type PrefixedReader struct + Prefix []byte + func NewPrefixedReader(prefix []byte, reader io.Reader) *PrefixedReader + func (pr *PrefixedReader) Read(p []byte) (n int, err error) + type Rand struct + func NewRand() *Rand + func (r *Rand) Bytes(n int) []byte + func (r *Rand) Float32() float32 + func (r *Rand) Float64() float64 + func (r *Rand) Int() int + func (r *Rand) Int16() int16 + func (r *Rand) Int31() int32 + func (r *Rand) Int31n(n int32) int32 + func (r *Rand) Int32() int32 + func (r *Rand) Int63() int64 + func (r *Rand) Int63n(n int64) int64 + func (r *Rand) Int64() int64 + func (r *Rand) Intn(n int) int + func (r *Rand) Perm(n int) []int + func (r *Rand) Seed(seed int64) + func (r *Rand) Str(length int) string + func (r *Rand) Time() time.Time + func (r *Rand) Uint() uint + func (r *Rand) Uint16() uint16 + func (r *Rand) Uint32() uint32 + func (r *Rand) Uint64() uint64 + type RepeatTimer struct + func NewRepeatTimer(name string, dur time.Duration) *RepeatTimer + func NewRepeatTimerWithTickerMaker(name string, dur time.Duration, tm TickerMaker) *RepeatTimer + func (t *RepeatTimer) Chan() <-chan time.Time + func (t *RepeatTimer) Reset() + func (t *RepeatTimer) Stop() + type Service interface + IsRunning func() bool + OnReset func() error + OnStart func() error + OnStop func() + Quit func() <-chan struct{} + Reset func() error + SetLogger func(log.Logger) + Start func() error + Stop func() error + String func() string + type StorageSize float64 + func (s StorageSize) String() string + func (s StorageSize) TerminalString() string + type Task func(i int) (val interface{}, err error, abort bool) + type TaskResult struct + Error error + Value interface{} + type TaskResultCh <-chan TaskResult + type TaskResultSet struct + func Parallel(tasks ...Task) (trs *TaskResultSet, ok bool) + func (trs *TaskResultSet) Channels() []TaskResultCh + func (trs *TaskResultSet) FirstError() error + func (trs *TaskResultSet) FirstValue() interface{} + func (trs *TaskResultSet) LatestResult(index int) (TaskResult, bool) + func (trs *TaskResultSet) Reap() *TaskResultSet + func (trs *TaskResultSet) Wait() *TaskResultSet + type ThrottleTimer struct + Ch chan struct{} + Name string + func NewThrottleTimer(name string, dur time.Duration) *ThrottleTimer + func (t *ThrottleTimer) Set() + func (t *ThrottleTimer) Stop() bool + func (t *ThrottleTimer) Unset() + type Ticker interface + Chan func() <-chan time.Time + Stop func() + type TickerMaker func(dur time.Duration) Ticker + func NewLogicalTickerMaker(source chan time.Time) TickerMaker + type Tuple256 struct + First Word256 + Second Word256 + func (tuple Tuple256) Compare(other Tuple256) int + type Tuple256Slice []Tuple256 + func (p Tuple256Slice) Len() int + func (p Tuple256Slice) Less(i, j int) bool + func (p Tuple256Slice) Sort() + func (p Tuple256Slice) Swap(i, j int) + type Uint64Slice []uint64 + func (p Uint64Slice) Len() int + func (p Uint64Slice) Less(i, j int) bool + func (p Uint64Slice) Search(x uint64) int + func (p Uint64Slice) Sort() + func (p Uint64Slice) Swap(i, j int) + type UnprefixedAddress Address + func (a *UnprefixedAddress) UnmarshalText(input []byte) error + func (a UnprefixedAddress) MarshalText() ([]byte, error) + type UnprefixedHash Hash + func (h *UnprefixedHash) UnmarshalText(input []byte) error + func (h UnprefixedHash) MarshalText() ([]byte, error) + type Word256 [32]byte + func Int64ToWord256(i int64) Word256 + func LeftPadWord256(bz []byte) (word Word256) + func RightPadWord256(bz []byte) (word Word256) + func Uint64ToWord256(i uint64) Word256 + func (w Word256) Bytes() []byte + func (w Word256) Compare(other Word256) int + func (w Word256) Copy() Word256 + func (w Word256) IsZero() bool + func (w Word256) Postfix(n int) []byte + func (w Word256) Prefix(n int) []byte + func (w Word256) String() string + func (w Word256) TrimmedString() string