commonCommunication

package
v0.0.0-...-41c7706 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinCluster

func JoinCluster(ip string, port int, key string) (Master, Peer, error)

Types

type Master

type Master struct {
	IP    string `json:"ip"`
	Port  int    `json:"port"`
	Info  string `json:"info"`
	Peers []Peer `json:"peers"`
	Puk   string `json:"puk"`
	Prk   string `json:"prk"`
}

func CreateCluster

func CreateCluster(port int, limit int, crypto bool) (Master, error)

func (Master) Broadcast

func (this Master) Broadcast(info string) error

func (Master) CloseCluster

func (this Master) CloseCluster() error

func (Master) FetchPeerList

func (this Master) FetchPeerList() []Peer

func (Master) GetPrivateKey

func (this Master) GetPrivateKey() string

func (Master) GetPublicKey

func (this Master) GetPublicKey() string

func (Master) Listen

func (this Master) Listen() error

func (Master) SendInfoToPeer

func (this Master) SendInfoToPeer(peer Peer, info string) error

type Peer

type Peer struct {
	IP   string `json:"ip"`
	Port int    `json:"port"`
	Info string `json:"info"`
	Key  string `json:"key"`
}

Jump to

Keyboard shortcuts

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