Documentation ¶
Index ¶
- Constants
- func EncodeTcpMessage(data []byte) []byte
- func ExecuteCommandString(str string) *command.Result
- func ExecuteCommandWithArgs(command *command.Command) *command.Result
- func OriginListenUdp4(peer *Peer)
- func SenderTcpFunc(conn *net.Conn, method uint, data []byte)
- func StartOrigin()
- func TransferDataToPackage(data []byte, typeCode uint) ([]byte, error)
- func UnpackPeerInfoList(data []byte) map[string]*PeerInfo
- type Block
- type Blockchain
- type Body
- type Header
- type Package
- type PackageTcpHeader
- type Peer
- type PeerInfo
- type PeerRouter
- type SingleBlock
- type SingleBody
- type SingleChain
- type SingleHeader
- type Task
Constants ¶
View Source
const ( TcpMethodJoin = iota MethodReceiveGradient // Deal Local Training Result Reached. TcpMethodReceiveModel // Deal Blockchain Training Result Broadcast. TcpMethodCheckModel // Check Model Training Result. TcpMethodReleaseGradient TcpMethodReleaseModel TcpMethodGetModel TcpMethodGetModelScore TcpMethodExchangeGH )
View Source
const ( UdpMethodRefresh = iota // Request Neighbor PeerInfo. UdpMethodReceive // Receive Neighbor PeerInfo from other Peers. UdpMethodExit // Remove Neighbor Exited. )
View Source
const DefaultFirstJoinListenWaitingTime = 3 * time.Second
View Source
const DefaultIP = "127.0.0.1"
DefaultIP Using 127.0.0.1 for local test network.
View Source
const DefaultK = 2
View Source
const DefaultNeighborRefreshTimeGap = 5 * time.Second // time.Minute
View Source
const DefaultPackageTcpHeaderSize = 256
View Source
const DefaultPort = 8000
View Source
const DefaultRefreshTime = 5 * time.Second
View Source
const DefaultTcpLength = 8 // int64
View Source
const DefaultTcpPort = 9000
Variables ¶
This section is empty.
Functions ¶
func EncodeTcpMessage ¶
func ExecuteCommandString ¶
func OriginListenUdp4 ¶
func OriginListenUdp4(peer *Peer)
func StartOrigin ¶
func StartOrigin()
func UnpackPeerInfoList ¶
Types ¶
type Block ¶
type Block struct { Header *Header `json:"header" yaml:"header"` Body *Body `json:"block" yaml:"block"` Reference []*Block `json:"reference" yaml:"reference"` }
Block DAG Data Structure.
func (*Block) AppendData ¶
func (*Block) CalculateHeader ¶
func (that *Block) CalculateHeader()
CalculateHeader After Block AppendData Finished.
type Blockchain ¶
type Blockchain struct {
Bases []*Block `json:"bases" yaml:"bases"`
}
func (*Blockchain) Verify ¶
func (that *Blockchain) Verify() bool
type Body ¶
type Body struct { // H.E. Verify Information. Units []*pedersonCommitment.VerifiableMessageUint // Compression Gradients. Data [][]byte }
func (*Body) GenerateHeader ¶
func (that *Body) GenerateHeader(dealer *pedersonCommitment.DealerUnit) *Header
GenerateHeader Before Data Transfer, Exchange Arguments G and H.
func (*Body) HashString ¶
type Header ¶
type Header struct { // Blockchain Hash. Merkle []byte `json:"merkle" yaml:"merkle"` SHA512 []byte `json:"sha512" yaml:"sha512"` // Dealer Shows H.E. Arguments GH and Sum of Random and Commitment. Dealer *pedersonCommitment.DealerUnit `json:"dealer" yaml:"dealer"` }
type Package ¶
type Package struct { Type uint `json:"type" yaml:"type"` Message []byte `json:"message" yaml:"message"` }
func UnpackPackage ¶
type PackageTcpHeader ¶
type PackageTcpHeader struct { Type uint `json:"type" yaml:"type"` Length uint `json:"length" yaml:"length"` }
func UnpackPackageTcpHeader ¶
func UnpackPackageTcpHeader(data []byte) *PackageTcpHeader
type Peer ¶
type Peer struct { Info *PeerInfo `json:"info" yaml:"info"` Router *PeerRouter `json:"router" yaml:"router"` Tasks []*Task `json:"tasks" yaml:"tasks"` // contains filtered or unexported fields }
func GeneratePeer ¶
func (*Peer) ReleaseModel ¶
func (*Peer) TcpBroadcast ¶
func (*Peer) UdpBroadcast ¶
type PeerInfo ¶
type PeerInfo struct { Address string `json:"address" yaml:"address"` Port uint `json:"port" yaml:"port"` TcpPort uint `json:"tcpPort" yaml:"tcpPort"` }
func GetDefaultPeerInfo ¶
func GetDefaultPeerInfo() *PeerInfo
func UnpackPeerInfo ¶
func (*PeerInfo) HashString ¶
func (*PeerInfo) TcpCommunicateWithPeer ¶
func (*PeerInfo) UdpSendToPeer ¶
type PeerRouter ¶
type SingleBlock ¶
type SingleBlock struct { Header *SingleHeader `json:"header" yaml:"header"` Body *SingleBody `json:"body" yaml:"body"` Next *SingleBlock `json:"next" yaml:"next"` Back *SingleBlock `json:"back" yaml:"back"` }
func (*SingleBlock) Verify ¶
func (that *SingleBlock) Verify(backward *SingleBlock) bool
type SingleBody ¶
type SingleBody struct { Data []byte `json:"data" yaml:"data"` Nonce []byte `json:"nonce" yaml:"nonce"` }
func (*SingleBody) GenerateHeader ¶
func (that *SingleBody) GenerateHeader(forwardHash []byte) *SingleHeader
type SingleChain ¶
type SingleChain struct { Genesis *SingleBlock `json:"genesis" yaml:"genesis"` Latest *SingleBlock `json:"latest" yaml:"latest"` }
func (*SingleChain) Append ¶
func (that *SingleChain) Append(head *SingleBlock)
func (*SingleChain) Verify ¶
func (that *SingleChain) Verify() bool
func (*SingleChain) VerifyFrom ¶
func (that *SingleChain) VerifyFrom(block *SingleBlock) bool
type SingleHeader ¶
Click to show internal directories.
Click to hide internal directories.