Documentation ¶
Index ¶
- Constants
- func EnvKeyEscape(s string) string
- func LookupGroup(id string) (int, error)
- func LookupUser(id string) (int, error)
- func LookupUserStruct(id string) (*user.User, error)
- func NewAgentListener(sess *Session) (net.Listener, string, error)
- func ShellEscape(s string) string
- func Start(configFile string) error
- type Agent
- type Config
- type FunctionConfig
- type IncludeConfig
- type Session
- type SessionManager
Constants ¶
View Source
const (
DefaultAgentPort = 2222
)
Variables ¶
This section is empty.
Functions ¶
func EnvKeyEscape ¶
func LookupGroup ¶
func LookupUser ¶
func NewAgentListener ¶
I borrowed this code from https://github.com/gliderlabs/ssh/blob/47df570d18ad49f77cf66f76bc3fce3e92400768/agent.go#L38 And modify code to remove temporary directory after closing
func ShellEscape ¶
Types ¶
type Agent ¶
type Agent struct { Config *Config Logger *log.Logger SessionManager *SessionManager }
func (*Agent) CreateSandBoxDirIfNotExist ¶
func (*Agent) LookupFunction ¶ added in v0.17.0
func (a *Agent) LookupFunction(name string) *FunctionConfig
func (*Agent) SandboxDir ¶ added in v0.17.0
type Config ¶
type Config struct { LogLevel string `toml:"log_level" json:"log_level"` Addr string `toml:"addr" json:"addr"` AuthorizedKeysFile string `toml:"authorized_keys_file" json:"authorized_keys_file"` AuthorizedKeys []string `toml:"authorized_keys" json:"authorized_keys"` DisableLocalAuth bool `toml:"disable_local_auth" json:"disable_local_auth"` HostKeyFile string `toml:"host_key_file" json:"-"` HostKey string `toml:"host_key" json:"-"` SandboxesDirectory string `toml:"sandboxes_directory" json:"sandboxes_directory"` KeepSandboxes int `toml:"keep_sandboxes" json:"keep_sandboxes"` Environment []string `toml:"environment" json:"environment"` EnvironmentFile string `toml:"environment_file" json:"environment_file"` HotReload bool `toml:"hot_reload" json:"hot_reload"` Functions map[string]*FunctionConfig `toml:"functions" json:"services"` Include *IncludeConfig `toml:"include" json:"include"` // contains filtered or unexported fields }
func (*Config) LoadConfigFile ¶
type FunctionConfig ¶ added in v0.17.0
type FunctionConfig struct { // name Name string `toml:"-" json:"name"` // AuthorizedKeysFile AuthorizedKeysFile *string `toml:"authorized_keys_file" json:"authorized_keys_file"` // AuthorizedKeys AuthorizedKeys []string `toml:"authorized_keys" json:"authorized_keys"` // User User string `toml:"user" json:"user"` // Group Group string `toml:"group" json:"group"` // Entrypoint Entrypoint []string `toml:"entrypoint" json:"entrypoint"` // Command Command []string `toml:"command" json:"command"` // MaxProcesses MaxProcesses int `toml:"max_processes" json:"max_processes"` // Timeout Timeout int64 `toml:"timeout" json:"timeout"` }
type IncludeConfig ¶ added in v0.17.0
type IncludeConfig struct {
Files []string `toml:"files" json:"files"`
}
type Session ¶
type Session struct { ssh.Session ID string Sandbox string Agt *Agent Uid int Gid int UserStruct *user.User ForwardAgentListener net.Listener Fn *FunctionConfig }
func (*Session) JSONPretty ¶
type SessionManager ¶
type SessionManager struct { Agt *Agent Sessions map[string]*Session FnSessions map[string]map[string]*Session // contains filtered or unexported fields }
func NewSessionManager ¶
func NewSessionManager(a *Agent) *SessionManager
func (*SessionManager) HasSession ¶
func (m *SessionManager) HasSession(sessionID string) bool
func (*SessionManager) IsActiveSandbox ¶
func (m *SessionManager) IsActiveSandbox(sandbox string) bool
func (*SessionManager) RemoveOldSandboxes ¶
func (m *SessionManager) RemoveOldSandboxes()
func (*SessionManager) RemoveSession ¶
func (m *SessionManager) RemoveSession(sess *Session)
func (*SessionManager) SetSession ¶
func (m *SessionManager) SetSession(sess *Session) error
Directories ¶
Path | Synopsis |
---|---|
This code is highly inspired by https://github.com/joho/godotenv Copyright (c) 2013 John Barton MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
This code is highly inspired by https://github.com/joho/godotenv Copyright (c) 2013 John Barton MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
Click to show internal directories.
Click to hide internal directories.