Documentation
¶
Index ¶
- func ServerSystemInfo(c *gin.Context)
- func SftPUpload(c *gin.Context)
- func SftpCat(c *gin.Context)
- func SftpCreate(login SftpLoginModel) (*goSftp.Client, error)
- func SftpDownload(c *gin.Context)
- func SftpLs(c *gin.Context)
- func SftpMkdir(c *gin.Context)
- func SftpRenameEndpoint(c *gin.Context)
- func SftpRm(c *gin.Context)
- func SshRemoteRunCommand(sshClient *ssh.Client, command string) (string, error)
- func WebSocketHandler(w http.ResponseWriter, r *http.Request, checkUserToken func(string) bool, ...)
- type File
- type HardwareInfo
- type Request
- type ServerInfo
- type SftpLoginModel
- type SshLoginModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SftpCreate ¶
func SftpCreate(login SftpLoginModel) (*goSftp.Client, error)
SftpCreate 创建一个sftp连接
func SftpRenameEndpoint ¶
SftpRenameEndpoint sftp的文件或文件夹重命名接口
func SshRemoteRunCommand ¶
SshRemoteRunCommand 通过链接ssh远程执行命令
func WebSocketHandler ¶
func WebSocketHandler(w http.ResponseWriter, r *http.Request, checkUserToken func(string) bool, getServerInfo func(string, int, int) SshLoginModel)
WebSocketHandler 启动一个WS并进行SSH数据交互
Types ¶
type HardwareInfo ¶
type HardwareInfo struct {
Disk string `json:"hi_disk"`
Mem string `json:"hi_mem"`
NetCard string `json:"hi_net_card"`
Cpu string `json:"hi_cpu"`
System string `json:"hi_system"`
Login string `json:"hi_login"`
Ps string `json:"hi_ps"`
Port string `json:"hi_port"`
}
func CreateHardwareInfo ¶
func CreateHardwareInfo(sid string, cols int, rows int) (hi *HardwareInfo, err error)
CreateHardwareInfo 获取对应服务器的运行信息
type Request ¶
type Request struct {
MsgType int `json:"msg_type"` //如果为1进行ssh连接验证为2进行代码执行
Token string `json:"token"` //用户token
ServerID string `json:"server_id"` //wehShell服务器id
Command string `json:"command"` //用户命令
Cols int `json:"cols"` //终端窗口的列数, 可以在创建Terminal指定cols(大概和分辨率的比拟是1:7.5)
Rows int `json:"rows"` //终端窗口的行数, 可以在创建Terminal指定rows(大概和分辨率的比拟是1:18)
}
Request WS数据接受结构体
type ServerInfo ¶
type ServerInfo struct {
mod.Model
Memo string `gorm:"column:memo;size:128;" json:"memo" form:"memo"` // 备注
ServerAddress string `gorm:"column:server_address;size:128;not null;" json:"server_address" form:"server_address"` // 服务器地址
UserName string `gorm:"column:user_name;size:128;not null;" json:"user_name" form:"user_name"` // 登录用户名
SshType int `json:"ssh_type" gorm:"column:ssh_type;default:1" form:"ssh_type"` // 鉴权方式,默认1是password 2是key
Password string `gorm:"column:password;type:char(128);not null;" json:"password" form:"password"` // 登录密码
AliasName string `gorm:"column:alias_name;size:64;" json:"alias_name" form:"alias_name"` // 服务器别名
UpdateUser string `json:"update_user" gorm:"comment:'更新人'"` // 更新人
}
ServerInfo 服务器信息
func (ServerInfo) GetShellList ¶
func (ServerInfo) GetShellList(c *gin.Context)
GetShellList 查看服务器列表
type SftpLoginModel ¶
type SftpLoginModel struct {
SshType int
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.