netexport

package
v0.0.0-...-b79a0d8 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package netexport reads network config data from windows. The package github.com/purecloudlabs/gprovision/pkg/netexport can then be used to writes config files compatible with systemd-networkd.

Requires Powershell, SaveRestore.ps1 (Intel). Some data is retrieved from the registry, while other data comes from the output of SaveRestore.ps1 or raw powershell commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PersistentDNS

func PersistentDNS(_ string) (_ string)

func PersistentIPs

func PersistentIPs(_ string) (_ []inet.IPNet, _ dhcp46)

Types

type IfMap

type IfMap map[int]*WinNic

func NewIfMap

func NewIfMap() IfMap

func (IfMap) GetAddrs

func (ifmap IfMap) GetAddrs() (err error)

get ipv4 and ipv6 addresses for interfaces return comma-separated list of interfaces we care about - these are for use with powershell

func (IfMap) Merge

func (ifaces IfMap) Merge(intelData IntelMap)

func (IfMap) ToJson

func (i IfMap) ToJson() (encoded []byte, err error)

func (IfMap) VlanChildren

func (ifaces IfMap) VlanChildren(iface *WinNic) (vlans []uint64)

type IntelMap

type IntelMap map[string]*WinNic

func GetIntelData

func GetIntelData() (IntelMap, error)

func NewIntelMap

func NewIntelMap() IntelMap

type Route

type Route struct {
	Destination inet.IPNet
	Gateway     net.IP
	Metric      int
}

func (Route) MarshalJSON

func (r Route) MarshalJSON() ([]byte, error)

type RouteList

type RouteList []Route

type StringyMac

type StringyMac struct {
	net.HardwareAddr
}

wrapper to ensure the MAC gets converted to a JSON string correctly

func (StringyMac) MarshalJSON

func (m StringyMac) MarshalJSON() ([]byte, error)

func (*StringyMac) UnmarshalJSON

func (m *StringyMac) UnmarshalJSON(data []byte) error

type WinNic

type WinNic struct {
	FriendlyName    string //e.g. "Port 1 (WAN)", "Port 2 - VLAN 58"
	Mac             StringyMac
	WinName         string //"Intel(R) I350 Gigabit Network Connection #2 - VLAN : PureCloud Vlan=58"
	WinIndex        int
	DHCP4           bool
	DHCP6           bool
	IPs             []inet.IPNet
	Routes          RouteList
	NameServers     []net.IP
	HasVLANChildren bool //only true if this is a "real" interface that has vlans configured
	IsVLAN          bool
	VLAN            uint64
}

func (WinNic) MarshalJSON

func (nic WinNic) MarshalJSON() ([]byte, error)

func (WinNic) VlanIfName

func (nic WinNic) VlanIfName(vlan uint64) (ifname string)

Create a unique interface name for a vlan. Avoids `enoN.vlan` as at the point this runs we have no idea what linux will choose for the parent's interface name. Output is like `port1.123`.

Jump to

Keyboard shortcuts

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