libp2p_pubsub

package
v0.0.0-...-2f116a2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const BufferLen = 500

Variables

View Source
var Delayed = true

Functions

func GetLocalhostAddress

func GetLocalhostAddress(h core.Host) string

GetLocalhostAddress is used for getting address of hosts

Types

type Libp2pPubSub

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

func (*Libp2pPubSub) AttackVictim

func (c *Libp2pPubSub) AttackVictim()

AttackVictim adds a node to the set of indefinite-delayed nodes.

func (*Libp2pPubSub) Broadcast

func (c *Libp2pPubSub) Broadcast(msgBytes []byte)

Broadcast Uses PubSub publish to broadcast messages to other peers

func (*Libp2pPubSub) BroadcastMsg

func (c *Libp2pPubSub) BroadcastMsg(msg model.Message)

func (*Libp2pPubSub) Cancel

func (c *Libp2pPubSub) Cancel(cancelTime int, reconnectTime int)

Cancel unsubscribes a node from pubsub

func (*Libp2pPubSub) CreatePeer

func (c *Libp2pPubSub) CreatePeer(nodeId int, port int) *core.Host

createPeer creates a peer on localhost and configures it to use libp2p.

func (*Libp2pPubSub) CreatePeerWithIp

func (c *Libp2pPubSub) CreatePeerWithIp(nodeId int, ip string, port int) *core.Host

CreatePeerWithIp creates a peer on specified ip and port and configures it to use libp2p.

func (*Libp2pPubSub) Disconnect

func (c *Libp2pPubSub) Disconnect()

func (*Libp2pPubSub) InitializePubSub

func (c *Libp2pPubSub) InitializePubSub(h core.Host)

initializePubSub creates a PubSub for the peer and also subscribes to a topic

func (*Libp2pPubSub) InitializeVictim

func (c *Libp2pPubSub) InitializeVictim(makeBuffer bool)

InitializeVictim initializes buffer for keeping messages when a node is attacked by adversary.

func (*Libp2pPubSub) JoinGroup

func (c *Libp2pPubSub) JoinGroup(group []int)

JoinGroup adds nodes within the same groups to the node's group variable.

func (*Libp2pPubSub) Receive

func (c *Libp2pPubSub) Receive() *[]byte

Receive gets message from PubSub in a blocking way

func (*Libp2pPubSub) Reconnect

func (c *Libp2pPubSub) Reconnect(topic string)

func (*Libp2pPubSub) ReleaseVictim

func (c *Libp2pPubSub) ReleaseVictim()

ReleaseVictim removes the node from set of delayed nodes.

func (*Libp2pPubSub) Send

func (c *Libp2pPubSub) Send(msgBytes []byte, id int)

Send uses Broadcast for sending messages

Jump to

Keyboard shortcuts

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