Documentation
¶
Overview ¶
adapter.go bridges the WebShell model (Session + host Executor) to the core.Session contract, so a WebShell foothold gets the same Exec/upload/ download surface as SSH and every downstream kit works against it unchanged.
Package session defines an already-established WebShell session and the host-provided executor. This module intentionally ships no default executor: the host must implement the actual command/file operation.
Index ¶
- type CapabilitySession
- func (c *CapabilitySession) Close() error
- func (c *CapabilitySession) Download(ctx context.Context, remote string) (io.ReadCloser, error)
- func (c *CapabilitySession) Exec(ctx context.Context, cmd string, opts core.ExecOpts) (core.Output, error)
- func (c *CapabilitySession) Info() core.SessionInfo
- func (c *CapabilitySession) Upload(ctx context.Context, src io.Reader, remote string) error
- type ExecResult
- type Executor
- type FileOp
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CapabilitySession ¶
CapabilitySession wraps a WebShell Session plus its host Executor into a core.Session.
func (*CapabilitySession) Close ¶
func (c *CapabilitySession) Close() error
Close is a no-op: a WebShell has no connection to tear down.
func (*CapabilitySession) Download ¶
func (c *CapabilitySession) Download(ctx context.Context, remote string) (io.ReadCloser, error)
Download reads a remote path through the WebShell file channel.
func (*CapabilitySession) Exec ¶
func (c *CapabilitySession) Exec(ctx context.Context, cmd string, opts core.ExecOpts) (core.Output, error)
Exec runs a command through the WebShell executor.
func (*CapabilitySession) Info ¶
func (c *CapabilitySession) Info() core.SessionInfo
Info describes the foothold without performing I/O.
type ExecResult ¶
type ExecResult struct {
Output string
HTTPStatus int
TrafficID string
// Encoding declares how Output carries a file body on File reads: "base64"
// when Output is base64 of the file, anything else (including "") when it is
// the file itself. The adapter does not guess, because a plain-text body such
// as "abcdefgh" is also a legal base64 string and sniffing it would silently
// return 6 bytes of garbage instead of the file.
Encoding string
}
type Executor ¶
type Executor interface {
Exec(ctx context.Context, session Session, command string) (*ExecResult, error)
File(ctx context.Context, session Session, op FileOp) (*ExecResult, error)
}
Executor is the host boundary for command/file operations. Implementations must enforce scope, approval and evidence in the host.
type Session ¶
type Session struct {
ID int64
ProjectID int64
URL string
ShellType string
Method string
CmdParam string
PassParam string
Protocol string
ParamChannel string
Encoding string
ProxyURL string
Password string
}
Session is a registered, ready-to-use WebShell. Password handling (sealing, storage) belongs to the host.