utils

package
v0.0.0-...-14a8109 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ReturnCh is chan for returns
	ReturnCh chan string
	// CancelFunc is represents cancel func
	CancelFunc context.CancelFunc
	// DaemonsCount is number of daemons
	DaemonsCount      int
	PrivateBlockchain = flag.Bool("privateBlockchain", false, "Is blockchain private")
)

Functions

func CallMethod

func CallMethod(i interface{}, methodName string) interface{}

CallMethod calls the function by its name

func Caller

func Caller(steps int) string

Caller returns the name of the latest function

func CheckSign

func CheckSign(publicKeys [][]byte, forSign string, signs []byte, nodeKeyOrLogin bool) (bool, error)

CheckSign checks the signature

func CopyFileContents

func CopyFileContents(src, dst string) error

CopyFileContents copy files

func ErrInfo

func ErrInfo(verr interface{}, additionally ...string) error

ErrInfo formats the error message

func ErrInfoFmt

func ErrInfoFmt(err string, a ...interface{}) error

ErrInfoFmt fomats the error message

func GetBlockBody

func GetBlockBody(host string, blockID int64, dataTypeBlockBody int64) ([]byte, error)

GetBlockBody gets the block data

func GetCurrentDir

func GetCurrentDir() string

GetCurrentDir returns the current directory

func GetHTTPTextAnswer

func GetHTTPTextAnswer(url string) (string, error)

GetHTTPTextAnswer returns HTTP answer as a string

func GetNodeKeys

func GetNodeKeys() (string, string, error)

GetNodeKeys returns node private key and public key

func GetParent

func GetParent() string

GetParent returns the information where the call of function happened

func MerkleTreeRoot

func MerkleTreeRoot(dataArray [][]byte) []byte

MerkleTreeRoot rertun Merkle value

func ShellExecute

func ShellExecute(cmdline string)

ShellExecute runs cmdline

func TCPConn

func TCPConn(Addr string) (net.Conn, error)

TCPConn connects to the address

func TypeInt

func TypeInt(txType string) int64

TypeInt returns the identifier of the embedded transaction

Types

type BlockData

type BlockData struct {
	BlockID      int64
	Time         int64
	EcosystemID  int64
	KeyID        int64
	NodePosition int64
	Sign         []byte
	Hash         []byte
	Version      int
}

BlockData is a structure of the block's header

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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