apple

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package apple is the lifecycle behind the C ABI in bridge/apple: an Apple NetworkExtension provider prepares a configuration, applies the returned settings to the system, then starts the engine on the utun descriptor the system gave it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NetworkChanged

func NetworkChanged(h int32)

func Start

func Start(h int32, dev tun.Device, logf logger.Logf) error

Start runs the engine for a prepared handle on dev, which the engine owns from here on. A failed start keeps the handle until Stop.

func Status

func Status(h int32, field string) (string, error)

Status is engine.Status for a running handle: status fields and command requests.

func Stop

func Stop(h int32)

Stop releases a handle in either state.

Types

type Prefix

type Prefix struct {
	Address string `json:"address"`
	Mask    string `json:"mask,omitempty"`
	Bits    int    `json:"bits"`
}

Prefix carries both spellings: IPv4 settings want Mask, IPv6 want Bits.

type Settings

type Settings struct {
	MTU           int      `json:"mtu"`
	IPv4Addresses []Prefix `json:"ipv4Addresses"`
	IPv4Routes    []Prefix `json:"ipv4Routes"`
	IPv6Addresses []Prefix `json:"ipv6Addresses"`
	IPv6Routes    []Prefix `json:"ipv6Routes"`
	// DNSServers and DNSSearch feed NEDNSSettings, which the provider
	// applies system-wide.
	DNSServers []string `json:"dnsServers"`
	DNSSearch  []string `json:"dnsSearch"`
}

Settings is what the provider hands to setTunnelNetworkSettings, split by family the way NEIPv4Settings and NEIPv6Settings take it.

func Prepare

func Prepare(c *config.Config) (int32, *Settings, error)

Prepare returns a handle for Start with the settings the system needs first: the utun descriptor only exists once they are applied. A default route is installed as a route only, with nothing keeping traffic off the underlay while the tunnel is down.

Jump to

Keyboard shortcuts

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