Documentation
¶
Index ¶
- Constants
- func CheckSignature(msg []byte, sign Sign520) (bool, error)
- func CheckStringSignature(msg []byte, strSign string) (bool, error)
- func Cpl(p1, p2 []byte) int
- func DecodeDefaultPrivateKey() (*ecdsa.PrivateKey, error)
- func DecodeDefaultPublicKey() (*ecdsa.PublicKey, error)
- func DecryptFromChunks(data [][]byte) ([]byte, error)
- func Distance(p1, p2 []byte) *big.Int
- func EncryptToParts(message []byte, size int) ([][]byte, error)
- func FromHex(s string, byteLen int) ([]byte, error)
- func ID256ToHex(s [32]byte) string
- func Normalize(source uint64, bitSizePrefix uint8) float64
- func OneCount(p1, p2 []byte) int
- func Random() int
- func XOR(a, b []byte) []byte
- func ZeroPrefixLen(id []byte) int
- type BaseMessage
- type Bitmap256
- type Block
- type BlockStatus
- type ECKey
- type ID256
- type ID64
- type KeySize
- type NetMessage
- type NetPartition
- type Peer
- type Permission
- type Precursor
- type PubKey
- type Replica
- type Sign520
- type State
- func (s State) Block() Block
- func (s State) CommonLevel(target ID64) byte
- func (s State) ID() ID64
- func (s State) IsLocalTime(time Time) bool
- func (s State) Key() *ECKey
- func (s State) NetPartition() NetPartition
- func (s State) Now() Time
- func (s State) Peer() Peer
- func (s State) TimeToHandlerID(time Time) ID64
- func (s State) Token() Token
- func (s State) ValidateTime(time Time) bool
- type Tick
- type TickGlobal
- type TickStatus
- type Time
- type Token
- type UpdateState
Constants ¶
View Source
const ( IDByteLength = 8 TickIDByteLen = 8 TickIncByteLen = 1 TickByteLen = 9 IndexShift = 1 )
View Source
const ( ErrDecodeByte32 = "decode of Byte32 failed" ErrDecodeByte8 = "decode of Byte8 failed" ErrDecodeByte = "decode of ByteArray failed" ErrDecodeTime = "decode of Time failed" ErrDecodeSign520 = "decode of Signature failed" ErrDecodePart = "decode of Partition failed" ErrDecodeToken = "decode of Token failed" ErrInvalidTime = "object Time is invalid" ErrSizeByte32 = "size of Byte32 is invalid" ErrSizeByte8 = "size of Byte8 is invalid" ErrSizeByte = "size of ByteArray is invalid" ErrSizeSign520 = "size of Sign520 is invalid" ErrGetToken = "failed to get Token from request header" ErrGetTime = "failed to get Time from request header" ErrGetID = "failed to get ID from request header" ErrGetSign = "failed to get Signature from request header" )
Variables ¶
This section is empty.
Functions ¶
func DecodeDefaultPrivateKey ¶
func DecodeDefaultPrivateKey() (*ecdsa.PrivateKey, error)
func DecodeDefaultPublicKey ¶
func DecryptFromChunks ¶
func ID256ToHex ¶
func ZeroPrefixLen ¶
Types ¶
type BaseMessage ¶
func UnmarshalBaseMessage ¶
func UnmarshalBaseMessage(data []byte) (bm BaseMessage, err error)
type BlockStatus ¶
type BlockStatus byte
const ( BlockStatusNew BlockStatus = iota BlockStatusHead BlockStatusTail BlockStatusOld )
func (BlockStatus) IsActive ¶
func (b BlockStatus) IsActive() bool
func (BlockStatus) String ¶
func (b BlockStatus) String() string
type ECKey ¶
type ECKey struct {
// contains filtered or unexported fields
}
func HexToECKey ¶
func (*ECKey) ECPrivateKey ¶
func (k *ECKey) ECPrivateKey() *ecdsa.PrivateKey
type ID256 ¶
type ID256 [32]byte
func GenerateID256FromSource ¶
func GenerateSHA ¶
func GenerateSHA() ID256
func ID256FromHex ¶
type NetMessage ¶
func (*NetMessage) Encode ¶
func (msg *NetMessage) Encode() []byte
type NetPartition ¶
type NetPartition struct {
Size byte
}
type Permission ¶
type Permission []byte
type State ¶
type State struct {
// contains filtered or unexported fields
}
State should be immutable and represent single time state todo
func CreateState ¶
func (State) CommonLevel ¶
func (State) IsLocalTime ¶
func (State) NetPartition ¶
func (s State) NetPartition() NetPartition
func (State) TimeToHandlerID ¶
func (State) ValidateTime ¶
type TickGlobal ¶
type TickStatus ¶
type TickStatus byte
const ( TickStatusNew TickStatus = iota TickStatusHead TickStatusTail TickStatusOld )
func (TickStatus) IsActive ¶
func (t TickStatus) IsActive() bool
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
func DecodeTime ¶
DecodeTime src[--- addr[8] ---,--- blockId[8] ---,--- (tickId[8],tickInc[1])[9] ---, ... ]
func (Time) Head ¶
func (t Time) Head() TickGlobal
func (Time) Ticks ¶
func (t Time) Ticks() []TickGlobal
type UpdateState ¶
type UpdateState interface {
UpdateState(state State)
}
Click to show internal directories.
Click to hide internal directories.