core

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 54 Imported by: 4

Documentation

Index

Constants

View Source
const (
	SIZE_1KiB = 1024
	SIZE_1MiB = 1024 * SIZE_1KiB
	SIZE_1GiB = 1024 * SIZE_1MiB
)

byte size

View Source
const (
	FileDataDirectionry = "file"
	TmpDataDirectionry  = "tmp"
)
View Source
const (
	ERR_RespTimeOut     = "peer response timeout"
	ERR_RespFailure     = "peer response failure"
	ERR_RespInvalidData = "peer response invalid data"
)
View Source
const AllIpAddress = "0.0.0.0"
View Source
const BufferSize = 64 * SIZE_1KiB
View Source
const DefaultFDCount = 65535
View Source
const DirMode = 0644
View Source
const FileBlockDir = "blocks"
View Source
const FileProtocolBufSize = 2 * 1024 * 1024
View Source
const FragmentSize = 16 * SIZE_1MiB
View Source
const LocalAddress = "127.0.0.1"
View Source
const MaxCustomDataLength = 255
View Source
const MaxFileNameLength = 255
View Source
const P2PReadReqRespTime = time.Duration(time.Second * 30)
View Source
const P2PResponseEmpty uint32 = 404
View Source
const P2PResponseFailed uint32 = 400
View Source
const P2PResponseFinish uint32 = 210
View Source
const P2PResponseOK uint32 = 200
View Source
const P2PResponseRemoteFailed uint32 = 500
View Source
const P2PWriteReqRespTime = time.Duration(time.Second * 30)
View Source
const SegmentSize = 64 * SIZE_1MiB
View Source
const ZeroFileHash_16M = "080acf35a507ac9849cfcba47dc2ad83e01b75663a516279c8b9d243b719643e"

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 added in v0.0.24

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

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

func CalcPathSHA256 added in v0.0.24

func CalcPathSHA256(fpath string) (string, error)

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

func CalcSHA256 added in v0.0.24

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

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

func FindFile added in v0.1.7

func FindFile(dir, name string) string

func FreeLocalPort added in v0.1.5

func FreeLocalPort(port uint32) bool

func GetExternalIp added in v0.0.2

func GetExternalIp() (string, error)

Get external ip address

func GetLocalIp added in v0.0.29

func GetLocalIp() ([]string, error)

Get local ip address

func IsIPv4 added in v0.1.0

func IsIPv4(ipAddr string) bool

IsIPv4 is used to determine whether ipAddr is an ipv4 address

func IsIPv6 added in v0.1.0

func IsIPv6(ipAddr string) bool

IsIPv6 is used to determine whether ipAddr is an ipv6 address

func NewDatastore added in v0.2.1

func NewDatastore(path string) (ds.Datastore, error)

NewDatastore returns a new fs Datastore at given `path`

func NewProtocol added in v0.0.24

func NewProtocol() *protocols

func ParseMultiaddrs added in v0.0.37

func ParseMultiaddrs(domain string) ([]string, error)

ParseMultiaddrs

Types

type DataDirs added in v0.0.24

type DataDirs struct {
	FileDir string
	TmpDir  string
}

type Datastore added in v0.2.1

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

Datastore uses a uses a file per key to store values.

func (*Datastore) Batch added in v0.2.1

func (d *Datastore) Batch(ctx context.Context) (ds.Batch, error)

func (*Datastore) Close added in v0.2.1

func (d *Datastore) Close() error

func (*Datastore) Delete added in v0.2.1

func (d *Datastore) Delete(ctx context.Context, key ds.Key) (err error)

Delete removes the value for given key

func (*Datastore) DiskUsage added in v0.2.1

func (d *Datastore) DiskUsage(ctx context.Context) (uint64, error)

DiskUsage returns the disk size used by the datastore in bytes.

func (*Datastore) Get added in v0.2.1

func (d *Datastore) Get(ctx context.Context, key ds.Key) (value []byte, err error)

