resource

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MyceliumSeedDir = "/tmp/network/mycelium"

	HostMyceliumBr = "br-hmy"
)

Variables

This section is empty.

Functions

func Delete

func Delete(name string) error

func SetupMycelium

func SetupMycelium(netNS ns.NetNS, mycelium string, seed []byte) error

Types

type MyceliumInspection

type MyceliumInspection struct {
	PublicKey string `json:"publicKey"`
	Address   net.IP `json:"address"`
}

func InspectMycelium

func InspectMycelium(seed []byte) (inspection MyceliumInspection, err error)

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

func (*MyceliumInspection) IPFor

func (m *MyceliumInspection) IPFor(seed []byte) (ip net.IPNet, gw net.IPNet, err error)

func (*MyceliumInspection) Subnet

func (m *MyceliumInspection) Subnet() (subnet net.IPNet, err error)

Subnet return the 400::/64 subnet allocated by mycelium

type Resource

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

func Create

func Create(name string, master *netlink.Bridge, ndmzIP *net.IPNet, ndmzGwIP *net.IPNet, privateNet *net.IPNet, seed []byte) (*Resource, error)

Create creates a network resource (please check docs) name: is the name of the network resource. The Create function is idempotent which means if the same name is used the function will not recreate the resource. master: Normally the br-ndmz bridge, this is the resource "way out" to the public internet. A `public` interface is created and wired to the master bridge ndmzIP: the IP assigned to the `public` interface. ndmzGwIP: the gw Ip for the resource. Normally this is the ip assigned to the master bridge. privateNet: optional private network range seed: mycelium seed

func Get

func Get(name string) (*Resource, error)

Get return resource handler

func (*Resource) AttachMycelium

func (r *Resource) AttachMycelium(id string, seed []byte) (device localPkg.TapDevice, err error)

func (*Resource) AttachMyceliumZDB

func (r *Resource) AttachMyceliumZDB(id string, zdbNS ns.NetNS) (err error)

func (*Resource) AttachPrivate

func (r *Resource) AttachPrivate(id string, vmIp net.IP) (device localPkg.TapDevice, err error)

func (*Resource) Seed

func (r *Resource) Seed() (seed []byte, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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