Documentation
¶
Index ¶
- Constants
- Variables
- func Abort(err error)
- func Append(list ...interface{}) (b []byte)
- func B32ToHex(b [32]byte) (h string)
- func B32ToString(b [32]byte) (s string)
- func BreakSlice(slc interface{}) <-chan interface{}
- func CompareHashAsSlice(a, b []byte) (cmp int)
- func CompareHex(aHex, bHex string) (cmp int)
- func CreateFile(fullPath string) (*os.File, error)
- func DefaultToExecutable(path string) string
- func DirExists(path string) (tf bool)
- func DirSize(path string) (int64, error)
- func FileExists(path string) bool
- func FileSize(path string) int64
- func FileSizeString(fullPath string) string
- func Hex2Uint64(hexString string) (ret uint64)
- func HexString2B20(hexString string) (ret [20]byte)
- func HexString2Slice(hexString string) (ret []byte)
- func InitLogging(filePath string)
- func IsFullPath(path string) bool
- func IsNodeReg(method string) (tf bool)
- func IsNodeRegOrUnreg(method string) (tf bool)
- func IsNodeUnreg(method string) (tf bool)
- func IsPendingTx(method string) (tf bool)
- func Join(dir, subpath string) string
- func Joins(folders ...string) (res string)
- func MakeFolders(folders []string) (err error)
- func NAgo(currentHex string, n uint64) (nAgoHex string, er error)
- func NAgoUint64(currentHex string, n uint64) (nAgo uint64, er error)
- func NewRandUint32() (r uint32)
- func RandomlySortSlice(slc interface{}) (r []interface{})
- func RemoveDir(path string) (er error)
- func SafeFileDelete(fullPath string) (er error)
- func SafeFileRead(fullPath string) (data []byte, er error)
- func SafeFileWrite(fullPath string, data []byte) (er error)
- func SafeReadDir(fullPath string) (ret []os.FileInfo, er error)
- func SameECDSAPrivateKey(k1, k2 *ecdsa.PrivateKey) (same bool)
- func SameEllipticCurve(c1, c2 elliptic.Curve) (same bool)
- func SameSlice(s1, s2 []byte) (same bool)
- func SetLoggingLevel(level LoggingLevel)
- func SetLoggingLevelFromName(level string)
- func Slice2B20(slc []byte) (b20 [20]byte)
- func Slice2B32(slc []byte) (b32 [32]byte)
- func Slice2BigInt(slc []byte) (b *big.Int)
- func Slice2Hex(sl []byte) (hex string)
- func Slice2Uint32(b []byte) (r uint32)
- func String2B32(str string) (b32 [32]byte)
- func Topic(methodSignature string) (hex string)
- func Uint64ToHex(u uint64) (ret string)
- func Uint64sToHexs(u []uint64) (ret []string)
- func UniqueStringSlice(list ...interface{}) (s []string)
- func UnlockFile(ptr *SafeFilename)
- type Alerts
- type BytesOrErr
- type BytesOrErrCH
- type Chan
- type ChanString
- type ChannelData
- type DoublyLinkedList
- type Elt
- type Flag
- type LoggingLevel
- type NYUP
- type NodeID
- type NodeOrChannel
- type OnOff
- type QuickSearch
- type RedeemSolutionInput
- type SafeFilename
- type Slice
- type Takee
- type TickOrStop
- type TxByHashResult
Constants ¶
View Source
const ( NewBlock_A = "NewBlock" NewChannel_A = "NewChannel" CloseChannel_A = "CloseChannel" NodeRegMethodsConsolidated_A = "NodeRegMethodsConsolidated" )
View Source
const ( Iter int = iota Len )
View Source
const NetworkTimeout = 3 * time.Second
Variables ¶
View Source
var ( LogDebug *log.Logger = log.New(os.Stderr, "Debug ", log.LstdFlags) LogTrace *log.Logger = log.New(os.Stderr, "Trace ", log.LstdFlags) LogInfo *log.Logger = log.New(os.Stderr, "Info ", log.LstdFlags) LogWarning *log.Logger = log.New(os.Stderr, "Warning ", log.LstdFlags) LogError *log.Logger = log.New(os.Stderr, "Error ", log.LstdFlags) )
View Source
var ( MethodSignatures = []string{ "LogNodeIDRegistered(bytes)", "LogNodeIDUnregistered(bytes)", "LogNodeIDUpdated(bytes)", "LogChannelOpened(bytes32)", "LogChannelClosed(bytes32)", "LogChannelSlashed(bytes32)", "LogParameterTuned()"} // methodSignatures LogNodeIDRegistered = MethodSignatures[0] LogNodeIDUnregistered = MethodSignatures[1] LogNodeIDUpdated = MethodSignatures[2] LogChannelOpened = MethodSignatures[3] LogChannelClosed = MethodSignatures[4] LogChannelSlashed = MethodSignatures[5] LogParameterTuned = MethodSignatures[6] // topics LogNodeIDRegisteredTopic = Topic(LogNodeIDRegistered) LogNodeIDUnregisteredTopic = Topic(LogNodeIDUnregistered) LogNodeIDUpdatedTopic = Topic(LogNodeIDUpdated) LogChannelOpenedTopic = Topic(LogChannelOpened) LogChannelClosedTopic = Topic(LogChannelClosed) LogChannelSlashedTopic = Topic(LogChannelSlashed) LogParameterTunedTopic = Topic(LogParameterTuned) )
View Source
var Filenames = struct { sync.RWMutex M map[string]*SafeFilename }{M: make(map[string]*SafeFilename)}
View Source
var NodeRegMethods = []string{"RegisterNodeID(bytes)", "UpdateNodeID(bytes)", LogNodeIDRegistered, LogNodeIDUpdated}
View Source
var NodeUnregMethods = []string{"UnregisterNodeID(bytes)", LogNodeIDUnregistered}
Functions ¶
func Abort ¶
func Abort(err error)
Abort does nothing if err is nil, otherwise logs the error and exits
func B32ToString ¶
func BreakSlice ¶
func BreakSlice(slc interface{}) <-chan interface{}
func CompareHashAsSlice ¶
func CompareHex ¶
func DefaultToExecutable ¶
Default to executable returns full path. If input path is relative, it will considered relative to the the folder of the executable
func FileExists ¶
func FileSizeString ¶
func Hex2Uint64 ¶
func HexString2B20 ¶
func HexString2Slice ¶
func InitLogging ¶
func InitLogging(filePath string)
InitLogging initializes a rotating logger. This should be done once by the executable filePath is the full path of the log file
func IsFullPath ¶
func IsNodeRegOrUnreg ¶
func IsNodeUnreg ¶
func IsPendingTx ¶
func MakeFolders ¶
func NewRandUint32 ¶
func NewRandUint32() (r uint32)
func RandomlySortSlice ¶
func RandomlySortSlice(slc interface{}) (r []interface{})
currently supports []peer.ID and []int
func SafeFileDelete ¶
func SafeFileRead ¶
func SafeFileWrite ¶
func SameECDSAPrivateKey ¶
func SameECDSAPrivateKey(k1, k2 *ecdsa.PrivateKey) (same bool)
func SameEllipticCurve ¶
func SetLoggingLevel ¶
func SetLoggingLevel(level LoggingLevel)
func SetLoggingLevelFromName ¶
func SetLoggingLevelFromName(level string)
func Slice2BigInt ¶
func Slice2Uint32 ¶
func String2B32 ¶
func Uint64ToHex ¶
func Uint64sToHexs ¶
func UniqueStringSlice ¶
func UniqueStringSlice(list ...interface{}) (s []string)
func UnlockFile ¶
func UnlockFile(ptr *SafeFilename)
Types ¶
type Alerts ¶
type Alerts struct { sync.RWMutex Name2Chan map[string]*ChanString }
func NewAlertsHub ¶
func NewAlertsHub() (a *Alerts)
func (*Alerts) NewSubscription ¶
type BytesOrErr ¶
type BytesOrErrCH ¶
type BytesOrErrCH struct { CH (chan *BytesOrErr) Cache []byte CachePtrs []int // 1 for iter, 2 for len }
func (*BytesOrErrCH) Init ¶
func (b *BytesOrErrCH) Init()
type ChanString ¶
func (*ChanString) Init ¶
func (c *ChanString) Init(CH chan string)
func (*ChanString) NewSubscription ¶
func (c *ChanString) NewSubscription() <-chan string
this is effectively creates a fanout on ChanString.CH
type ChannelData ¶
type ChannelData struct {
ChannelID string `json:"channel_id"`
}
type DoublyLinkedList ¶
type DoublyLinkedList struct {
// contains filtered or unexported fields
}
func (*DoublyLinkedList) AddElt ¶
func (dll *DoublyLinkedList) AddElt(number uint64)
func (*DoublyLinkedList) DelEltsLessThan ¶
func (dll *DoublyLinkedList) DelEltsLessThan(bound uint64)
func (*DoublyLinkedList) GetAll ¶
func (dll *DoublyLinkedList) GetAll() (ret []uint64)
func (*DoublyLinkedList) GetAllHex ¶
func (dll *DoublyLinkedList) GetAllHex() (ret []string)
func (*DoublyLinkedList) GetNumsLessThan ¶
func (dll *DoublyLinkedList) GetNumsLessThan(bound uint64) (ret []uint64)
type LoggingLevel ¶
type LoggingLevel int
const ( LogLevelUnknown LoggingLevel = iota LogLevelTrace LogLevelDebug LogLevelInfo LogLevelWarning LogLevelError )
func GetLoggingLevel ¶
func GetLoggingLevel() LoggingLevel
type QuickSearch ¶
simple yet common struct
func NewNodeRegMethods ¶
func NewNodeRegMethods() (q *QuickSearch)
func NewNodeUnregMethods ¶
func NewNodeUnregMethods() (q *QuickSearch)
func NewQuickSearch ¶
func NewQuickSearch() (q *QuickSearch)
type RedeemSolutionInput ¶
type RedeemSolutionInput struct { ChannelID [32]byte Soln [32]byte TOS TickOrStop }
encodings
func (*RedeemSolutionInput) ChannelData ¶
func (r *RedeemSolutionInput) ChannelData() (c *ChannelData)
structs conversions
type SafeFilename ¶
func LockFile ¶
func LockFile(fullPath string) (ptr *SafeFilename)
type Slice ¶
type Slice []byte
func (Slice) RedeemSolutionInput ¶
func (s Slice) RedeemSolutionInput() (r *RedeemSolutionInput)
type TickOrStop ¶
type TickOrStop byte
const ( Tick TickOrStop = iota Stop BothTOS )
func B1ToTickOrStop ¶
func B1ToTickOrStop(b [1]byte) (t TickOrStop)
func (*TickOrStop) String ¶
func (tos *TickOrStop) String() (s string)
type TxByHashResult ¶
type TxByHashResult struct { BlockHash string `json:blockHash` BlockNumber string `json:blockNumber` From string `json:from` Gas string `json:gas` GasPrice string `json:gasPrice` Hash string `json:hash` Input string `json:input` Nonce string `json:nonce` R string `json:r` S string `json:s` To string `json:to` TransactionIndex string `json:transactionIndex` V string `json:v` Value string `json:value` }
Click to show internal directories.
Click to hide internal directories.