peers

package
v0.0.0-...-4d778f5 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Peer

type Peer struct {
	ID   string `json:"id"`
	Name string `json:"name"`

	Port         int `json:"port"`
	InsecurePort int `json:"insecure_port"`
	UIPort       int `json:"ui_port"`

	KnownPeers *peersList `json:"known_peers"`

	Addrs *addrsList `json:"-"`

	PublicCrt   []byte           `json:"-"`
	Certificate *tls.Certificate `json:"-"`
}

Peer is an instance of the same app.

func New

func New(
	r *rand.Rand,
	port int,
	insecurePort int,
	uiPort int,
	keySize int,
) (*Peer, error)

New is a peer constructor.

func NewBlank

func NewBlank() *Peer

NewBlank returns new empty peer.

func (*Peer) Marshal

func (p *Peer) Marshal() ([]byte, error)

Marshal is a marshal function to use when sending peer info over a network.

func (*Peer) Unmarshal

func (p *Peer) Unmarshal(data []byte) error

Unmarshal is a marshal function to use when sending peer info over a network.

Jump to

Keyboard shortcuts

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