core

package
v0.0.0-...-1538d9d Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2021 License: MIT Imports: 13 Imported by: 2

Documentation

Index

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) TestFile

func (c *LibP2pCore) TestFile(file string) error

TODO: TO MODIFY

func (*LibP2pCore) UpdatePeers

func (c *LibP2pCore) UpdatePeers() error

Jump to

Keyboard shortcuts

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