Get returns the value for given key

func (*Datastore) GetSize added in v0.2.1

func (d *Datastore) GetSize(ctx context.Context, key ds.Key) (size int, err error)

func (*Datastore) Has added in v0.2.1

func (d *Datastore) Has(ctx context.Context, key ds.Key) (exists bool, err error)

Has returns whether the datastore has a value for a given key

func (*Datastore) KeyFilename added in v0.2.1

func (d *Datastore) KeyFilename(key ds.Key) string

KeyFilename returns the filename associated with `key`

func (*Datastore) Put added in v0.2.1

func (d *Datastore) Put(ctx context.Context, key ds.Key, value []byte) (err error)

Put stores the given value.

func (*Datastore) Query added in v0.2.1

func (d *Datastore) Query(ctx context.Context, q query.Query) (query.Results, error)

Query implements Datastore.Query

func (*Datastore) Sync added in v0.2.1

func (d *Datastore) Sync(ctx context.Context, prefix ds.Key) error

Sync would ensure that any previous Puts under the prefix are written to disk. However, they already are.

type Node

type Node struct {
	*dht.IpfsDHT
	*drouting.RoutingDiscovery
	// contains filtered or unexported fields
}

Node type - Implementation of a P2P Host

func (*Node) AddMultiaddrToPeerstore added in v0.0.32

func (n *Node) AddMultiaddrToPeerstore(multiaddr string, t time.Duration) (peer.ID, error)

func (*Node) Addrs

func (n *Node) Addrs() []ma.Multiaddr

Returns the listen addresses of the Host

func (*Node) Close

func (n *Node) Close() error

Close shuts down the host, its Network, and services.

func (*Node) ConnManager

func (n *Node) ConnManager() connmgr.ConnManager

ConnManager returns this hosts connection manager

func (*Node) Connect

func (n *Node) Connect(ctx context.Context, pi peer.AddrInfo) error

Connect ensures there is a connection between this host and the peer with given peer.ID. Connect will absorb the addresses in pi into its internal peerstore. If there is not an active connection, Connect will issue a h.Network.Dial, and block until a connection is open, or an error is returned. // TODO: Relay + NAT.

func (*Node) DHTFindPeer added in v0.1.0

func (n *Node) DHTFindPeer(peerid string) (peer.AddrInfo, error)

DHTFindPeer searches for a peer with given ID.

func (*Node) EventBus

func (n *Node) EventBus() event.Bus

EventBus returns the hosts eventbus

func (*Node) FidToCid added in v0.2.2

func (n *Node) FidToCid(fid string) (string, error)

FidToCid

func (*Node) GetBitSwap added in v0.2.2

func (n *Node) GetBitSwap() *bitswap.Bitswap

func (*Node) GetBlockstore added in v0.2.2

func (n *Node) GetBlockstore() blockstore.Blockstore

func (*Node) GetBootstraps added in v0.0.24

func (n *Node) GetBootstraps() []string

func (*Node) GetCtxCancelFromRoot added in v0.1.1

func (n *Node) GetCtxCancelFromRoot() context.Context

func (*Node) GetCtxQueryFromCtxCancel added in v0.1.1

func (n *Node) GetCtxQueryFromCtxCancel() context.Context

func (*Node) GetCtxRoot added in v0.1.1

func (n *Node) GetCtxRoot() context.Context

func (*Node) GetDataFromBlock added in v0.2.1

func (n *Node) GetDataFromBlock(ctx context.Context, wantCid string) ([]byte, error)

GetDataFromBlock get data from block

func (*Node) GetDht added in v0.2.0

func (n *Node) GetDht() *dht.IpfsDHT

func (*Node) GetDhtProtocolVersion added in v0.0.24

func (n *Node) GetDhtProtocolVersion() string

func (*Node) GetDirs added in v0.0.24

func (n *Node) GetDirs() DataDirs

func (*Node) GetDiscoveredPeers added in v0.1.1

