Documentation ¶
Index ¶
- Constants
- Variables
- func AlphaNodes(servers []string) []*spb.Host
- func BytesU64(bs []byte, offset int) uint64
- func CommandSignData(group uint64, sender uint64, reqId uint64, data []byte) []byte
- func ExecCommandSignData(cmd *pb.CommandRequest) []byte
- func ExpectedPlayers(num int) int
- func GRPCServerListen(addr string) error
- func GenerateKey() ([]byte, []byte, error)
- func GetBytes(key interface{}) ([]byte, error)
- func GetClientConn(addr string) (*grpc.ClientConn, error)
- func GetClusterRPC(addr string) (spb.BFTRaftClient, error)
- func GetGRPCServer(addr string) *grpc.Server
- func HashData(data []byte) uint64
- func HashPublicKey(key *rsa.PublicKey) uint64
- func HashPublicKeyBytes(keyData []byte) uint64
- func LogHash(prevHash []byte, index uint64, funcId uint64, args []byte) ([]byte, crypto.Hash)
- func MajorityResponse(clients []*spb.BFTRaftClient, ...) interface{}
- func NodesSignData(nodes []*pb.Host) []byte
- func ParsePrivateKey(data []byte) (*rsa.PrivateKey, error)
- func ParsePublicKey(data []byte) (*rsa.PublicKey, error)
- func PickMajority(hashes []uint64) uint64
- func PublicKeyFromPrivate(key *rsa.PrivateKey) *rsa.PublicKey
- func SHA1Hash(data []byte) ([]byte, crypto.Hash)
- func Sign(privateKey *rsa.PrivateKey, data []byte) []byte
- func U32Bytes(t uint32) []byte
- func U64Bytes(n uint64) []byte
- func VerifySign(publicKey *rsa.PublicKey, signature []byte, data []byte) error
- type FuncResult
Constants ¶
View Source
const ( UINT32_LEN = 4 UINT64_LEN = 8 )
View Source
const ( MAX_TERM_BUMP = 20 ALPHA_GROUP = 1 // the group for recording server members, groups, peers etc )
Variables ¶
View Source
var ClientConn map[string]*grpc.ClientConn = map[string]*grpc.ClientConn{}
View Source
var ConnLock sync.Mutex = sync.Mutex{}
View Source
var RPCLock sync.Mutex = sync.Mutex{}
Functions ¶
func AlphaNodes ¶
func CommandSignData ¶
func ExecCommandSignData ¶
func ExecCommandSignData(cmd *pb.CommandRequest) []byte
func ExpectedPlayers ¶
func GRPCServerListen ¶
func GenerateKey ¶
func GetClientConn ¶
func GetClientConn(addr string) (*grpc.ClientConn, error)
func GetClusterRPC ¶
func GetClusterRPC(addr string) (spb.BFTRaftClient, error)
func GetGRPCServer ¶
func HashPublicKey ¶
func HashPublicKeyBytes ¶
func MajorityResponse ¶
func MajorityResponse(clients []*spb.BFTRaftClient, f func(client spb.BFTRaftClient) (interface{}, []byte)) interface{}
func NodesSignData ¶
func ParsePrivateKey ¶
func ParsePrivateKey(data []byte) (*rsa.PrivateKey, error)
func PickMajority ¶
func PublicKeyFromPrivate ¶
func PublicKeyFromPrivate(key *rsa.PrivateKey) *rsa.PublicKey
Types ¶
type FuncResult ¶
type FuncResult struct { Result interface{} Feature []byte }
Click to show internal directories.
Click to hide internal directories.