p2p

package
v1.1.1-0...-40efbf4 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFromMap

func NewFromMap(transport api.Transport, node api.Node, p map[string]interface{}) api.Policy

NewFromMap : Makes a new instance of this transport module from a map of arguments (for deserialization support)

Types

type P2P

type P2P struct {
	ListenInterval    int
	AdvertiseInterval int

	AdminMode bool
	ListenURI string

	Transport api.Transport
	Node      api.Node
	// contains filtered or unexported fields
}

P2P - a policy which makes peer-to-peer connections without a priori knowledge of peers

func New

func New(transport api.Transport, listenURI string, node api.Node, adminMode bool,
	listenInterval int, advertiseInterval int) *P2P

New : Returns a new instance of a P2P Connection Policy

func (*P2P) GetTransport

func (s *P2P) GetTransport() api.Transport

GetTransport : Returns the transports associated with this policy

func (*P2P) IsAdvertising

func (s *P2P) IsAdvertising() bool

IsAdvertising - returns true if this policy is advertising

func (*P2P) IsListening

func (s *P2P) IsListening() bool

IsListening - returns true if this policy is listening

func (*P2P) MarshalJSON

func (s *P2P) MarshalJSON() (b []byte, e error)

MarshalJSON : Create a serialied representation of the config of this policy

func (*P2P) RunPolicy

func (s *P2P) RunPolicy() error

RunPolicy : Executes the policy as a goroutine

func (*P2P) Stop

func (s *P2P) Stop()

Stop : Stops a policy

Jump to

Keyboard shortcuts

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