config

package
v0.0.0-...-1ff2046 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort         = "22"
	DefaultIdentityFile = "~/.ssh/id_rsa"
	DefaultAllowedIP    = "0.0.0.0/0"
	DefaultTimeout      = 15 * time.Second
)

Variables

This section is empty.

Functions

func EncodeBase64ToHex

func EncodeBase64ToHex(key string) (string, error)

EncodeBase64ToHex encodes a base64 string to a hex string as required by WireGuard

Types

type ConfigType

type ConfigType int
const (
	ConfigTypeWireGuard ConfigType = iota
	ConfigTypeTailscale
	ConfigTypeDirect
)

type SshConfig

type SshConfig struct {
	// SSH settings
	User         string        // SSH user
	HostName     string        // SSH host to connect to
	Port         string        // SSH port to connect to
	IdentityFile string        // Path to SSH identity file
	HostKey      ssh.PublicKey // SSH host key
	LocalForward string        // Local forward
	Timeout      time.Duration // SSH connection timeout
}

type TailscaleConfig

type TailscaleConfig struct {
	// Tailscale settings
	AuthKey string // Tailscale auth key
}

type WireSshConfig

type WireSshConfig struct {
	Type            ConfigType // Tunnel type
	SshConfig       SshConfig
	WireguardConfig WireguardConfig
	TailscaleConfig TailscaleConfig
}

WireSshConfig represents the configuration for a WireGuard, Tailscale, or Direct tunnel.

func LoadConfig

func LoadConfig(host, wireSshConfigFile string) (*WireSshConfig, error)

LoadConfig loads and validates the configuration for the given host from the specified config file. Returns a WireSshConfig or an error if loading or validation fails.

type WireguardConfig

type WireguardConfig struct {
	// WireGuard settings
	PrivateKey   string     // WireGuard private key
	PublicKey    string     // WireGuard public key
	PresharedKey string     // WireGuard preshared key
	IPAddress    netip.Addr // WireGuard IP address
	DNSServer    netip.Addr // WireGuard DNS server
	AllowedIP    string     // WireGuard allowed IP
	WGServer     string     // WireGuard server
	WGServerIP   net.IP     // WireGuard server IP
	WGPort       string     // WireGuard port
}

Jump to

Keyboard shortcuts

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