config

package
v2.2.18 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// configmap name
	ConfigMapPodTrafficManager = "kubevpn-traffic-manager"

	// config map keys
	KeyDHCP             = "DHCP"
	KeyDHCP6            = "DHCP6"
	KeyEnvoy            = "ENVOY_CONFIG"
	KeyClusterIPv4POOLS = "IPv4_POOLS"

	// secret keys
	// TLSCertKey is the key for tls certificates in a TLS secret.
	TLSCertKey = "tls_crt"
	// TLSPrivateKeyKey is the key for the private key field in a TLS secret.
	TLSPrivateKeyKey = "tls_key"

	// container name
	ContainerSidecarEnvoyProxy   = "envoy-proxy"
	ContainerSidecarControlPlane = "control-plane"
	ContainerSidecarVPN          = "vpn"
	ContainerSidecarSyncthing    = "syncthing"

	VolumeEnvoyConfig = "envoy-config"
	VolumeSyncthing   = "syncthing"

	DefaultNetDir = "/etc/cni/net.d"

	Proc = "/proc"

	CniNetName = "cni-net-dir-kubevpn"

	// env name
	EnvInboundPodTunIPv4 = "TunIPv4"
	EnvInboundPodTunIPv6 = "TunIPv6"
	EnvPodName           = "POD_NAME"
	EnvPodNamespace      = "POD_NAMESPACE"

	// header name
	HeaderIPv4 = "IPv4"
	HeaderIPv6 = "IPv6"

	KUBECONFIG = "kubeconfig"

	// labels
	ManageBy = konfig.ManagedbyLabelKey

	// pprof port
	PProfPort     = 32345
	SudoPProfPort = 33345
	PProfDir      = "pprof"

	EnvSSHJump = "SSH_JUMP_BY_KUBEVPN"

	// transport mode
	ConfigKubeVPNTransportEngine = "transport-engine"
	// hosts entry key word
	HostsKeyWord = "# Add by KubeVPN"
)
View Source
const (
	HOME   = ".kubevpn"
	Daemon = "daemon"

	SockPath     = "daemon.sock"
	SudoSockPath = "sudo_daemon.sock"

	PidPath     = "daemon.pid"
	SudoPidPath = "sudo_daemon.pid"

	LogFile = "daemon.log"

	KubeVPNRestorePatchKey = "kubevpn-probe-restore-patch"

	ConfigFile = "config.yaml"
)
View Source
const (
	SyncthingDir = "syncthing"

	SyncthingGUIDir = "gui"

	DefaultRemoteDir = "/kubevpn-data"

	// EnvDisableSyncthingLog disable syncthing log, because it can not set output writer, only write os.Stdout or io.Discard
	EnvDisableSyncthingLog = "LOGGER_DISCARD"

	SyncthingAPIKey = "kubevpn"
)
View Source
const (
	SyncthingLocalDeviceID = "BSNCBRY-ZI5HLYC-YH6544V-SQ3IDKT-4JQKING-ZGSW463-UKYEYCA-WO7ZHA3"
	SyncthingLocalCert     = `` /* 794-byte string literal not displayed */

	SyncthingLocalKey = `` /* 288-byte string literal not displayed */

)
View Source
const (
	SyncthingRemoteDeviceID = "OELB2JL-MIOW652-6JPBYPZ-POV3EBV-XEOW2Z2-I45QUGZ-QF5TT4P-Z2AH7AU"
	SyncthingRemoteCert     = `` /* 798-byte string literal not displayed */

	SyncthingRemoteKey = `` /* 288-byte string literal not displayed */

)
View Source
const Slogan = "Now you can access resources in the kubernetes cluster !"

Variables

View Source
var (
	// Image inject --ldflags -X
	Image     = "docker.io/naison/kubevpn:latest"
	Version   = "latest"
	GitCommit = ""

	// GitHubOAuthToken --ldflags -X
	GitHubOAuthToken = ""

	OriginImage = "docker.io/naison/kubevpn:" + Version

	DaemonPath string
	HomePath   string
	PprofPath  string
)
View Source
var (
	CIDR      *net.IPNet
	CIDR6     *net.IPNet
	RouterIP  net.IP
	RouterIP6 net.IP

	// for creating docker network
	DockerCIDR     *net.IPNet
	DockerRouterIP net.IP
)
View Source
var (
	SmallBufferSize  = (1 << 13) - 1 // 8KB small buffer
	MediumBufferSize = (1 << 15) - 1 // 32KB medium buffer
	LargeBufferSize  = (1 << 16) - 1 // 64KB large buffer
)
View Source
var (
	KeepAliveTime    = 180 * time.Second
	DialTimeout      = 15 * time.Second
	HandshakeTimeout = 5 * time.Second
	ConnectTimeout   = 5 * time.Second
	ReadTimeout      = 10 * time.Second
	WriteTimeout     = 10 * time.Second
)
View Source
var Debug bool
View Source
var (
	//	network layer ip needs 20 bytes
	//	transport layer UDP header needs 8 bytes
	//	UDP over TCP header needs 22 bytes
	DefaultMTU = 1500 - 20 - 8 - 21
)
View Source
var (
	LPool = &sync.Pool{
		New: func() interface{} {
			return make([]byte, LargeBufferSize)
		},
	}
)
View Source
var LocalCert tls.Certificate
View Source
var LocalDeviceID protocol.DeviceID
View Source
var RemoteCert tls.Certificate
View Source
var RemoteDeviceID protocol.DeviceID
View Source
var SPool = sync.Pool{
	New: func() any {
		return make([]byte, 2)
	},
}

Functions

func GetConfigFilePath added in v2.2.11

func GetConfigFilePath() string

func GetPidPath added in v2.2.11

func GetPidPath(isSudo bool) string

func GetSockPath added in v2.2.11

func GetSockPath(isSudo bool) string

func GetSyncthingGUIPath added in v2.2.11

func GetSyncthingGUIPath() string

func GetSyncthingPath added in v2.2.11

func GetSyncthingPath() string

Types

type Engine

type Engine string
const (
	EngineGvisor Engine = "gvisor"
	EngineMix    Engine = "mix"
	EngineRaw    Engine = "raw"
)

Jump to

Keyboard shortcuts

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