func (n *Node) GetDiscoveredPeers() <-chan *routing.QueryEvent

GetDiscoveredPeers

func (*Node) GetIdleFileTee added in v0.0.15

func (n *Node) GetIdleFileTee() string

func (*Node) GetLocalDataFromBlock added in v0.2.2

func (n *Node) GetLocalDataFromBlock(wantCid string) ([]byte, error)

GetLocalDataFromBlock get local data from block

func (*Node) GetPeerPublickey added in v0.0.25

func (n *Node) GetPeerPublickey() []byte

func (*Node) GetProtocolPrefix added in v0.0.37

func (n *Node) GetProtocolPrefix() string

func (*Node) GetProtocolVersion added in v0.0.24

func (n *Node) GetProtocolVersion() string

func (*Node) GetRendezvousVersion added in v0.1.0

func (n *Node) GetRendezvousVersion() string

func (*Node) GetRoutingTable added in v0.2.0

func (n *Node) GetRoutingTable() *drouting.RoutingDiscovery

func (*Node) GetServiceFileTee added in v0.0.15

func (n *Node) GetServiceFileTee() string

func (*Node) GetServiceTagCh added in v0.0.24

func (n *Node) GetServiceTagCh() <-chan string

func (*Node) ID

func (n *Node) ID() peer.ID

ID returns the (local) peer.ID associated with this Host

func (*Node) Mux

func (n *Node) Mux() protocol.Switch

Mux returns the Mux multiplexing incoming streams to protocol handlers

func (*Node) Network

func (n *Node) Network() network.Network

Networks returns the Network interface of the Host

func (*Node) NewMessageData

func (n *Node) NewMessageData(messageId string, gossip bool) *pb.MessageData

helper method - generate message data shared between all node's p2p protocols messageId: unique for requests, copied from request for responses

func (*Node) NewPeerStream added in v0.0.9

func (n *Node) NewPeerStream(id peer.ID, p protocol.ID) (network.Stream, error)

NewPeerStream

func (*Node) NewPodr2ApiClient added in v0.2.7

func (n *Node) NewPodr2ApiClient(addr string, opts ...grpc.DialOption) (pb.Podr2ApiClient, error)

func (*Node) NewPodr2VerifierApiClient added in v0.2.7

func (n *Node) NewPodr2VerifierApiClient(addr string, opts ...grpc.DialOption) (pb.Podr2VerifierApiClient, error)

func (*Node) NewPoisCertifierApiClient added in v0.2.7

func (n *Node) NewPoisCertifierApiClient(addr string, opts ...grpc.DialOption) (pb.PoisCertifierApiClient, error)

func (*Node) NewPoisVerifierApiClient added in v0.2.7

func (n *Node) NewPoisVerifierApiClient(addr string, opts ...grpc.DialOption) (pb.PoisVerifierApiClient, error)

func (*Node) NewReadDataProtocol added in v0.1.7

func (n *Node) NewReadDataProtocol() *ReadDataProtocol

func (*Node) NewReadDataStatProtocol added in v0.2.6

func (n *Node) NewReadDataStatProtocol() *ReadDataStatProtocol

func (*Node) NewReadFileProtocol added in v0.0.24

func (n *Node) NewReadFileProtocol() *ReadFileProtocol

func (*Node) NewStream

func (n *Node) NewStream(ctx context.Context, p peer.ID, pids ...protocol.ID) (network.Stream, error)

NewStream opens a new stream to given peer p, and writes a p2p/protocol header with given ProtocolID. If there is no connection to p, attempts to create one. If ProtocolID is "", writes no header. (Threadsafe)

func (*Node) NewWriteFileProtocol added in v0.0.24

func (n *Node) NewWriteFileProtocol() *WriteFileProtocol

func (*Node) NotifyData added in v0.2.1

func (n *Node) NotifyData(buf []byte) error

NotifyData notify data

func (*Node) PeerID added in v0.1.4

func (n *Node) PeerID() peer.ID

PeerID returns for own peerid

