inet256d

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAPIEndpoint = "http://127.0.0.1:2560"

Variables

This section is empty.

Functions

func ListNetworks

func ListNetworks() (ret []string)

func SaveConfig added in v0.0.3

func SaveConfig(config Config, p string) error

Types

type AdminClient added in v0.0.6

type AdminClient interface {
	GetStatus(ctx context.Context) (*StatusRes, error)
}

func NewAdminClient added in v0.0.6

func NewAdminClient(endpoint string) (AdminClient, error)

type AutoPeeringSpec

type AutoPeeringSpec struct {
}

type CellDiscoverySpec

type CellDiscoverySpec struct {
	Token  string        `yaml:"token"`
	Period time.Duration `yaml:"period,omitempty"`
}

type CentralDiscoverySpec added in v0.0.3

type CentralDiscoverySpec struct {
	Endpoint string        `yaml:"endpoint"`
	Period   time.Duration `yaml:"period,omitempty"`
}

type Config

type Config struct {
	PrivateKeyPath string          `yaml:"private_key_path"`
	APIEndpoint    string          `yaml:"api_endpoint"`
	Network        NetworkSpec     `yaml:"network"`
	Transports     []TransportSpec `yaml:"transports"`
	Peers          []PeerSpec      `yaml:"peers"`

	Discovery   []DiscoverySpec   `yaml:"discovery"`
	AutoPeering []AutoPeeringSpec `yaml:"autopeering"`
}

func DefaultConfig

func DefaultConfig() Config

func LoadConfig

func LoadConfig(p string) (*Config, error)

func (Config) GetAPIAddr

func (c Config) GetAPIAddr() string

type Daemon

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

func New

func New(p Params) *Daemon

func (*Daemon) DoWithServer

func (d *Daemon) DoWithServer(ctx context.Context, cb func(s *mesh256.Server) error) error

func (*Daemon) Run

func (d *Daemon) Run(ctx context.Context) error

Run runs the daemon. Logs are written to the slog.Logger in the context.

type DiscoverySpec

type DiscoverySpec struct {
	Cell    *CellDiscoverySpec    `yaml:"cell,omitempty"`
	Local   *LocalDiscoverySpec   `yaml:"local,omitempty"`
	Central *CentralDiscoverySpec `yaml:"central,omitempty"`
}

type EthernetTransportSpec

type EthernetTransportSpec string

type LocalDiscoverySpec

type LocalDiscoverySpec struct {
	MulticastAddr string `yaml:"multicast_addr"`
}

type NetworkSpec

type NetworkSpec struct {
	BeaconNet *struct{} `yaml:"beaconnet,omitempty"`
	OneHop    *struct{} `yaml:"onehop,omitempty"`
}

func DefaultNetwork added in v0.0.3

func DefaultNetwork() NetworkSpec

type Params

type Params struct {
	MainNodeParams      mesh256.Params
	DiscoveryServices   []discovery.Service
	AutoPeeringServices []autopeering.Service
	APIAddr             string
	TransportAddrParser p2p.AddrParser[TransportAddr]
}

func MakeParams

func MakeParams(configPath string, c Config) (*Params, error)

type PeerSpec

type PeerSpec struct {
	ID    inet256.Addr `yaml:"id"`
	Addrs []string     `yaml:"addrs"`
}

type PeerStore added in v0.0.3

type PeerStore = peers.Store[TransportAddr]

type StatusRes added in v0.0.6

type StatusRes struct {
	MainAddr       inet256.Addr         `json:"main_addr"`
	TransportAddrs []string             `json:"transport_addrs"`
	Peers          []mesh256.PeerStatus `json:"peers"`
}

type TransportAddr added in v0.0.3

type TransportAddr = mesh256.TransportAddr

type TransportSpec

type TransportSpec struct {
	UDP      *UDPTransportSpec      `yaml:"udp,omitempty"`
	Ethernet *EthernetTransportSpec `yaml:"ethernet,omitempty"`
}

type UDPTransportSpec

type UDPTransportSpec string

Jump to

Keyboard shortcuts

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