Documentation
¶
Index ¶
- Constants
- Variables
- func CalcFileSHA256(f *os.File) (string, error)
- func CalcPathSHA256(fpath string) (string, error)
- func CalcSHA256(data []byte) (string, error)
- type CustomDataTagProtocol
- type FileProtocol
- type IdleDataTagProtocol
- type MusProtocol
- type Protocol
- type ReadFileProtocol
- type WriteFileProtocol
Constants ¶
View Source
const ( FileType_ServiceFile uint32 = iota FileType_IdleFile FileType_TagFile FileType_MusFile FileType_UsFile FileType_NamesFile )
View Source
const CustomDataTag_Protocol = "/kldr/cdtg/1"
View Source
const FILE_PROTOCOL = "/kldr/sft/1"
View Source
const FileDirectionry = "file"
View Source
const FileProtocolBufSize = 2 * 1024 * 1024
View Source
const FileProtocolMsgBuf = 1024
View Source
const IdleDataTag_Protocol = "/kldr/idtg/1"
View Source
const IdleDirectionry = "idle"
View Source
const IdleProtocolMsgBuf = 1024
View Source
const MUS_PROTOCOL = "/kldr/vdf/1"
View Source
const MaxCustomDataLength = 255
View Source
const MaxFileNameLength = 255
View Source
const MusDirectionry = "mu"
View Source
const MusProtocolMsgBuf = 32
View Source
const NamesDirectionry = "name"
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 TagDirectionry = "tag"
View Source
const TagProtocolMsgBuf = 1024
View Source
const TmpDirectionry = "tmp"
View Source
const UsDirectionry = "us"
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 ¶
CalcFileSHA256 is used to calculate the sha256 value of the file type.
func CalcPathSHA256 ¶
CalcPathSHA256 is used to calculate the sha256 value of a file with a given path.
func CalcSHA256 ¶
CalcSHA256 is used to calculate the sha256 value of the data.
Types ¶
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
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
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
type MusProtocol ¶ added in v0.0.9
type MusProtocol struct {
// contains filtered or unexported fields
}
func NewMusProtocol ¶ added in v0.0.9
func NewMusProtocol(node *core.Node) *MusProtocol
type Protocol ¶
type Protocol struct {
*core.Node
*WriteFileProtocol
*ReadFileProtocol
*CustomDataTagProtocol
*IdleDataTagProtocol
*MusProtocol
*FileProtocol
}
func NewProtocol ¶
type ReadFileProtocol ¶
type ReadFileProtocol struct {
// contains filtered or unexported fields
}
func NewReadFileProtocol ¶
func NewReadFileProtocol(node *core.Node) *ReadFileProtocol
func (*ReadFileProtocol) ReadFileAction ¶
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
Click to show internal directories.
Click to hide internal directories.