Documentation
¶
Index ¶
- func AddHostToKnownHosts(ip string, knownHostsPath string) error
- type SSHClient
- type ServerOption
- type ServerStruct
- func (s *ServerStruct) BasicCaddySetup(ctx context.Context, serverName string, stream io.Writer) error
- func (s *ServerStruct) CloseSSHConnection() error
- func (s *ServerStruct) DownloadFile(ctx context.Context, serverName, remotePath, localPath string) error
- func (s *ServerStruct) ExecuteCommand(ctx context.Context, serverName, command string, stream io.Writer) (string, error)
- func (s *ServerStruct) GetDeploymentServer() (string, error)
- func (s *ServerStruct) GetServerStatus(serverName string, stream io.Writer) (string, error)
- func (s *ServerStruct) ListServers() []string
- func (s *ServerStruct) PingServer(serverName string) error
- func (s *ServerStruct) Reconnect(serverName string) error
- func (s *ServerStruct) UploadFile(ctx context.Context, serverName, localPath, remotePath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHostToKnownHosts ¶
Types ¶
type SSHClient ¶
type SSHClient struct {
Client *ssh.Client
Config *ssh.ClientConfig
SFTPClient *sftp.Client
LastUsed time.Time
// contains filtered or unexported fields
}
SSHClient wraps SSH client and related configurations
type ServerOption ¶
type ServerOption func(*ServerStruct) error
ServerOption defines the functional option type
func WithDaemon ¶
func WithDaemon() ServerOption
func WithSSH ¶
func WithSSH() ServerOption
WithSSH initializes SSH connections for all configured servers
type ServerStruct ¶
type ServerStruct struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts ...ServerOption) (*ServerStruct, error)
New creates a new ServerStruct with provided options
func (*ServerStruct) BasicCaddySetup ¶
func (*ServerStruct) CloseSSHConnection ¶
func (s *ServerStruct) CloseSSHConnection() error
CloseSSHConnections closes all active SSH connections
func (*ServerStruct) DownloadFile ¶
func (s *ServerStruct) DownloadFile(ctx context.Context, serverName, remotePath, localPath string) error
DownloadFile downloads a file from the remote server using SFTP
func (*ServerStruct) ExecuteCommand ¶
func (s *ServerStruct) ExecuteCommand(ctx context.Context, serverName, command string, stream io.Writer) (string, error)
ExecuteCommand runs a command on the specified server with context support and streaming
func (*ServerStruct) GetDeploymentServer ¶
func (s *ServerStruct) GetDeploymentServer() (string, error)
func (*ServerStruct) GetServerStatus ¶
GetServerStatus returns connection status of a server
func (*ServerStruct) ListServers ¶
func (s *ServerStruct) ListServers() []string
ListServers returns a list of configured server names
func (*ServerStruct) PingServer ¶
func (s *ServerStruct) PingServer(serverName string) error
PingServer checks if the server is reachable
func (*ServerStruct) Reconnect ¶
func (s *ServerStruct) Reconnect(serverName string) error
Reconnect re-establishes connection to a server
func (*ServerStruct) UploadFile ¶
func (s *ServerStruct) UploadFile(ctx context.Context, serverName, localPath, remotePath string) error
UploadFile uploads a file to the remote server using SFTP