Documentation ¶
Overview ¶
Package common contains various helper functions.
Index ¶
- Constants
- func Bytes2Hex(d []byte) string
- func CopyBytes(b []byte) (copiedBytes []byte)
- func DefaultDataDir() string
- func DefaultHttpEndpoint() string
- func DefaultIpcFile() string
- func DefaultWSEndpoint() string
- func FromHex(s string) []byte
- func Go(fn func())
- func GoViteTestDataDir() string
- func Hex2Bytes(str string) []byte
- func Hex2BytesFixed(str string, flen int) []byte
- func HomeDir() string
- func LeftPadBytes(slice []byte, l int) []byte
- func MakeDefaultLogger(absFilePath string) *lumberjack.Logger
- func MockAddress(i int) types.Address
- func MockHash(i int) types.Hash
- func MockHashBy(i1 int, i int) types.Hash
- func RightPadBytes(slice []byte, l int) []byte
- func ToHex(b []byte) stringdeprecated
- type Lifecycle
- type LifecycleStatus
- func (self *LifecycleStatus) GetStatus() int32
- func (self *LifecycleStatus) PostInit() bool
- func (self *LifecycleStatus) PostStart() bool
- func (self *LifecycleStatus) PostStop() bool
- func (self *LifecycleStatus) PreInit() bool
- func (self *LifecycleStatus) PreStart() bool
- func (self *LifecycleStatus) PreStop() bool
- func (self *LifecycleStatus) Stopped() bool
- type NonBlockLock
Constants ¶
View Source
const ( DefaultHTTPHost = "localhost" // Default host interface for the HTTP RPC server DefaultHTTPPort = 48132 // Default TCP port for the HTTP RPC server DefaultWSHost = "localhost" // Default host interface for the websocket RPC server DefaultWSPort = 31420 // Default TCP port for the websocket RPC server DefaultP2PPort = 8483 )
Variables ¶
This section is empty.
Functions ¶
func DefaultHttpEndpoint ¶
func DefaultHttpEndpoint() string
func DefaultIpcFile ¶
func DefaultIpcFile() string
func DefaultWSEndpoint ¶
func DefaultWSEndpoint() string
func FromHex ¶
FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".
func Hex2BytesFixed ¶
Hex2BytesFixed returns bytes of a specified fixed length flen.
func LeftPadBytes ¶
LeftPadBytes zero-pads slice to the left up to length l.
func MakeDefaultLogger ¶
func MakeDefaultLogger(absFilePath string) *lumberjack.Logger
func MockAddress ¶
func RightPadBytes ¶
RightPadBytes zero-pads slice to the right up to length l.
Types ¶
type LifecycleStatus ¶
type LifecycleStatus struct {
Status int32 // 0:origin 1: initing 2:inited 3:starting 4:started 5:stopping 6:stopped
}
func (*LifecycleStatus) GetStatus ¶
func (self *LifecycleStatus) GetStatus() int32
func (*LifecycleStatus) PostInit ¶
func (self *LifecycleStatus) PostInit() bool
func (*LifecycleStatus) PostStart ¶
func (self *LifecycleStatus) PostStart() bool
func (*LifecycleStatus) PostStop ¶
func (self *LifecycleStatus) PostStop() bool
func (*LifecycleStatus) PreInit ¶
func (self *LifecycleStatus) PreInit() bool
func (*LifecycleStatus) PreStart ¶
func (self *LifecycleStatus) PreStart() bool
func (*LifecycleStatus) PreStop ¶
func (self *LifecycleStatus) PreStop() bool
func (*LifecycleStatus) Stopped ¶
func (self *LifecycleStatus) Stopped() bool
type NonBlockLock ¶
type NonBlockLock struct {
// contains filtered or unexported fields
}
func (*NonBlockLock) Lock ¶
func (self *NonBlockLock) Lock()
func (*NonBlockLock) TryLock ¶
func (self *NonBlockLock) TryLock() bool
func (*NonBlockLock) UnLock ¶
func (self *NonBlockLock) UnLock() bool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.