func (*Node) Peerstore

func (n *Node) Peerstore() peerstore.Peerstore

Peerstore returns the Host's repository of Peer Addresses and Keys.

func (*Node) PrivatekeyPath

func (n *Node) PrivatekeyPath() string

func (Node) ReadDataAction added in v0.1.7

func (e Node) ReadDataAction(id peer.ID, roothash, datahash, path string, size int64) error

func (Node) ReadDataStatAction added in v0.2.6

func (e Node) ReadDataStatAction(id peer.ID, roothash string, datahash string) (uint64, error)

func (Node) ReadFileAction added in v0.0.24

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

func (*Node) RemoveStreamHandler

func (n *Node) RemoveStreamHandler(pid protocol.ID)

RemoveStreamHandler removes a handler on the mux that was set by SetStreamHandler

func (*Node) RequestBatchVerify added in v0.2.7

func (n *Node) RequestBatchVerify(
	addr string,
	requestBatchVerify *pb.RequestBatchVerify,
	timeout time.Duration,
	dialOpts []grpc.DialOption,
	callOpts []grpc.CallOption,
) (*pb.ResponseBatchVerify, error)

func (*Node) RequestGenTag added in v0.2.7

func (n *Node) RequestGenTag(
	addr string,
	requestGenTag *pb.RequestGenTag,
	timeout time.Duration,
	dialOpts []grpc.DialOption,
	callOpts []grpc.CallOption,
) (*pb.ResponseGenTag, error)

func (*Node) RequestMinerCommitGenChall added in v0.2.7

func (n *Node) RequestMinerCommitGenChall(
	addr string,
	commitGenChall *pb.RequestMinerCommitGenChall,
	timeout time.Duration,
	dialOpts []grpc.DialOption,
	callOpts []grpc.CallOption,
) (*pb.Challenge, error)

func (*Node) RequestMinerGetNewKey added in v0.2.7

func (n *Node) RequestMinerGetNewKey(
	addr string,
	accountKey []byte,
	timeout time.Duration,
	dialOpts []grpc.DialOption,
	callOpts []grpc.CallOption,
) (*pb.ResponseMinerInitParam, error)

func (*Node) RequestSpaceProofVerifySingleBlock added in v0.2.7

func (n *Node) RequestSpaceProofVerifySingleBlock(
	addr string,
	requestSpaceProofVerify *pb.RequestSpaceProofVerify,
	timeout time.Duration,
	dialOpts []grpc.DialOption,
	callOpts []grpc.CallOption,
) (*pb.ResponseSpaceProofVerify, error)

func (*Node) RequestVerifyCommitProof added in v0.2.7

func (n *Node) RequestVerifyCommitProof(
	addr string,
	verifyCommitAndAccProof *pb.RequestVerifyCommitAndAccProof,
	timeout time.Duration,
	dialOpts []grpc.DialOption,
	callOpts []grpc.CallOption,
) (*pb.ResponseVerifyCommitOrDeletionProof, error)

func (*Node) RequestVerifyDeletionProof added in v0.2.7

func (n *Node) RequestVerifyDeletionProof(
	addr string,
	requestVerifyDeletionProof *pb.RequestVerifyDeletionProof,
	timeout time.Duration,
	dialOpts []grpc.DialOption,
	callOpts []grpc.CallOption,
) (*pb.ResponseVerifyCommitOrDeletionProof, error)

func (*Node) RequestVerifySpaceTotal added in v0.2.8

func (n *Node) RequestVerifySpaceTotal(
	addr string,
	requestSpaceProofVerifyTotal *pb.RequestSpaceProofVerifyTotal,
	timeout time.Duration,
	dialOpts []grpc.DialOption,
	callOpts []grpc.CallOption,
) (*pb.ResponseSpaceProofVerifyTotal, error)

func (*Node) RouteTableFindPeers added in v0.1.0

func (n *Node) RouteTableFindPeers(limit int) (<-chan peer.AddrInfo, error)

