Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateWireGuardKeys() (wgtypes.Key, wgtypes.Key, error)
- func GetAuthSession() (string, error)
- func GetBaseURL() (string, error)
- func GetConfigFolder() (configFolder string, err error)
- func GetCookieString(options ...fn.Option) (string, error)
- func GetUserHomeDir() (string, error)
- func OnlyInsideBox(cmd *cobra.Command)
- func OnlyOutsideBox(cmd *cobra.Command)
- func ReadFile(name string) ([]byte, error)
- func SaveAuthSession(session string) error
- func SaveBaseURL(url string) error
- func SaveExtraData(extraData *ExtraData) error
- type CSType
- type DeviceContext
- type Env
- type EnvType
- type EnvVars
- type ExtraData
- type FileClient
- type FileEntry
- type InfraContext
- type InfraContexts
- type InstallCommand
- type InstallHelmValues
- type K3sTracker
- type KLFileType
- type Keys
- type MainContext
- type Mount
- type Mounts
- type NormalEnv
- type Port
- type ResEnvType
- type ResType
- type Session
- type TeamClusterConfig
- type TeamVpnConfig
- type WGConfig
Constants ¶
View Source
const ( SessionFileName string = "kl-session.yaml" ExtraDataFileName string = "kl-extra-data.yaml" CompleteFileName string = "kl-completion" DeviceFileName string = "kl-device.yaml" WGConfigFileName string = "kl-wg.yaml" WorkspaceWireguardConfigFileName string = "kl-workspace-wg.conf" K3sTrackerFileName = "k3s-status.json" KLWGProxyIp = "198.18.0.1" KLHostIp = "198.18.0.2" KLWorkspaceIp = "198.18.0.3" KLWGAllowedIp = "100.64.0.0/10" LocalHostIP = "127.0.0.1" )
View Source
const ( Res_config resType = "config" Res_secret resType = "secret" Res_mres resType = "mres" )
Variables ¶
View Source
var NoEnvSelected = fn.Errorf("no selected environment")
Functions ¶
func GetAuthSession ¶
func GetBaseURL ¶
func GetConfigFolder ¶
func GetUserHomeDir ¶
func OnlyInsideBox ¶
func OnlyOutsideBox ¶
func SaveAuthSession ¶
func SaveBaseURL ¶
func SaveExtraData ¶
Types ¶
type DeviceContext ¶
type EnvType ¶
type EnvType struct {
Key string `json:"key" yaml:"key"`
Value *string `json:"value,omitempty" yaml:"value,omitempty"`
ConfigRef *string `json:"configRef,omitempty" yaml:"configRef,omitempty"`
SecretRef *string `json:"secretRef,omitempty" yaml:"secretRef,omitempty"`
MresRef *string `json:"mresRef,omitempty" yaml:"mresRef,omitempty"`
}
type EnvVars ¶
type EnvVars []EnvType
func (*EnvVars) AddResTypes ¶
func (*EnvVars) GetConfigs ¶
func (*EnvVars) GetSecrets ¶
type ExtraData ¶
type ExtraData struct {
BaseUrl string `json:"baseUrl"`
SelectedTeam string `json:"selectedTeam"`
DnsHostSuffix string `json:"dnsHostSuffix"`
SelectedEnvs map[string]*Env `json:"selectedEnvs"`
LastUpdateCheck time.Time `json:"lastUpdateCheck"`
}
func GetExtraData ¶
type FileClient ¶
type FileClient interface {
GetHostWgConfig() (string, error)
GetWGConfig() (*WGConfig, error)
SetWGConfig(config string) error
CurrentTeamName() (string, error)
Logout() error
GetK3sTracker() (*K3sTracker, error)
GetVpnTeamConfig(team string) (*TeamVpnConfig, error)
SetVpnTeamConfig(team string, config *TeamVpnConfig) error
GetClusterConfig(team string) (*TeamClusterConfig, error)
SetClusterConfig(team string, accClusterConfig *TeamClusterConfig) error
DeleteClusterData(team string) error
GetDevice() (*DeviceContext, error)
SetDevice(device *DeviceContext) error
WriteKLFile(fileObj KLFileType) error
GetKlFile(filePath string) (*KLFileType, error)
SelectEnv(ev Env) error
SelectEnvOnPath(pth string, ev Env) error
EnvOfPath(pth string) (*Env, error)
CurrentEnv() (*Env, error)
}
func New ¶
func New() (FileClient, error)
type InfraContext ¶
type InfraContexts ¶
type InfraContexts struct {
InfraContexts map[string]*InfraContext `json:"infraContexts"`
ActiveContext string `json:"activeContext"`
}
type InstallCommand ¶
type InstallCommand struct {
ChartRepo string `json:"chart-repo"`
ChartVersion string `json:"chart-version"`
CRDsURL string `json:"crds-url"`
HelmValues InstallHelmValues
}
type InstallHelmValues ¶
type K3sTracker ¶
type K3sTracker struct {
Compute bool `json:"compute"`
Gateway bool `json:"gateway"`
WgConnection bool `json:"wgConnection"`
DeviceRouter struct {
IP string `json:"ip"`
Service struct {
Spec struct {
Ports []Port `json:"ports"`
} `json:"spec"`
} `json:"service"`
} `json:"deviceRouter"`
LastCheckedAt string `json:"lastCheckedAt"`
}
type KLFileType ¶
type KLFileType struct {
Version string `json:"version" yaml:"version"`
DefaultEnv string `json:"defaultEnv" yaml:"defaultEnv"`
Packages []string `json:"packages" yaml:"packages"`
EnvVars EnvVars `json:"envVars" yaml:"envVars"`
Mounts Mounts `json:"mounts" yaml:"mounts"`
Ports []int `json:"ports" yaml:"ports"`
// InitScripts []string `json:"initScripts" yaml:"initScripts"`
TeamName string `json:"teamName" yaml:"teamName"`
}
type MainContext ¶
type MainContext struct {
TeamName string `json:"teamName"`
}
type ResEnvType ¶
type ResType ¶
type ResType struct {
Name string `json:"name"`
Env []ResEnvType `json:"env"`
}
type TeamClusterConfig ¶
type TeamClusterConfig struct {
ClusterToken string `json:"clusterToken"`
ClusterName string `json:"cluster"`
InstallCommand InstallCommand
Installed bool
WGConfig WGConfig
Version string
GatewayIP string
ClusterCIDR string
}
func (*TeamClusterConfig) Marshal ¶
func (a *TeamClusterConfig) Marshal() ([]byte, error)
func (*TeamClusterConfig) Unmarshal ¶
func (a *TeamClusterConfig) Unmarshal(b []byte) error
type TeamVpnConfig ¶
type TeamVpnConfig struct {
WGconf string `json:"wg"`
IpAddress string `json:"ip"`
DeviceName string `json:"device"`
}
func (*TeamVpnConfig) Marshal ¶
func (a *TeamVpnConfig) Marshal() ([]byte, error)
func (*TeamVpnConfig) Unmarshal ¶
func (a *TeamVpnConfig) Unmarshal(b []byte) error
Click to show internal directories.
Click to hide internal directories.