Documentation
¶
Index ¶
- Constants
- Variables
- func IPV4Only(ip net.IP) bool
- type Filter
- type MyceliumInspection
- type MyceliumNamespace
- type MyceliumServer
- func (s *MyceliumServer) Ensure(z *zinit.Client, ns string) error
- func (s *MyceliumServer) InspectMycelium() (inspection MyceliumInspection, err error)
- func (s *MyceliumServer) Reload(z *zinit.Client) error
- func (s *MyceliumServer) Restart(z *zinit.Client) error
- func (s *MyceliumServer) Tun() string
- type NodeConfig
- type Peers
- type Ranges
Constants ¶
View Source
const (
MyListenTCP = 9651
)
View Source
const (
// MyceliumNSInf inside the namespace
MyceliumNSInf = "nmy6"
)
Variables ¶
Functions ¶
Types ¶
type MyceliumInspection ¶
type MyceliumInspection struct {
PublicKey string `json:"publicKey"`
Address net.IP `json:"address"`
}
func (*MyceliumInspection) Gateway ¶
func (m *MyceliumInspection) Gateway() (gw net.IPNet, err error)
Gateway derive the gateway IP from the mycelium IP in the /64 range.
func (*MyceliumInspection) IP ¶
func (m *MyceliumInspection) IP() net.IP
IP return the address in the 400::/7 subnet allocated by mycelium
type MyceliumNamespace ¶
type MyceliumNamespace interface {
Name() string
// IsIPv4Only checks if namespace has NO public ipv6 on any of its interfaces
IsIPv4Only() (bool, error)
// GetIPs return a list of all IPv6 inside this namespace.
GetIPs() ([]net.IPNet, error)
// SetMyIP sets the mycelium ipv6 on the nmy6 iterface.
SetMyIP(ip net.IPNet, gw net.IP) error
}
func NewMyNamespace ¶
func NewMyNamespace(ns string) (MyceliumNamespace, error)
type MyceliumServer ¶
type MyceliumServer struct {
// contains filtered or unexported fields
}
MyceliumServer represent a mycelium server
func EnsureMycelium ¶
func EnsureMycelium(ctx context.Context, privateKey ed25519.PrivateKey, ns MyceliumNamespace) (*MyceliumServer, error)
func NewMyceliumServer ¶
func NewMyceliumServer(cfg *NodeConfig) *MyceliumServer
NewMyceliumServer create a new mycelium Server
func (*MyceliumServer) Ensure ¶
func (s *MyceliumServer) Ensure(z *zinit.Client, ns string) error
Start creates a mycelium zinit service and starts it
func (*MyceliumServer) InspectMycelium ¶
func (s *MyceliumServer) InspectMycelium() (inspection MyceliumInspection, err error)
func (*MyceliumServer) Tun ¶
func (s *MyceliumServer) Tun() string
Tun return the name of the TUN interface created by mycelium
type NodeConfig ¶
type NodeConfig struct {
KeyFile string
TunName string
Peers []string
// contains filtered or unexported fields
}
func GenerateConfig ¶
func GenerateConfig(privateKey ed25519.PrivateKey) (cfg NodeConfig)
GenerateConfig creates a new mycelium configuration
func (*NodeConfig) AssignPeers ¶ added in v1.0.1
func (n *NodeConfig) AssignPeers(ctx context.Context, filter ...Filter) error
Click to show internal directories.
Click to hide internal directories.