RouteTableFindPeers

func (*Node) SaveAndNotifyDataBlock added in v0.2.1

func (n *Node) SaveAndNotifyDataBlock(buf []byte) (cid.Cid, error)

SaveAndNotifyDataBlock

func (*Node) SendMsgToStream added in v0.0.9

func (n *Node) SendMsgToStream(s network.Stream, msg []byte) error

SendMsgToStream

func (*Node) SendProtoMessage

func (n *Node) SendProtoMessage(id peer.ID, p protocol.ID, data proto.Message) error

helper method - writes a protobuf go data object to a network stream data: reference of protobuf go data object to send (not the object itself) s: network stream to write the data to

func (*Node) SetBootstraps added in v0.0.24

func (n *Node) SetBootstraps(bootstrap []string)

func (*Node) SetIdleFileTee added in v0.0.15

func (n *Node) SetIdleFileTee(peerid string)

func (Node) SetProtocolPrefix added in v0.0.37

func (p Node) SetProtocolPrefix(protocolPrefix string)

func (*Node) SetServiceFileTee added in v0.0.15

func (n *Node) SetServiceFileTee(peerid string)

func (*Node) SetStreamHandler

func (n *Node) SetStreamHandler(pid protocol.ID, handler network.StreamHandler)

SetStreamHandler sets the protocol handler on the Host's Mux. This is equivalent to: host.Mux().SetHandler(proto, handler) (Threadsafe)

func (*Node) SetStreamHandlerMatch

func (n *Node) SetStreamHandlerMatch(pid protocol.ID, m func(protocol.ID) bool, handler network.StreamHandler)

SetStreamHandlerMatch sets the protocol handler on the Host's Mux using a matching function for protocol selection.

func (*Node) Workspace

func (n *Node) Workspace() string

func (Node) WriteFileAction added in v0.0.24

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

type P2P

