config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "latest"

Functions

This section is empty.

Types

type Config

type Config struct {
	// AgentImage is the container image reference to use within Kubernetes
	AgentImage string

	// TargetObject is the target Kubernetes object to proxy access for
	TargetObject runtime.Object
	// Namespace is the namespace of the target Kubernetes object
	Namespace string
	// Container is the name of the container to target within the Kubernetes object
	Container string

	// KeepResources will prevent load balancers and other created resources from being deleted when exiting
	KeepResources bool

	// Wireguard contains wireguard-specific configuration
	Wireguard Wireguard

	// KubernetesClusterDetails contains resolved information about the K8s cluster
	KubernetesClusterDetails kuberneteshelpers.ClusterDetails
}

func NewConfig

func NewConfig() *Config

type Key

type Key struct {
	wgtypes.Key
}

Key wraps wgtypes.Key to allow readable marshal to YAML

func (Key) MarshalText

func (k Key) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface

func (*Key) UnmarshalText

func (k *Key) UnmarshalText(text []byte) (err error)

UnmarshalText implements the TextMarshaler interface

type Wireguard

type Wireguard struct {
	// DirectAccess controls whether to attempt NAT hole-punching or use load balancers to access the target pod
	DirectAccess bool

	// LocalKey always represents the keypair associated with the machine we're connecting from
	LocalKey Key
	// AgentKey represents the keypair associated with the Kubernetes agent we're connecting to
	AgentKey Key

	// LocalAddress represents the local endpoint address for wireguard
	LocalAddress netip.AddrPort

	// OverlayPrefix is the prefix of the overlay network
	OverlayPrefix netip.Prefix

	// LocalOverlayAddress is the proxy address inside the overlay network
	LocalOverlayAddress netip.Addr

	// AgentOverlayAddress is the agent address inside the overlay network
	AgentOverlayAddress netip.Addr

	// AllowedIPs is the set of prefixes allowed to be routed through wireguard
	AllowedIPs []netip.Prefix
}

Wireguard represents configuration needed to set up wireguard in two different contexts: Local and Kubernetes Agent

func NewWireguardConfig

func NewWireguardConfig(options ...WireguardOption) (Wireguard, error)

type WireguardOption

type WireguardOption func(*Wireguard) error

func WithAllowedIPs

func WithAllowedIPs(allowedIPs ...string) WireguardOption

func WithDirectAccess

func WithDirectAccess(directAccess bool) WireguardOption

func WithGeneratedKeypairs

func WithGeneratedKeypairs() WireguardOption

func WithLocalAddress

func WithLocalAddress(address netip.AddrPort) WireguardOption

func WithOverlay

func WithOverlay(overlay, localAddress, agentAddress string) WireguardOption

Jump to

Keyboard shortcuts

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