Documentation ¶
Index ¶
- Constants
- Variables
- func AddCmd(cmd *ConfigCmdStruct) error
- func AddExecutor(executor *ConfigExecutorStruct) error
- func AddExecutorButton(name string, button string) error
- func ClearExecutorButtons(name string) error
- func DelCmd(name string) error
- func DelExecutor(name string) error
- func DelExecutorButton(name string, payload string) error
- func GetExecutorButtons(name string) (buttons []string)
- func InitConfig() error
- func SetExecutorSecret(name string, secret string) error
- type ConfigCmdStruct
- type ConfigExecutorStruct
- type ConfigServiceStruct
- type ConfigStruct
Constants ¶
View Source
const DEFAULT_EXECUTOR = "shell"
View Source
const PTY_EXECUTOR = "pty"
Variables ¶
View Source
var ( ConfigData *ConfigStruct ConfigPath string )
View Source
var DefaultExecutorConfig = InternalExecutors[0]
View Source
var InternalExecutors = []*ConfigExecutorStruct{ { Name: DEFAULT_EXECUTOR, Type: "shell", Config: "--ts-oneshot", Internal: true, Global: true, Comment: "The default executor. Exec cmdline using system shell. It's always open and can not be closed.", }, { Name: PTY_EXECUTOR, Type: "shell", Internal: true, Comment: "The system shell pty (pseudo terminal) executor.", }, }
View Source
var PtyExecutorConfig = InternalExecutors[1]
Functions ¶
func AddCmd ¶
func AddCmd(cmd *ConfigCmdStruct) error
func AddExecutor ¶
func AddExecutor(executor *ConfigExecutorStruct) error
func AddExecutorButton ¶
func ClearExecutorButtons ¶
func DelExecutor ¶
func DelExecutorButton ¶
func GetExecutorButtons ¶
func InitConfig ¶
func InitConfig() error
func SetExecutorSecret ¶
Set or update the secret of executor
Types ¶
type ConfigCmdStruct ¶
func GetCmd ¶
func GetCmd(name string) *ConfigCmdStruct
type ConfigExecutorStruct ¶
type ConfigExecutorStruct struct { Name string Type string Config string Secret string Buttons []string // cmdline shortcuts Comment string Internal bool Global bool // one instance can be shared accross all users }
func GetExecutor ¶
func GetExecutor(name string) *ConfigExecutorStruct
func (*ConfigExecutorStruct) Desc ¶
func (ecs *ConfigExecutorStruct) Desc() (desc string)
get a descriptive string of it's type and config combined
type ConfigServiceStruct ¶
type ConfigServiceStruct struct { Name string Hostname string Backend string Headers [][2]string Comment string }
Securely publish intranet (e.g.: 127.0.0.1) service to tg user
func (*ConfigServiceStruct) GetName ¶
func (sc *ConfigServiceStruct) GetName() string
type ConfigStruct ¶
type ConfigStruct struct { ShellExecutor string // by default, use "cmd /C" on windows, "/bin/bash -c" on other platforms. ShellExecutorButtons []string TelegramToken string // tg bot token Cmds []*ConfigCmdStruct Executors []*ConfigExecutorStruct Services []*ConfigServiceStruct Whitelist []int64 // should be same as server's OpenSSH HostKeyAlgorithms. Default values can be found using `man ssh_config`. // Note it's not same as `ssh -Q HostKeyAlgorithms`, // which outputs all available algorithms, not actual used algorithms. SshHostKeyAlgorithms []string ServicesPort int ServicesAddr string // 0.0.0.0 ServicesPublicPort int ServicesHttps bool Secret string }
func (*ConfigStruct) ResetSecret ¶
func (cs *ConfigStruct) ResetSecret() error
Click to show internal directories.
Click to hide internal directories.