Documentation ¶
Index ¶
- Variables
- func APIOutPut(c *gin.Context, code int64, count int, data interface{}, msg string)
- func BroadcastNotice(data []byte)
- func CacheDelete(c *gin.Context)
- func CacheList(c *gin.Context)
- func CacheSize(c *gin.Context)
- func Delete(ipStr string)
- func DeployedInstallDocker(c *gin.Context)
- func DeployedInstallNginx(c *gin.Context)
- func DeployedRemoveDocker(c *gin.Context)
- func DeployedRemoveNginx(c *gin.Context)
- func DockerImages(c *gin.Context)
- func DockerImagesDeploy(c *gin.Context)
- func DockerInfo(c *gin.Context)
- func DockerPS(c *gin.Context)
- func DockerPause(c *gin.Context)
- func DockerPull(c *gin.Context)
- func DockerReName(c *gin.Context)
- func DockerRestart(c *gin.Context)
- func DockerRm(c *gin.Context)
- func DockerRmi(c *gin.Context)
- func DockerRun(c *gin.Context)
- func DockerState(c *gin.Context)
- func DockerStates(c *gin.Context)
- func DockerStop(c *gin.Context)
- func DockerTop(c *gin.Context)
- func ExecutableConfFile(c *gin.Context)
- func ExecutableConfUpdate(c *gin.Context)
- func ExecutableDelete(c *gin.Context)
- func ExecutableDeploy(c *gin.Context)
- func ExecutableDir(c *gin.Context)
- func ExecutableDownload(c *gin.Context)
- func ExecutableKill(c *gin.Context)
- func ExecutableList(c *gin.Context)
- func ExecutableRunList(c *gin.Context)
- func ExecutableRunLog(c *gin.Context)
- func ExecutableRunState(c *gin.Context)
- func ExecutableTaskDelete(c *gin.Context)
- func ExecutableTaskLog(c *gin.Context)
- func ExecutableTaskPIDInfo(c *gin.Context)
- func ExecutableTaskRestart(c *gin.Context)
- func ExecutableTaskRun(c *gin.Context)
- func ExecutableUpload(c *gin.Context)
- func ForwardTCPCreate(c *gin.Context)
- func ForwardTCPCutoff(c *gin.Context)
- func ForwardTCPList(c *gin.Context)
- func ForwardTCPRemove(c *gin.Context)
- func ForwardTCPRenew(c *gin.Context)
- func ForwardTCPSwitch(c *gin.Context)
- func ForwardUDPCreate(c *gin.Context)
- func ForwardUDPCutoff(c *gin.Context)
- func ForwardUDPList(c *gin.Context)
- func ForwardUDPRemove(c *gin.Context)
- func ForwardUDPRenew(c *gin.Context)
- func ForwardUDPSwitch(c *gin.Context)
- func GatewayDelete(c *gin.Context)
- func GatewayList(c *gin.Context)
- func GatewayNew(c *gin.Context)
- func GatewayRun(c *gin.Context)
- func GatewayUpdatePort(c *gin.Context)
- func GetIP(r *http.Request) (ip string)
- func GetTaskState(c *gin.Context)
- func HaveDocker(c *gin.Context)
- func Login(c *gin.Context)
- func LoginIPLoad(ipStr string) int
- func LoginIPStore(ipStr string, times int)
- func MonitorAlarmDel(c *gin.Context)
- func MonitorAlarmList(c *gin.Context)
- func MonitorData(c *gin.Context)
- func MonitorRuleCreate(c *gin.Context)
- func MonitorRuleList(c *gin.Context)
- func MonitorSlave(c *gin.Context)
- func NewDockerPullTaskMap() *dockerPullTaskMap
- func NewDockerRunTaskMap() *dockerRunTaskMap
- func NewSshClient() (*ssh.Client, error)
- func NewTerminal(user string, pass string, addr string)
- func OperateDelete(c *gin.Context)
- func OperateList(c *gin.Context)
- func PGCache(c *gin.Context)
- func PGContainerLog(c *gin.Context)
- func PGContainerMonitor(c *gin.Context)
- func PGDir(c *gin.Context)
- func PGDockerManage(c *gin.Context)
- func PGEnvDeployed(c *gin.Context)
- func PGExecutableDir(c *gin.Context)
- func PGExecutableLog(c *gin.Context)
- func PGExecutableManage(c *gin.Context)
- func PGForward(c *gin.Context)
- func PGGateway(c *gin.Context)
- func PGIndex(c *gin.Context)
- func PGLogin(c *gin.Context)
- func PGMonitor(c *gin.Context)
- func PGNginx(c *gin.Context)
- func PGProjectContainer(c *gin.Context)
- func PGProjectExecutable(c *gin.Context)
- func PGProjectManage(c *gin.Context)
- func PGSSH(c *gin.Context)
- func PGSlave(c *gin.Context)
- func PGSlaveEnv(c *gin.Context)
- func PGSlavePort(c *gin.Context)
- func PGSlaveProcess(c *gin.Context)
- func PGSlaveSelect(c *gin.Context)
- func PGTaskPage(c *gin.Context)
- func ProjectDockerContainer(c *gin.Context)
- func ProjectDockerContainerIps(c *gin.Context)
- func ProjectDockerCreate(c *gin.Context)
- func ProjectDockerList(c *gin.Context)
- func ProjectDockerRun(c *gin.Context)
- func ProjectDockerUpdate(c *gin.Context)
- func ProjectDockerUpdateDuplicate(c *gin.Context)
- func ProjectDockerUpdateImage(c *gin.Context)
- func ProjectExecutableCreate(c *gin.Context)
- func ProjectExecutableDownload(c *gin.Context)
- func ProjectExecutableList(c *gin.Context)
- func ProjectExecutableRun(c *gin.Context)
- func ProjectExecutableTaskList(c *gin.Context)
- func ProxyHttpContinue(c *gin.Context)
- func ProxyHttpCreate(c *gin.Context)
- func ProxyHttpList(c *gin.Context)
- func ProxyHttpRemove(c *gin.Context)
- func ProxyHttpStop(c *gin.Context)
- func ProxySSHCreate(c *gin.Context)
- func ProxySSHList(c *gin.Context)
- func ProxySSHRemove(c *gin.Context)
- func ProxySocket5Continue(c *gin.Context)
- func ProxySocket5Create(c *gin.Context)
- func ProxySocket5List(c *gin.Context)
- func ProxySocket5Remove(c *gin.Context)
- func ProxySocket5Stop(c *gin.Context)
- func Register(c *gin.Context)
- func SSH2(c *gin.Context)
- func SSHClient(user string, pass string, addr string) (*ssh.Client, error)
- func SlaveDir(c *gin.Context)
- func SlaveDiskInfo(c *gin.Context)
- func SlaveENVList(c *gin.Context)
- func SlaveHosts(c *gin.Context)
- func SlaveHostsUpdate(c *gin.Context)
- func SlaveInfo(c *gin.Context)
- func SlaveList(c *gin.Context)
- func SlavePathInfo(c *gin.Context)
- func SlavePortInfo(c *gin.Context)
- func SlaveProcessInfo(c *gin.Context)
- func SlaveProcessKill(c *gin.Context)
- func SlaveProcessList(c *gin.Context)
- func TaskDelete(c *gin.Context)
- func TaskList(c *gin.Context)
- func TestDockerState(c *gin.Context)
- func TestNotice(c *gin.Context)
- func UDPSend(slave string, cmd protocol.CommandCode, data []byte) (string, error)
- func UDPSendOutHttp(c *gin.Context, slave string, cmd protocol.CommandCode, data []byte)
- func WebSocketContainerLog(c *gin.Context)
- func WebSocketExecutableLog(c *gin.Context)
- func WebSocketExecutableLog1(c *gin.Context)
- func WebSocketNotice(c *gin.Context)
- func WebSocketTerminal(c *gin.Context)
- type Body
- type DockerPullTask
- type DockerRunParam
- type DockerRunTask
- type ExecutableConfUpdateParam
- type ExecutableFileStructure
- type ExecutableListOut
- type ImagesDeployParam
- type LogicSshWsSession
- type OutMonitorData
- type OutSlaveList
- type ResponseJson
- type SlaveHostsUpdateParam
- type SshConn
- type WsContext
Constants ¶
This section is empty.
Variables ¶
var DockerRunTaskMap = NewDockerRunTaskMap()
DockerRunTaskMap docker运行任务map
var LoginIP sync.Map
var PageId = utils.IDMd5()
var TaskMap = NewDockerPullTaskMap()
TaskMap 任务 Map
Functions ¶
func DeployedInstallDocker ¶
DeployedInstallDocker 安装docker
func ExecutableRunLog ¶
ExecutableRunLog test case 查看已經執行的可執行文件的日誌
func ExecutableRunState ¶
ExecutableRunState 查看可執行文件任務的狀態 查看是否在運行
func ExecutableTaskDelete ¶
ExecutableTaskDelete 刪除已經執行的可执行文件任務 如果正在執行無法刪除
func ExecutableTaskLog ¶
TODO ExecutableTaskLog 查看可执行文件运行输出的终端打印日志
func ExecutableTaskPIDInfo ¶
ExecutableTaskPIDInfo 查看进程详情 没有执行则无法查看
func ExecutableTaskRestart ¶
ExecutableTaskRestart 重啓已經執行的可执行文件進程
func ExecutableTaskRun ¶
ExecutableTaskRun 启动可执行文件任务 如果已经启动无法再次启动
func GetIP ¶
GetIP 获取ip - X-Real-IP:只包含客户端机器的一个IP,如果为空,某些代理服务器(如Nginx)会填充此header。 - X-Forwarded-For:一系列的IP地址列表,以,分隔,每个经过的代理服务器都会添加一个IP。 - RemoteAddr:包含客户端的真实IP地址。 这是Web服务器从其接收连接并将响应发送到的实际物理IP地址。 但是,如果客户端通过代理连接,它将提供代理的IP地址。
RemoteAddr是最可靠的,但是如果客户端位于代理之后或使用负载平衡器或反向代理服务器时,它将永远不会提供正确的IP地址,因此顺序是先是X-REAL-IP, 然后是X-FORWARDED-FOR,然后是 RemoteAddr。 请注意,恶意用户可以创建伪造的X-REAL-IP和X-FORWARDED-FOR标头。
func Login ¶
Login 保证安全方案 1. 定期更新账号密码 TODO 2. 记录操作 TODO 3. 记录请求 TODO 4. 白名单 TODO 5. 暴力登录检验,一个ip只有五次试错机会,超过拉黑ip master 与 slave 安全方案 1. 非对称加密 TODO
func LoginIPStore ¶
LoginIPStore Store save deviceId and conn
func NewDockerPullTaskMap ¶
func NewDockerPullTaskMap() *dockerPullTaskMap
func NewDockerRunTaskMap ¶
func NewDockerRunTaskMap() *dockerRunTaskMap
func NewSshClient ¶
func ProjectDockerContainerIps ¶
ProjectDockerContainerIps
func ProjectDockerUpdateDuplicate ¶
ProjectDockerUpdateDuplicate 更新副本数量
func ProjectDockerUpdateImage ¶
ProjectDockerUpdateImage 更新项目镜像 并重启
func ProjectExecutableCreate ¶
ProjectExecutableCreate 项目管理 - 二进制物理机部署项目 是可执行文件的扩展,是以项目为单位,可以理解为是以目录为单位 将可执行文件改为压缩的目录, 新增执行命令, 端口守护等 可执行多个副本,均摊部署在不同的salve上 可执行项目 1. 可执行文件 2. 其他文件,如配置,数据等文件 3. 执行命令 4. 环境变量 5. 占用端口
func ProjectExecutableDownload ¶
ProjectExecutableDownload
func ProjectExecutableTaskList ¶
ProjectExecutableTaskList
func ProxySocket5Continue ¶
ProxySocket5Continue 获取http/s代理继续
func UDPSendOutHttp ¶
UDPSendOutHttp
func WebSocketExecutableLog ¶
WebSocketExecutableLog 查看可執行文件運行日誌 方案二
func WebSocketExecutableLog1 ¶
WebSocketExecutableLog1 查看可執行文件運行日誌 方案一
Types ¶
type Body ¶
type Body struct { Count int `json:"count"` Data interface{} `json:"data"` }
Body 具体数据模型
type DockerPullTask ¶
type DockerPullTask struct { IP string Result interface{} State int // 0: 预留, 1: 进行中, 2: 完成, 3: 中断 }
DockerPullTask
type DockerRunParam ¶
type DockerRunParam struct { Image string `json:"image"` ImageUser string `json:"image_user"` ImagePass string `json:"image_pass"` ContainerEnv string `json:"container_env"` ContainerName string `json:"container_name"` ContainerPort string `json:"container_port"` IsAlways bool `json:"is_always"` }
DockerRunParam
type DockerRunTask ¶
func (*DockerRunTask) GetResult ¶
func (d *DockerRunTask) GetResult() *DockerRunTask
type ExecutableConfUpdateParam ¶
type ExecutableConfUpdateParam struct { Name string `json:"name"` ConfName string `json:"conf_name"` NewConf string `json:"new_conf"` }
ExecutableConfUpdateParam 更新可执行文件配置文件实体
type ExecutableFileStructure ¶
ExecutableFileStructure 可执行文件的目录文件结构输出实体
type ExecutableListOut ¶
type ExecutableListOut struct { List []*entity.ExecutableFile Keys []string }
ExecutableListOut 可执行文件列表输出
type ImagesDeployParam ¶
type ImagesDeployParam struct { Slave string `json:"slave"` ImageId string `json:"image_id"` ContainerEnv string `json:"container_env"` ContainerName string `json:"container_name"` ContainerPort string `json:"container_port"` IsAlways bool `json:"is_always"` }
ImagesDeployParam
type LogicSshWsSession ¶
type LogicSshWsSession struct { IsFlagged bool `comment:"当前session是否包含禁止命令"` // contains filtered or unexported fields }
func NewLogicSshWsSession ¶
func (*LogicSshWsSession) LogString ¶
func (sws *LogicSshWsSession) LogString() string
func (*LogicSshWsSession) Start ¶
func (sws *LogicSshWsSession) Start(quitChan chan bool)
func (*LogicSshWsSession) Wait ¶
func (sws *LogicSshWsSession) Wait(quitChan chan bool)
type OutMonitorData ¶
type OutMonitorData struct { Date string CPU float32 MEM int Tx float32 Rx float32 MEMUsage int64 MEMLimit int64 Connect int }
OutMonitorData 输出监控采集的数据
type OutSlaveList ¶
type OutSlaveList struct { Slave string `json:"slave"` Online string `json:"online"` OnlineValue string `json:"online_value"` }
OutSlaveList 输出slave列表
type ResponseJson ¶
type ResponseJson struct { Code int64 `json:"code"` Msg string `json:"msg"` Body interface{} `json:"body"` TimeStamp int64 `json:"timeStamp"` }
ResponseJson 统一接口输出
type SlaveHostsUpdateParam ¶
type SlaveHostsUpdateParam struct { Slave string `json:"slave"` HostsData string `json:"hosts_data"` }
SlaveHostsUpdateParam
type SshConn ¶
type SshConn struct { // calling Write() to write data into ssh server StdinPipe io.WriteCloser // Write() be called to receive data from ssh server ComboOutput *wsBufferWriter Session *ssh.Session }
connect to ssh server using ssh session.
func (*SshConn) ReceiveWsMsg ¶
func (ssConn *SshConn) ReceiveWsMsg(wsConn *websocket.Conn, logBuff *bytes.Buffer, exitCh chan bool)
ReceiveWsMsg receive websocket msg do some handling then write into ssh.session.stdin