Documentation ¶
Index ¶
- Constants
- func OptsModule(L *lua.LState) *lua.LTable
- type CmdArgs
- func (args *CmdArgs) Array() []string
- func (args *CmdArgs) ArrayWithCommand(cmd string) []string
- func (args *CmdArgs) ForEach(callback func(string, any))
- func (args *CmdArgs) Get(key string) any
- func (args *CmdArgs) Parse()
- func (args *CmdArgs) ParseOpts(optsConfig *OptConfig, multiCharSingleDash bool) (map[string]any, []string, error)
- type CommandFn
- type Config
- type LoginMessageFn
- type OptConfig
- type PasswordInterceptFn
- type Perm
- type Plugin
- func (p *Plugin) CallPasswordInterceptor(username, password string, ip *net.IP) bool
- func (p *Plugin) Commands() map[string]CommandFn
- func (p *Plugin) GetPath(withMain bool) string
- func (p *Plugin) HasCommandDefined() bool
- func (p *Plugin) HasLoginMessage() bool
- func (p *Plugin) HasPasswordIntercept() bool
- func (p *Plugin) HasPromptFn() bool
- func (p *Plugin) Init(vfs *VFS) error
- func (p *Plugin) SetVFS(vfs *VFS)
- type PluginManager
- type PromptFn
- type Session
- type TermWriteFn
- type User
- type VFS
- type VFSFile
Constants ¶
View Source
const T_ANY = 4
View Source
const T_DIR = 1
View Source
const T_FILE = 2
View Source
const T_SYMLINK = 3
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CmdArgs ¶
type CmdArgs struct { RawArgs string // contains filtered or unexported fields }
func (*CmdArgs) ArrayWithCommand ¶
type Config ¶
type Config struct { CommandCallbacks map[string]CommandFn PasswordInterceptor PasswordInterceptFn PromptFn PromptFn LoginMessageFn LoginMessageFn // contains filtered or unexported fields }
func (*Config) RegisterCommand ¶
func (*Config) RegisterLoginMessage ¶
func (c *Config) RegisterLoginMessage(loginMsgFn LoginMessageFn)
func (*Config) RegisterPasswordIntercept ¶
func (c *Config) RegisterPasswordIntercept(interceptor PasswordInterceptFn)
func (*Config) RegisterPrompt ¶
type LoginMessageFn ¶
type OptConfig ¶
func CreateOptsConfig ¶
func CreateOptsConfig() *OptConfig
type Plugin ¶
type Plugin struct { Path string Dir fs.DirEntry Main fs.DirEntry L *lua.LState Config *Config DB *gorm.DB // contains filtered or unexported fields }
func (*Plugin) CallPasswordInterceptor ¶
func (*Plugin) HasCommandDefined ¶
func (*Plugin) HasLoginMessage ¶
func (*Plugin) HasPasswordIntercept ¶
func (*Plugin) HasPromptFn ¶
type PluginManager ¶
type PluginManager struct { DB *gorm.DB PluginVFS *VFS PromptPlugin PromptFn LoginMessageFn LoginMessageFn // contains filtered or unexported fields }
func (*PluginManager) GetCommand ¶
func (pm *PluginManager) GetCommand(cmd string) (CommandFn, bool)
func (*PluginManager) GetPasswordIntercepts ¶
func (pm *PluginManager) GetPasswordIntercepts() []*Plugin
func (*PluginManager) LoadPlugins ¶
func (pm *PluginManager) LoadPlugins(path string) error
func (*PluginManager) MatchCommand ¶
func (pm *PluginManager) MatchCommand(part string) ([]CommandFn, []string)
type Session ¶
type Session struct { VFS *VFS Term *term.Terminal Manager *PluginManager User *User // contains filtered or unexported fields }
func (*Session) AutoCompleteCallback ¶
type TermWriteFn ¶
type TermWriteFn func(...string)
type VFS ¶
type VFS struct { Root VFSFile `json:"root"` Home string `json:"home"` PWD string `json:"-"` User *User `json:"-"` }
func ReadVFSJSONFile ¶
ReadVFSJSONFile reads the JSON file which contains the the virtual file system model.
type VFSFile ¶
type VFSFile struct { Type int `json:"t"` Name string `json:"n"` Files map[string]VFSFile `json:"f"` Contents string `json:"c"` Mode os.FileMode `json:"m"` Owner string `json:"o"` Group string `json:"g"` ModTime time.Time `json:"mt"` LinkTo string `json:"lt"` NLink int `json:"nl"` CmdFn CommandFn `json:"-"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.