devicenetwork

package
v0.0.0-...-a6598b8 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DhcpcdResolvConfDir : directory where dhcpcd stores resolv.conf
	// files separately for every interface (named <interface>.dhcp).
	DhcpcdResolvConfDir = "/run/dhcpcd/resolv.conf"
	// WwanResolvConfDir : directory where wwan microservice stores resolv.conf
	// files separately for every interface (named <interface>.dhcp).
	WwanResolvConfDir = "/run/wwan/resolv.conf"
)
View Source
const (
	// DPCBaseRTIndex : base index for per-port routing tables used for device
	// connectivity (between EVE and remote endpoints, such as the controller),
	// i.e. used for DevicePortConfig (abbreviated to DPC).
	// Routing table ID is a sum of the base with the interface index of the corresponding
	// physical interface.
	DPCBaseRTIndex = 500

	// NIBaseRTIndex : base index for per-NI (network instance) routing tables used
	// for uplink connectivity (between applications and remote endpoints).
	// Routing table ID is a sum of the base with the "bridge number" allocated
	// (and persisted) for every network instance.
	NIBaseRTIndex = 800

	// PbrLocalDestPrio : IP rule priority for packets destined to locally owned addresses
	PbrLocalDestPrio = 12000
	// PbrLocalOrigPrio : IP rule priority for locally generated packets
	PbrLocalOrigPrio = 15000

	// PbrNatOutGatewayPrio : IP rule priority for packets destined to gateway(bridge ip) coming from apps.
	PbrNatOutGatewayPrio = 9999
	// PbrNatOutPrio : IP rule priority for packets destined to internet coming from apps
	PbrNatOutPrio = 10000
	// PbrNatInPrio : IP rule priority for external packets coming in towards apps
	PbrNatInPrio = 11000
)
View Source
const (
	// WpaFilename : path to WiFi wpa_supplicant file.
	WpaFilename = "/run/wlan/wpa_supplicant.conf"
	// RunWlanDir : directory for WLAN-related configuration.
	RunWlanDir = "/run/wlan"
	// WpaTempname : name used for a temporary wpa_supplicant file.
	WpaTempname = "wpa_supplicant.temp"
)
View Source
const (
	// DNSMaxParallelRequests is the maximum amount of parallel DNS requests
	DNSMaxParallelRequests = 5
)

Variables

View Source
var DnsmasqLeaseDir = "/run/zedrouter/dnsmasq.leases/"

DnsmasqLeaseDir is a directory with files (one per NI bridge) storing IP leases granted to applications by dnsmasq.

ResolveConfDirs : directories where resolv.conf for an interface could be found.

Functions

func CheckAndGetNetworkProxy

func CheckAndGetNetworkProxy(log *base.LogObject, dns *types.DeviceNetworkStatus,
	ifname string, metrics *zedcloud.AgentMetrics) error

Download a wpad file if so configured

func DnsmasqLeaseFilePath

func DnsmasqLeaseFilePath(bridgeIfName string) string

DnsmasqLeaseFilePath returns the path to a file with IP leases granted to applications connected to a given bridge.

func IfnameToResolvConf

func IfnameToResolvConf(ifname string) string

IfnameToResolvConf : Look for a file created by dhcpcd

func IsExplicitProxyConfigured

func IsExplicitProxyConfigured(proxyConfig types.ProxyConfig) bool

IsExplicitProxyConfigured returns true if EVE is explicitly configured to route traffic via a proxy for a given uplink interface.

func IsProxyConfigEmpty

func IsProxyConfigEmpty(proxyConfig types.ProxyConfig) bool

func ResolvConfToIfname

func ResolvConfToIfname(resolvConf string) string

ResolvConfToIfname : Returns the name of the interface for which the given resolv.conf file was created.

Types

type DNSResponse

type DNSResponse struct {
	IP  net.IP
	TTL uint32
}

DNSResponse represents a response from a DNS server (A Record)

func ResolveWithPortsLambda

func ResolveWithPortsLambda(domain string,
	dns types.DeviceNetworkStatus,
	resolve func(string, net.IP, net.IP) ([]DNSResponse, error)) ([]DNSResponse, []error)

ResolveWithPortsLambda resolves a domain by using source IPs and dns servers from DeviceNetworkStatus As a resolver func ResolveWithSrcIP can be used

func ResolveWithSrcIP

func ResolveWithSrcIP(domain string, dnsServerIP net.IP, srcIP net.IP) ([]DNSResponse, error)

ResolveWithSrcIP resolves a domain with a given dns server and source Ip

Jump to

Keyboard shortcuts

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