networkstate

package
v0.0.0-...-314436a Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Announce

type Announce struct {
	WireguardState WireguardState `json:"wg"`
	AddrInfo       peer.AddrInfo  `json:"ai"`
}

func (*Announce) Marshal

func (a *Announce) Marshal() ([]byte, error)

func (*Announce) Unmarshal

func (a *Announce) Unmarshal(data []byte) error

type Info

type Info struct {
	LastAnnounce Announce
	Addr         string
}

type State

type State struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New() *State

func (*State) OnAnnounce

func (s *State) OnAnnounce(from peer.ID, a Announce)

func (*State) Snapshot

func (s *State) Snapshot() []Info

Snapshot tries to make a copy which is more or less deep

func (*State) UpdateAddrs

func (s *State) UpdateAddrs(addrs map[peer.ID]multiaddr.Multiaddr)

type WireguardState

type WireguardState struct {
	PublicKey    string `json:"pk"`
	SelectedAddr string `json:"ip"`
	Port         int    `json:"port"`
}

func (WireguardState) IsValid

func (ws WireguardState) IsValid() bool

Jump to

Keyboard shortcuts

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