common

package
v0.0.0-...-b8a1a0e Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TYPE_UPDATE                  = 1
	TYPE_RENEW                   = 2
	TYPE_EXIT                    = 3
	DEVICE_TYPE_KVM_HOST         = "kvm-host"
	DEVICE_TYPE_KVM_VM           = "kvm-vm"
	DEVICE_TYPE_DOCKER_HOST      = "docker-host"
	DEVICE_TYPE_DOCKER_CONTAINER = "docker-container"
	DEVICE_TYPE_PUBLIC_CLOUD     = "public-cloud"
	DEVICE_TYPE_PHYSICAL_MACHINE = "physical-machine"
)

Variables

View Source
var IPRegex = regexp.MustCompile("^\\s+inet6?\\s+([\\d\\.A-Za-z:]+)/(\\d+)\\s+.*scope\\s+(global|link|host)")
View Source
var IfaceRegex = regexp.MustCompile("^(\\d+):\\s+([^@:]+)(@.*)?\\:")
View Source
var MACRegex = regexp.MustCompile("^\\s+link/\\S+\\s+(([\\dA-Za-z]{2}:){5}[\\dA-Za-z]{2}) brd.*$")

Functions

func IPInRanges

func IPInRanges(ip string, ipRanges ...netaddr.IPPrefix) bool

func ParseBrctlShow

func ParseBrctlShow(s string) (map[string][]string, error)

func ParseCSV

func ParseCSV(s string, fields ...string) ([]map[string]string, error)

func ParseCSVWithKey

func ParseCSVWithKey(s, key string, fields ...string) (map[string]map[string]string, error)

func ParseCompressedInfo

func ParseCompressedInfo(cInfo []byte) (bytes.Buffer, error)

func ParseKVString

func ParseKVString(s string) (map[string]string, error)

func ParseVLANConfig

func ParseVLANConfig(s string) (map[string]int, error)

func ParseVMStates

func ParseVMStates(s string) (map[string]int, error)

func ParseYMAL

func ParseYMAL(y string) (prometheusConfig, error)

func Uint64ToMac

func Uint64ToMac(v uint64) net.HardwareAddr

Types

type Iface

type Iface struct {
	Index     int
	PeerIndex int
	MAC       string
	Name      string
	Peer      string
	IPs       []VifInfo
}

func ParseIPOutput

func ParseIPOutput(s string) ([]Iface, error)

type KVMAddress

type KVMAddress struct {
	AddressValue  string `xml:"type,attr"`
	DomainValue   string `xml:"domain,attr"`
	BusValue      string `xml:"bus,attr"`
	SlotValue     string `xml:"slot,attr"`
	FunctionValue string `xml:"function,attr"`
}

type KVMDevices

type KVMDevices struct {
	Interfaces []KVMInterface `xml:"interface"`
}

type KVMDomain

type KVMDomain struct {
	Type     string      `xml:"type,attr"`
	UUID     string      `xml:"uuid"`
	Name     string      `xml:"name"`
	Label    string      `xml:"label"`
	MetaData KVMMetaData `xml:"metadata"`
	Devices  KVMDevices  `xml:"devices"`
}

type KVMDomains

type KVMDomains struct {
	Domains []KVMDomain `xml:"domain"`
}

type KVMInstance

type KVMInstance struct {
	Namespace string   `xml:"xmlns nova,attr"`
	Name      string   `xml:"name"`
	Owner     KVMOwner `xml:"owner"`
}

type KVMInterface

type KVMInterface struct {
	Type    string     `xml:"type,attr"`
	Mac     KVMMac     `xml:"mac"`
	Source  KVMSource  `xml:"source"`
	Target  KVMTarget  `xml:"target"`
	Model   KVMModel   `xml:"model"`
	Address KVMAddress `xml:"address"`
}

type KVMMac

type KVMMac struct {
	Value string `xml:"address,attr"`
}

type KVMMetaData

type KVMMetaData struct {
	Instance KVMInstance `xml:"instance"`
}

type KVMModel

type KVMModel struct {
	Value string `xml:"type,attr"`
}

type KVMOwner

type KVMOwner struct {
	User    KVMUser    `xml:"user"`
	Project KVMProject `xml:"project"`
}

type KVMProject

type KVMProject struct {
	UUID  string `xml:"uuid,attr"`
	Value string `xml:",innerxml"`
}

type KVMSource

type KVMSource struct {
	Value string `xml:"bridge,attr"`
}

type KVMTarget

type KVMTarget struct {
	Value string `xml:"dev,attr"`
}

type KVMUser

type KVMUser struct {
	UUID  string `xml:"uuid,attr"`
	Value string `xml:",innerxml"`
}

type VifInfo

type VifInfo struct {
	MaskLen uint32
	Address string
	Scope   string
}

type XMLInterface

type XMLInterface struct {
	Mac    string
	Target string
}

type XMLVM

type XMLVM struct {
	UUID       string
	Name       string
	Label      string
	VPC        XMLVPC
	Interfaces []XMLInterface
}

func ParseVMXml

func ParseVMXml(s string) ([]XMLVM, error)

type XMLVPC

type XMLVPC struct {
	UUID string
	Name string
}

Jump to

Keyboard shortcuts

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