Documentation ¶
Index ¶
- Constants
- func AllowSpecificRoute(allowedPath string) gin.HandlerFunc
- func AttestationIdle(cli *chain.ChainClient, peernode *core.PeerNode, p *Pois, r *RunningState, ...)
- func CalcTag(cli *chain.ChainClient, cace cache.Cache, l logger.Logger, r *RunningState, ...)
- func ChallengeMgt(cli *chain.ChainClient, l logger.Logger, ws *Workspace, r *RunningState, ...)
- func GenIdle(l *logger.Lg, prover *pois.Prover, r *RunningState, workspace string, ...)
- func ProcessTeeEndpoint(endPoint string) string
- func ReplaceIdle(cli *chain.ChainClient, l logger.Logger, p *Pois, m *pb.MinerPoisInfo, ...)
- func ReportFiles(ch chan<- bool, cli *chain.ChainClient, r *RunningState, l *logger.Lg, ...)
- func RestoreFiles(cli *chain.ChainClient, cace cache.Cache, l logger.Logger, fileDir string, ...)
- func RestoreLocalFiles(cli *chain.ChainClient, l logger.Logger, cace cache.Cache, fileDir string) error
- func RestoreOtherFiles(cli *chain.ChainClient, l logger.Logger, fileDir string) error
- func SplitByN(filePath string, N int64) (Data [][]byte, sep int64, err error)
- func Subscribe(ctx context.Context, h host.Host, minerRecord MinerRecord, bootnode string)
- func SyncTeeInfo(cli *chain.ChainClient, l *logger.Lg, peernode *core.PeerNode, ...)
- func WatchMem()
- type DataDir
- type GenProofResponse
- type GetStatus
- type HashSelf
- type MinerRecord
- type Node
- type PeerRecordType
- func (p *PeerRecordType) BackupPeer(path string) error
- func (p *PeerRecordType) GetAllMinerAcc() []string
- func (p *PeerRecordType) GetAllPeerId() []string
- func (p *PeerRecordType) GetPeer(peerid string) (peer.AddrInfo, error)
- func (p *PeerRecordType) HasPeer(peerid string) bool
- func (p *PeerRecordType) LoadPeer(path string) error
- func (p *PeerRecordType) SaveMinerAcc(acc string, peerid string)
- func (p *PeerRecordType) SavePeer(addr peer.AddrInfo) error
- type Pois
- type QElement
- type RSAKeyPair
- func (keyPair RSAKeyPair) AggrAppendProof(AggrSigma string, aSigma string) (string, bool)
- func (keyPair RSAKeyPair) AggrGenProof(QSlice []QElement, Tag []Tag) string
- func (keyPair RSAKeyPair) GenProof(QSlice []QElement, h HashSelf, Phi []string, Matrix [][]byte) <-chan GenProofResponse
- func (r *RSAKeyPair) VerifyAttest(name, u, phiHash, attest, customData string) (bool, error)
- type RandomList
- type RunningState
- func (s *RunningState) GetAuthIdleFlag() bool
- func (s *RunningState) GetCalcTagFlag() bool
- func (s *RunningState) GetChainStatus() bool
- func (s *RunningState) GetCpuCores() int
- func (s *RunningState) GetCurrentRpc() string
- func (s *RunningState) GetGenIdleFlag() bool
- func (s *RunningState) GetIdleChallengeFlag() bool
- func (s *RunningState) GetLastReconnectRpcTime() string
- func (s *RunningState) GetMinerSignatureAcc() string
- func (m *RunningState) GetMinerSpaceInfo() (uint64, uint64, uint64, uint64)
- func (s *RunningState) GetMinerState() string
- func (s *RunningState) GetPID() int
- func (s *RunningState) GetReceiveFlag() bool
- func (s *RunningState) GetReportFileFlag() bool
- func (s *RunningState) GetServiceChallengeFlag() bool
- func (s *RunningState) ListenLocal()
- func (s *RunningState) SetAuthIdleFlag(flag bool)
- func (s *RunningState) SetCalcTagFlag(flag bool)
- func (s *RunningState) SetChainStatus(status bool)
- func (s *RunningState) SetCpuCores(num int)
- func (s *RunningState) SetCurrentRpc(rpc string)
- func (s *RunningState) SetGenIdleFlag(flag bool)
- func (s *RunningState) SetIdleChallengeFlag(flag bool)
- func (s *RunningState) SetLastReconnectRpcTime(t string)
- func (m *RunningState) SetMinerSignAcc(acc string)
- func (m *RunningState) SetMinerSpaceInfo(decSpace, validSpace, usedSpace, lockedSpace uint64)
- func (m *RunningState) SetMinerState(state string) error
- func (s *RunningState) SetPID(pid int)
- func (s *RunningState) SetReceiveFlag(flag bool)
- func (s *RunningState) SetReportFileFlag(flag bool)
- func (s *RunningState) SetServiceChallengeFlag(flag bool)
- type RunningStater
- type SetStatus
- type StatueMsg
- type T
- type Tag
- type TagfileType
- type TeeInfo
- type TeeRecord
- func (t *TeeRecord) DeleteTee(workAccount string)
- func (t *TeeRecord) GetAllMarkerTeeEndpoint() []string
- func (t *TeeRecord) GetAllTeeEndpoint() []string
- func (t *TeeRecord) GetAllVerifierTeeEndpoint() []string
- func (t *TeeRecord) GetTee(workAccount string) (TeeInfo, error)
- func (t *TeeRecord) GetTeeWorkAccount(endpoint string) (string, error)
- func (t *TeeRecord) SaveTee(workAccount, endPoint string, teeType uint8) error
- type TeeRecorder
- type Workspace
- func (w *Workspace) Build(rootDir string) error
- func (w *Workspace) Check() error
- func (w *Workspace) GetChallRandomDir() string
- func (w *Workspace) GetChallRndomDir() string
- func (w *Workspace) GetDbDir() string
- func (w *Workspace) GetFileDir() string
- func (w *Workspace) GetIdleProve() string
- func (w *Workspace) GetLogDir() string
- func (w *Workspace) GetPeerRecord() string
- func (w *Workspace) GetPodr2Key() string
- func (w *Workspace) GetPoisAccDir() string
- func (w *Workspace) GetPoisDir() string
- func (w *Workspace) GetRootDir() string
- func (w *Workspace) GetServiceProve() string
- func (w *Workspace) GetSpaceDir() string
- func (w *Workspace) GetTmpDir() string
- func (w *Workspace) LoadIdleProve() (idleProofInfo, error)
- func (w *Workspace) LoadRsaPublicKey() ([]byte, error)
- func (w *Workspace) LoadServiceProve() (serviceProofInfo, error)
- func (w *Workspace) RemoveAndBuild(rootDir string) error
- func (w *Workspace) SaveChallRandom(challStart uint32, randomIndexList []types.U32, randomList []chain.Random) error
- func (w *Workspace) SaveIdleProve(idleProofRecord idleProofInfo) error
- func (w *Workspace) SaveRsaPublicKey(pub []byte) error
- func (w *Workspace) SaveServiceProve(serviceProofRecord serviceProofInfo) error
- type Workspacer
Constants ¶
View Source
const ( Active = iota Calculate Missing Recovery )
View Source
const ( // Record the fid of stored files Cach_prefix_File = "file:" // Record the block of reported tags Cach_prefix_Tag = "tag:" Cach_prefix_MyLost = "mylost:" Cach_prefix_recovery = "recovery:" Cach_prefix_TargetMiner = "targetminer:" Cach_prefix_ParseBlock = "parseblocks" )
View Source
const ( Success = 200 Error = 201 ErrorParam = 202 ErrorParamNotFound = 203 ErrorInternal = 204 )
View Source
const ( St_Normal uint8 = iota St_Warning St_Error )
Variables ¶
This section is empty.
Functions ¶
func AllowSpecificRoute ¶
func AllowSpecificRoute(allowedPath string) gin.HandlerFunc
func AttestationIdle ¶
func AttestationIdle(cli *chain.ChainClient, peernode *core.PeerNode, p *Pois, r *RunningState, m *pb.MinerPoisInfo, teeRecord *TeeRecord, l *logger.Lg, cfg *confile.Confile, ch chan<- bool)
func ChallengeMgt ¶
func ChallengeMgt( cli *chain.ChainClient, l logger.Logger, ws *Workspace, r *RunningState, teeRecord *TeeRecord, peernode *core.PeerNode, m *pb.MinerPoisInfo, rsa *RSAKeyPair, p *Pois, cfg *confile.Confile, cace cache.Cache, idleChallTaskCh chan bool, serviceChallTaskCh chan bool, )
func ProcessTeeEndpoint ¶
func ReplaceIdle ¶
func ReportFiles ¶
func ReportFiles(ch chan<- bool, cli *chain.ChainClient, r *RunningState, l *logger.Lg, fileDir, tmpDir string)
func RestoreFiles ¶
func RestoreLocalFiles ¶
func RestoreOtherFiles ¶
func SyncTeeInfo ¶
Types ¶
type GenProofResponse ¶
type GetStatus ¶
type GetStatus interface { GetCpuCores() int GetPID() int GetLastReconnectRpcTime() string GetCalcTagFlag() bool GetReportFileFlag() bool GetGenIdleFlag() bool GetAuthIdleFlag() bool GetIdleChallengeFlag() bool GetServiceChallengeFlag() bool GetChainStatus() bool GetReceiveFlag() bool GetCurrentRpc() string // miner GetMinerState() string GetMinerSpaceInfo() (uint64, uint64, uint64, uint64) GetMinerSignatureAcc() string }
type MinerRecord ¶
type MinerRecord interface { // SavePeer saves or updates peer information SavePeer(addr peer.AddrInfo) error // HasPeer(peerid string) bool // GetPeer(peerid string) (peer.AddrInfo, error) // GetAllPeerId() []string // BackupPeer(path string) error // LoadPeer(path string) error // SaveMinerAcc(acc string, peerid string) // GetAllMinerAcc() []string }
func NewPeerRecord ¶
func NewPeerRecord() MinerRecord
type PeerRecordType ¶
type PeerRecordType struct {
// contains filtered or unexported fields
}
func (*PeerRecordType) BackupPeer ¶
func (p *PeerRecordType) BackupPeer(path string) error
func (*PeerRecordType) GetAllMinerAcc ¶
func (p *PeerRecordType) GetAllMinerAcc() []string
func (*PeerRecordType) GetAllPeerId ¶
func (p *PeerRecordType) GetAllPeerId() []string
func (*PeerRecordType) GetPeer ¶
func (p *PeerRecordType) GetPeer(peerid string) (peer.AddrInfo, error)
func (*PeerRecordType) HasPeer ¶
func (p *PeerRecordType) HasPeer(peerid string) bool
func (*PeerRecordType) LoadPeer ¶
func (p *PeerRecordType) LoadPeer(path string) error
func (*PeerRecordType) SaveMinerAcc ¶
func (p *PeerRecordType) SaveMinerAcc(acc string, peerid string)
type RSAKeyPair ¶
func NewRsaKey ¶
func NewRsaKey(pubkey []byte) (*RSAKeyPair, error)
func (RSAKeyPair) AggrAppendProof ¶
func (keyPair RSAKeyPair) AggrAppendProof(AggrSigma string, aSigma string) (string, bool)
func (RSAKeyPair) AggrGenProof ¶
func (keyPair RSAKeyPair) AggrGenProof(QSlice []QElement, Tag []Tag) string
func (RSAKeyPair) GenProof ¶
func (keyPair RSAKeyPair) GenProof(QSlice []QElement, h HashSelf, Phi []string, Matrix [][]byte) <-chan GenProofResponse
func (*RSAKeyPair) VerifyAttest ¶
func (r *RSAKeyPair) VerifyAttest(name, u, phiHash, attest, customData string) (bool, error)
type RandomList ¶
type RunningState ¶
type RunningState struct {
// contains filtered or unexported fields
}
func NewRunTime ¶
func NewRunTime() *RunningState
func (*RunningState) GetAuthIdleFlag ¶
func (s *RunningState) GetAuthIdleFlag() bool
func (*RunningState) GetCalcTagFlag ¶
func (s *RunningState) GetCalcTagFlag() bool
func (*RunningState) GetChainStatus ¶
func (s *RunningState) GetChainStatus() bool
func (*RunningState) GetCpuCores ¶
func (s *RunningState) GetCpuCores() int
func (*RunningState) GetCurrentRpc ¶
func (s *RunningState) GetCurrentRpc() string
func (*RunningState) GetGenIdleFlag ¶
func (s *RunningState) GetGenIdleFlag() bool
func (*RunningState) GetIdleChallengeFlag ¶
func (s *RunningState) GetIdleChallengeFlag() bool
func (*RunningState) GetLastReconnectRpcTime ¶
func (s *RunningState) GetLastReconnectRpcTime() string
func (*RunningState) GetMinerSignatureAcc ¶
func (s *RunningState) GetMinerSignatureAcc() string
func (*RunningState) GetMinerSpaceInfo ¶
func (m *RunningState) GetMinerSpaceInfo() (uint64, uint64, uint64, uint64)
func (*RunningState) GetMinerState ¶
func (s *RunningState) GetMinerState() string
func (*RunningState) GetPID ¶
func (s *RunningState) GetPID() int
func (*RunningState) GetReceiveFlag ¶
func (s *RunningState) GetReceiveFlag() bool
func (*RunningState) GetReportFileFlag ¶
func (s *RunningState) GetReportFileFlag() bool
func (*RunningState) GetServiceChallengeFlag ¶
func (s *RunningState) GetServiceChallengeFlag() bool
func (*RunningState) ListenLocal ¶
func (s *RunningState) ListenLocal()
func (*RunningState) SetAuthIdleFlag ¶
func (s *RunningState) SetAuthIdleFlag(flag bool)
func (*RunningState) SetCalcTagFlag ¶
func (s *RunningState) SetCalcTagFlag(flag bool)
func (*RunningState) SetChainStatus ¶
func (s *RunningState) SetChainStatus(status bool)
func (*RunningState) SetCpuCores ¶
func (s *RunningState) SetCpuCores(num int)
func (*RunningState) SetCurrentRpc ¶
func (s *RunningState) SetCurrentRpc(rpc string)
func (*RunningState) SetGenIdleFlag ¶
func (s *RunningState) SetGenIdleFlag(flag bool)
func (*RunningState) SetIdleChallengeFlag ¶
func (s *RunningState) SetIdleChallengeFlag(flag bool)
func (*RunningState) SetLastReconnectRpcTime ¶
func (s *RunningState) SetLastReconnectRpcTime(t string)
func (*RunningState) SetMinerSignAcc ¶
func (m *RunningState) SetMinerSignAcc(acc string)
func (*RunningState) SetMinerSpaceInfo ¶
func (m *RunningState) SetMinerSpaceInfo(decSpace, validSpace, usedSpace, lockedSpace uint64)
func (*RunningState) SetMinerState ¶
func (m *RunningState) SetMinerState(state string) error
func (*RunningState) SetPID ¶
func (s *RunningState) SetPID(pid int)
func (*RunningState) SetReceiveFlag ¶
func (s *RunningState) SetReceiveFlag(flag bool)
func (*RunningState) SetReportFileFlag ¶
func (s *RunningState) SetReportFileFlag(flag bool)
func (*RunningState) SetServiceChallengeFlag ¶
func (s *RunningState) SetServiceChallengeFlag(flag bool)
type RunningStater ¶
type SetStatus ¶
type SetStatus interface { SetCpuCores(num int) SetPID(pid int) SetLastReconnectRpcTime(t string) SetCalcTagFlag(flag bool) SetReportFileFlag(flag bool) SetGenIdleFlag(flag bool) SetAuthIdleFlag(flag bool) SetIdleChallengeFlag(flag bool) SetServiceChallengeFlag(flag bool) SetChainStatus(status bool) SetReceiveFlag(flag bool) SetCurrentRpc(rpc string) // miner SetMinerState(state string) error SetMinerSpaceInfo(decSpace, validSpace, usedSpace, lockedSpace uint64) SetMinerSignAcc(acc string) }
type TagfileType ¶
type TagfileType struct { Tag *pb.Tag `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"` USig []byte `protobuf:"bytes,2,opt,name=u_sig,json=uSig,proto3" json:"u_sig,omitempty"` Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` FragmentName []byte `protobuf:"bytes,4,opt,name=fragment_name,json=fragmentName,proto3" json:"fragment_name,omitempty"` TeeAccountId []byte `protobuf:"bytes,5,opt,name=tee_account_id,json=teeAccountId,proto3" json:"tee_account_id,omitempty"` Index uint16 `protobuf:"bytes,6,opt,name=index,json=index,proto3" json:"index,omitempty"` }
type TeeRecord ¶
type TeeRecord struct {
// contains filtered or unexported fields
}
func NewTeeRecord ¶
func NewTeeRecord() *TeeRecord
func (*TeeRecord) GetAllMarkerTeeEndpoint ¶
func (*TeeRecord) GetAllTeeEndpoint ¶
func (*TeeRecord) GetAllVerifierTeeEndpoint ¶
func (*TeeRecord) GetTeeWorkAccount ¶
type TeeRecorder ¶
type TeeRecorder interface { // SaveTee saves or updates tee information SaveTee(workAccount, endPoint string, teeType uint8) error // GetTee(workAccount string) (TeeInfo, error) // GetTeeWorkAccount(endpoint string) (string, error) // DeleteTee(workAccount string) // GetAllTeeEndpoint() []string // GetAllMarkerTeeEndpoint() []string // GetAllVerifierTeeEndpoint() []string }
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
func NewWorkspace ¶
func NewWorkspace() *Workspace
func (*Workspace) GetChallRandomDir ¶
func (*Workspace) GetChallRndomDir ¶
func (*Workspace) GetFileDir ¶
func (*Workspace) GetIdleProve ¶
func (*Workspace) GetPeerRecord ¶
func (*Workspace) GetPodr2Key ¶
func (*Workspace) GetPoisAccDir ¶
func (*Workspace) GetPoisDir ¶
func (*Workspace) GetRootDir ¶
func (*Workspace) GetServiceProve ¶
func (*Workspace) GetSpaceDir ¶
func (*Workspace) LoadIdleProve ¶
func (*Workspace) LoadRsaPublicKey ¶
func (*Workspace) LoadServiceProve ¶
func (*Workspace) RemoveAndBuild ¶
func (*Workspace) SaveChallRandom ¶
func (*Workspace) SaveIdleProve ¶
func (*Workspace) SaveRsaPublicKey ¶
func (*Workspace) SaveServiceProve ¶
type Workspacer ¶
type Workspacer interface { Build(rootDir string) error RemoveAndBuild(rootDir string) error GetRootDir() string GetFileDir() string GetTmpDir() string GetDbDir() string GetLogDir() string GetSpaceDir() string GetPoisDir() string GetPoisAccDir() string GetChallRndomDir() string GetPeerRecord() string GetPodr2Key() string GetIdleProve() string GetServiceProve() string SaveRsaPublicKey(pub []byte) error LoadRsaPublicKey() ([]byte, error) SaveIdleProve(idleProofRecord idleProofInfo) error LoadIdleProve() (idleProofInfo, error) SaveServiceProve(serviceProofRecord serviceProofInfo) error LoadServiceProve() (serviceProofInfo, error) SaveChallRandom( challStart uint32, randomIndexList []types.U32, randomList []chain.Random, ) error }
Click to show internal directories.
Click to hide internal directories.