type P2P interface {
	// Lib-p2p host
	host.Host

	// Message protocol
	Protocol

	// GetCtxRoot returns the root context of the host
	GetCtxRoot() context.Context

	// GetCtxCancelFromRoot returns the cancel context from root context
	GetCtxCancelFromRoot() context.Context

	// GetCtxQueryFromCtxCancel returns tne query context from cancel context
	GetCtxQueryFromCtxCancel() context.Context

	// PrivatekeyPath returns the key file location
	PrivatekeyPath() string

	// Workspace returns to the working directory
	Workspace() string

	// AddMultiaddrToPeerstore adds multiaddr to the host's peerstore
	AddMultiaddrToPeerstore(multiaddr string, t time.Duration) (peer.ID, error)

	// GetPeerPublickey returns the host's public key
	GetPeerPublickey() []byte

	// GetProtocolVersion returns the ProtocolVersion of the host
	GetProtocolVersion() string

	// GetDhtProtocolVersion returns the host's DHT ProtocolVersion
	GetDhtProtocolVersion() string

	// GetRendezvousVersion returns the rendezvous protocol
	GetRendezvousVersion() string

	// GetProtocolPrefix returns protocols prefix
	GetProtocolPrefix() string

	// GetDirs returns the data directory structure of the host
	GetDirs() DataDirs

	// GetBootstraps returns a list of host bootstraps
	GetBootstraps() []string

	// SetBootstraps updates the host's bootstrap list
	SetBootstraps(bootstrap []string)

	//
	GetDht() *dht.IpfsDHT

	//
	GetRoutingTable() *drouting.RoutingDiscovery

	// DHTFindPeer searches for a peer with given ID
	DHTFindPeer(peerid string) (peer.AddrInfo, error)

	// PeerID returns your own peerid
	PeerID() peer.ID

	// Close p2p
	Close() error

	//
	GetBlockstore() blockstore.Blockstore

	//
	GetBitSwap() *bitswap.Bitswap

	//
	FidToCid(fid string) (string, error)

	//
	SaveAndNotifyDataBlock(buf []byte) (cid.Cid, error)

	//
	NotifyData(buf []byte) error

	// GetDataFromBlock get data from block
	GetDataFromBlock(ctx context.Context, wantCid string) ([]byte, error)

	//
	GetLocalDataFromBlock(wantCid string) ([]byte, error)

	//
	GetDiscoveredPeers() <-chan *routing.QueryEvent

	// RouteTableFindPeers
	RouteTableFindPeers(limit int) (<-chan peer.AddrInfo, error)

	// GetServiceTagCh returns the tag channel of the service data received by the host
	GetServiceTagCh() <-chan string

	NewPoisCertifierApiClient(addr string, opts ...grpc.DialOption) (pb.PoisCertifierApiClient, error)

	NewPoisVerifierApiClient(addr string, opts ...grpc.DialOption) (pb.PoisVerifierApiClient, error)

	NewPodr2ApiClient(addr string, opts ...grpc.DialOption) (pb.Podr2ApiClient, error)

	NewPodr2VerifierApiClient(addr string, opts ...grpc.DialOption) (pb.Podr2VerifierApiClient, error)

	RequestMinerGetNewKey(
		addr string,
		accountKey []byte,
		timeout time.Duration,
		dialOpts []grpc.DialOption,
		callOpts []grpc.CallOption,
	) (*pb.ResponseMinerInitParam, error)

	RequestMinerCommitGenChall(
		addr string,
		commitGenChall *pb.RequestMinerCommitGenChall,
		timeout time.Duration,
		dialOpts []grpc.DialOption,
		callOpts []grpc.CallOption,
	) (*pb.Challenge, error)

	RequestVerifyCommitProof(
		addr string,
		verifyCommitAndAccProof *pb.RequestVerifyCommitAndAccProof,
		timeout time.Duration,
		dialOpts []grpc.DialOption,
		callOpts []grpc.CallOption,
	) (*pb.ResponseVerifyCommitOrDeletionProof, error)

	RequestVerifyDeletionProof(
		addr string,
		requestVerifyDeletionProof *pb.RequestVerifyDeletionProof,
		timeout time.Duration,
		dialOpts []grpc.DialOption,
		callOpts []grpc.CallOption,
	) (*pb.ResponseVerifyCommitOrDeletionProof, error)

	RequestSpaceProofVerifySingleBlock(
		addr string,
		requestSpaceProofVerify *pb.RequestSpaceProofVerify,
		timeout time.Duration,
		dialOpts []grpc.DialOption,
		callOpts []grpc.CallOption,
	) (*pb.ResponseSpaceProofVerify, error)

	RequestVerifySpaceTotal(
		addr string,
		requestSpaceProofVerifyTotal *pb.RequestSpaceProofVerifyTotal,
		timeout time.Duration,
		dialOpts []grpc.DialOption,
		callOpts []grpc.CallOption,
	) (*pb.ResponseSpaceProofVerifyTotal, error)

	RequestGenTag(
		addr string,
		requestGenTag *pb.RequestGenTag,
		timeout time.Duration,
		dialOpts []grpc.DialOption,
		callOpts []grpc.CallOption,
	) (*pb.ResponseGenTag, error)

	RequestBatchVerify(
		addr string,
		requestBatchVerify *pb.RequestBatchVerify,
		timeout time.Duration,
		dialOpts []grpc.DialOption,
		callOpts []grpc.CallOption,
	) (*pb.ResponseBatchVerify, error)
}

P2P is an object participating in a p2p network, which implements protocols or provides services. It handles requests like a Server, and issues requests like a Client. It is called Host because it is both Server and Client (and Peer may be confusing). It references libp2p: https://github.com/libp2p/go-libp2p

func NewBasicNode

func NewBasicNode(
	ctx context.Context,
	port int,
	workspace string,
	privatekeypath string,
	bootstrap []string,
	cmgr connmgr.ConnManager,
	protocolPrefix string,
	publicip string,
) (P2P, error)

