protocol

package
v0.0.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileType_ServiceFile uint32 = iota
	FileType_IdleFile
	FileType_TagFile
	FileType_MusFile
	FileType_UsFile
	FileType_NamesFile
)
View Source
const AggrProof_PROTOCOL = "/kldr/apv/1"
View Source
const CustomDataTag_Protocol = "/kldr/cdtg/1"
View Source
const FILE_PROTOCOL = "/kldr/kft/1"
View Source
const FileProtocolBufSize = 2 * 1024 * 1024
View Source
const FileProtocolMsgBuf = 16 * 1024 * 1024
View Source
const IdleDataTag_Protocol = "/kldr/idtg/1"
View Source
const IdleProtocolMsgBuf = 1024
View Source
const MaxCustomDataLength = 255
View Source
const MaxFileNameLength = 255
View Source
const MusProtocolMsgBuf = 32
View Source
const P2PReadReqRespTime = time.Duration(time.Second * 15)
View Source
const P2PResponseFailed uint32 = 400
View Source
const P2PResponseFinish uint32 = 210
View Source
const P2PResponseOK uint32 = 200
View Source
const P2PWriteReqRespTime = time.Duration(time.Second * 15)
View Source
const PushTag_Protocol = "/kldr/tagpush/1"
View Source
const TagProtocolMsgBuf = 1024 * 1024

Variables

View Source
var (
	FileNameLengthErr   = fmt.Errorf("filename length exceeds %d", MaxFileNameLength)
	FileNameEmptyErr    = fmt.Errorf("filename is empty")
	CustomDataLengthErr = fmt.Errorf("custom data length exceeds %d", MaxCustomDataLength)
)

Functions

func CalcFileSHA256

func CalcFileSHA256(f *os.File) (string, error)

CalcFileSHA256 is used to calculate the sha256 value of the file type.

func CalcPathSHA256

func CalcPathSHA256(fpath string) (string, error)

CalcPathSHA256 is used to calculate the sha256 value of a file with a given path.

func CalcSHA256

func CalcSHA256(data []byte) (string, error)

CalcSHA256 is used to calculate the sha256 value of the data.

Types

type AggrProofProtocol added in v0.0.15

type AggrProofProtocol struct {
	// contains filtered or unexported fields
}

func NewAggrProofProtocol added in v0.0.15

func NewAggrProofProtocol(node *core.Node) *AggrProofProtocol

func (*AggrProofProtocol) AggrProofReq added in v0.0.15

func (e *AggrProofProtocol) AggrProofReq(peerId peer.ID, ihash, shash []byte, qslice []*pb.Qslice, puk, sign []byte) (uint32, error)

type CustomDataTagProtocol added in v0.0.10

type CustomDataTagProtocol struct {
	// contains filtered or unexported fields
}

func NewCustomDataTagProtocol added in v0.0.10

func NewCustomDataTagProtocol(node *core.Node) *CustomDataTagProtocol

func (*CustomDataTagProtocol) TagReq added in v0.0.10

func (e *CustomDataTagProtocol) TagReq(peerId peer.ID, filename, customdata string, blocknum uint64) (uint32, error)

type FileProtocol added in v0.0.9

type FileProtocol struct {
	// contains filtered or unexported fields
}

func NewFileProtocol added in v0.0.9

func NewFileProtocol(node *core.Node) *FileProtocol

func (*FileProtocol) FileReq added in v0.0.9

func (e *FileProtocol) FileReq(peerId peer.ID, filehash string, filetype pb.FileType, fpath string) (uint32, error)

type IdleDataTagProtocol added in v0.0.10

type IdleDataTagProtocol struct {
	// contains filtered or unexported fields
}

func NewIdleDataTagProtocol added in v0.0.10

func NewIdleDataTagProtocol(node *core.Node) *IdleDataTagProtocol

func (*IdleDataTagProtocol) IdleReq added in v0.0.10

func (e *IdleDataTagProtocol) IdleReq(peerId peer.ID, filesize, blocknum uint64, pubkey, sign []byte) (uint32, error)

type Names added in v0.0.12

type Names struct {
	Name []string `json:"name"`
}

type PushTagProtocol added in v0.0.15

type PushTagProtocol struct {
	// contains filtered or unexported fields
}

func NewPushTagProtocol added in v0.0.15

func NewPushTagProtocol(node *core.Node) *PushTagProtocol

func (*PushTagProtocol) TagPushReq added in v0.0.20

func (e *PushTagProtocol) TagPushReq(peerid peer.ID) (uint32, error)

remote peer requests handler

type ReadFileProtocol

type ReadFileProtocol struct {
	// contains filtered or unexported fields
}

func NewReadFileProtocol

func NewReadFileProtocol(node *core.Node) *ReadFileProtocol

func (*ReadFileProtocol) ReadFileAction

func (e *ReadFileProtocol) ReadFileAction(id peer.ID, roothash, datahash, path string, size int64) error

type Us added in v0.0.12

type Us struct {
	U []string `json:"u"`
}

type WriteFileProtocol

type WriteFileProtocol struct {
	// contains filtered or unexported fields
}

func NewWriteFileProtocol

func NewWriteFileProtocol(node *core.Node) *WriteFileProtocol

func (*WriteFileProtocol) WriteFileAction

func (e *WriteFileProtocol) WriteFileAction(id peer.ID, roothash, path string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL