Documentation ¶
Index ¶
- type LibP2pCore
- func (c *LibP2pCore) AddRemotePeer(remotePeer p2pnetwork.PeerInfos) error
- func (c *LibP2pCore) Close() error
- func (c *LibP2pCore) HandleDatagram(d *protocol.Datagram, pid p2pnetwork.PeerID) error
- func (c *LibP2pCore) ID() string
- func (c *LibP2pCore) InitRequestFile(fileID storage.FileHash) (int, error)
- func (c *LibP2pCore) Launch() error
- func (c LibP2pCore) RemovePeerFromTrackers() error
- func (c *LibP2pCore) RequestFile(fileID storage.FileHash) ([]byte, error)
- func (c *LibP2pCore) SetDefaultStreamHandlers() error
- func (c *LibP2pCore) TestFile(file string) error
- func (c *LibP2pCore) UpdatePeers() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LibP2pCore ¶
type LibP2pCore struct { LocalStorage storage.LocalStorage PeerStorage storage.PeerStorage // contains filtered or unexported fields }
func NewLibP2P ¶
func NewLibP2P(infos p2pnetwork.NetworkInfos, prot string) (core *LibP2pCore, err error)
NewLibP2P creates a LibP2P host with a random peer ID listening on the given p2pnetwork.NetworkInfos.
func NewP2PPeer ¶
func NewP2PPeer(trackers []p2pnetwork.Tracker, infos p2pnetwork.NetworkInfos, prot string) (*LibP2pCore, error)
NewP2PPeer: creates a LibP2P host with a random peer ID listening on the given multiaddress.
func (*LibP2pCore) AddRemotePeer ¶
func (c *LibP2pCore) AddRemotePeer(remotePeer p2pnetwork.PeerInfos) error
TODO: Add Interface for RemotePeer (GetMultiAddr() ?)
func (*LibP2pCore) Close ¶
func (c *LibP2pCore) Close() error
func (*LibP2pCore) HandleDatagram ¶
func (c *LibP2pCore) HandleDatagram(d *protocol.Datagram, pid p2pnetwork.PeerID) error
func (*LibP2pCore) ID ¶
func (c *LibP2pCore) ID() string
ID: return a string representin the ID of this Peer
func (*LibP2pCore) InitRequestFile ¶
func (c *LibP2pCore) InitRequestFile(fileID storage.FileHash) (int, error)
func (*LibP2pCore) Launch ¶
func (c *LibP2pCore) Launch() error
func (LibP2pCore) RemovePeerFromTrackers ¶
func (c LibP2pCore) RemovePeerFromTrackers() error
func (*LibP2pCore) RequestFile ¶
func (c *LibP2pCore) RequestFile(fileID storage.FileHash) ([]byte, error)
func (*LibP2pCore) SetDefaultStreamHandlers ¶
func (c *LibP2pCore) SetDefaultStreamHandlers() error
SetDefaultStreamHandlers initailise p2p lib with defaults function to send and handle datagrams
func (*LibP2pCore) UpdatePeers ¶
func (c *LibP2pCore) UpdatePeers() error
Click to show internal directories.
Click to hide internal directories.