NewBasicNode constructs a new *Node

  workspace: service working directory
  privatekeypath: private key file
	  If it is empty, automatically created in the program working directory
	  If it is a directory, it will be created in the specified directory

type Protocol added in v0.0.24

type Protocol interface {
	WriteFileAction(id peer.ID, roothash, path string) error
	ReadFileAction(id peer.ID, roothash, datahash, path string, size int64) error
	ReadDataAction(id peer.ID, roothash, datahash, path string, size int64) error
	ReadDataStatAction(id peer.ID, roothash string, datahash string) (uint64, error)
}

type ReadDataProtocol added in v0.1.7

type ReadDataProtocol struct {
	*Node // local host
	*sync.Mutex
	// contains filtered or unexported fields
}

func (ReadDataProtocol) ReadDataAction added in v0.1.7

func (e ReadDataProtocol) ReadDataAction(id peer.ID, roothash, datahash, path string, size int64) error

func (ReadDataProtocol) ReadDataStatAction added in v0.2.6

func (e ReadDataProtocol) ReadDataStatAction(id peer.ID, roothash string, datahash string) (uint64, error)

func (ReadDataProtocol) ReadFileAction added in v0.1.7

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

func (ReadDataProtocol) SetProtocolPrefix added in v0.1.7

func (p ReadDataProtocol) SetProtocolPrefix(protocolPrefix string)

func (ReadDataProtocol) WriteFileAction added in v0.1.7

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

type ReadDataStatProtocol added in v0.2.6

type ReadDataStatProtocol struct {
	*Node // local host
	*sync.Mutex
	// contains filtered or unexported fields
}

func (ReadDataStatProtocol) ReadDataAction added in v0.2.6

func (e ReadDataStatProtocol) ReadDataAction(id peer.ID, roothash, datahash, path string, size int64) error

func (ReadDataStatProtocol) ReadDataStatAction added in v0.2.6

func (e ReadDataStatProtocol) ReadDataStatAction(id peer.ID, roothash string, datahash string) (uint64, error)

func (ReadDataStatProtocol) ReadFileAction added in v0.2.6

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

func (ReadDataStatProtocol) SetProtocolPrefix added in v0.2.6

func (p ReadDataStatProtocol) SetProtocolPrefix(protocolPrefix string)

func (ReadDataStatProtocol) WriteFileAction added in v0.2.6

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

type ReadFileProtocol added in v0.0.24

type ReadFileProtocol struct {
	*Node // local host
	*sync.Mutex
	// contains filtered or unexported fields
}

func (ReadFileProtocol) ReadDataAction added in v0.1.7

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

func (ReadFileProtocol) ReadDataStatAction added in v0.2.6

func (e ReadFileProtocol) ReadDataStatAction(id peer.ID, roothash string, datahash string) (uint64, error)

func (ReadFileProtocol) ReadFileAction added in v0.0.24

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

func (ReadFileProtocol) SetProtocolPrefix added in v0.0.37

func (p ReadFileProtocol) SetProtocolPrefix(protocolPrefix string)

func (ReadFileProtocol) WriteFileAction added in v0.0.24

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

type WriteFileProtocol added in v0.0.24

type WriteFileProtocol struct {
	*Node
	*sync.Mutex
	// contains filtered or unexported fields
}

func (WriteFileProtocol) ReadDataAction added in v0.1.7

func (e WriteFileProtocol) ReadDataAction(id peer.ID, roothash, datahash, path string, size int64) error

func (WriteFileProtocol) ReadDataStatAction added in v0.2.6

func (e WriteFileProtocol) ReadDataStatAction(id peer.ID, roothash string, datahash string) (uint64, error)

func (WriteFileProtocol) ReadFileAction added in v0.0.24

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

func (WriteFileProtocol) SetProtocolPrefix added in v0.0.37

func (p WriteFileProtocol) SetProtocolPrefix(protocolPrefix string)

func (WriteFileProtocol) WriteFileAction added in v0.0.24

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