aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/c_exec.go16
-rw-r--r--src/c_lhosts.go14
-rw-r--r--src/c_parse.go10
-rw-r--r--src/i_info.go14
4 files changed, 29 insertions, 25 deletions
diff --git a/src/c_exec.go b/src/c_exec.go
index 7bfcbc9..46b9939 100644
--- a/src/c_exec.go
+++ b/src/c_exec.go
@@ -71,18 +71,18 @@ func c_exec_cmd(cmd_fmt []string) {
func c_format_ssh_jump(host *HostNode) string {
jump_fmt := "-oProxyCommand=ssh"
- if len(host.JumpPriv) > 0 {
- jump_fmt += " -i " + host.JumpPriv
+ if len(host.Jump.Priv) > 0 {
+ jump_fmt += " -i " + host.Jump.Priv
}
- if host.JumpPort != 0 {
- jump_fmt += " -p " + strconv.Itoa(int(host.JumpPort))
+ if host.Jump.Port != 0 {
+ jump_fmt += " -p " + strconv.Itoa(int(host.Jump.Port))
}
- if len(host.JumpUser) == 0 {
+ if len(host.Jump.User) == 0 {
jump_fmt += " root"
} else {
- jump_fmt += " " + host.JumpUser
+ jump_fmt += " " + host.Jump.User
}
- jump_fmt += "@" + host.Jump + " -W %h:%p"
+ jump_fmt += "@" + host.Jump.Host + " -W %h:%p"
return jump_fmt
}
@@ -96,7 +96,7 @@ func c_format_ssh(host *HostNode, pass string) []string {
if len(host.Priv) > 0 {
cmd_fmt = append(cmd_fmt, "-i", host.Priv)
}
- if len(host.Jump) > 0 {
+ if len(host.Jump.Host) > 0 {
cmd_fmt = append(cmd_fmt, c_format_ssh_jump(host))
}
if host.Port != 0 {
diff --git a/src/c_lhosts.go b/src/c_lhosts.go
index e0ad58c..529b7d5 100644
--- a/src/c_lhosts.go
+++ b/src/c_lhosts.go
@@ -51,6 +51,14 @@
package main
+type JumpSettings struct {
+ Host string `yaml:"host"`
+ Port uint16 `yaml:"port"`
+ User string `yaml:"user"`
+ Pass string `yaml:"pass"`
+ Priv string `yaml:"priv"`
+}
+
// 0: ssh
// 1: rdp
type HostNode struct {
@@ -61,11 +69,7 @@ type HostNode struct {
User string `yaml:"user"`
Pass string `yaml:"pass"`
Priv string `yaml:"priv"`
- Jump string `yaml:"jump"`
- JumpPort uint16 `yaml:"jump_port"`
- JumpUser string `yaml:"jump_user"`
- JumpPass string `yaml:"jump_pass"`
- JumpPriv string `yaml:"jump_priv"`
+ Jump JumpSettings `yaml:"jump"`
Quality uint8 `yaml:"quality"`
Domain string `yaml:"domain"`
Width uint16 `yaml:"width"`
diff --git a/src/c_parse.go b/src/c_parse.go
index a032381..3f71f99 100644
--- a/src/c_parse.go
+++ b/src/c_parse.go
@@ -94,12 +94,12 @@ func c_read_yaml_file(file string, ui *HardUI) (*HostNode, error) {
if len(host.User) == 0 {
host.User = "root"
}
- if len(host.Jump) > 0 {
- if host.JumpPort == 0 {
- host.JumpPort = 22
+ if len(host.Jump.Host) > 0 {
+ if host.Jump.Port == 0 {
+ host.Jump.Port = 22
}
- if len(host.JumpUser) == 0 {
- host.JumpUser = "root"
+ if len(host.Jump.User) == 0 {
+ host.Jump.User = "root"
}
}
} else if host.Protocol == 1 {
diff --git a/src/i_info.go b/src/i_info.go
index 41acce7..bed938d 100644
--- a/src/i_info.go
+++ b/src/i_info.go
@@ -189,7 +189,7 @@ func i_info_panel_host(ui HardUI, host *HostNode) {
return
}
// jump
- if host.Protocol == 0 && len(host.Jump) > 0 {
+ if host.Protocol == 0 && len(host.Jump.Host) > 0 {
i_draw_text(ui.s,
(ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line,
ui.style[STYLE_TITLE], "Jump settings: ")
@@ -201,7 +201,7 @@ func i_info_panel_host(ui HardUI, host *HostNode) {
ui.style[STYLE_TITLE], "Host: ")
i_draw_text(ui.s,
(ui.dim[W] / 3) + 10, line, ui.dim[W] - 2, line,
- ui.style[STYLE_DEF], host.Jump)
+ ui.style[STYLE_DEF], host.Jump.Host)
if line += 1; line > ui.dim[H] - 3 {
return
}
@@ -210,7 +210,7 @@ func i_info_panel_host(ui HardUI, host *HostNode) {
ui.style[STYLE_TITLE], "Port: ")
i_draw_text(ui.s,
(ui.dim[W] / 3) + 10, line, ui.dim[W] - 2, line,
- ui.style[STYLE_DEF], strconv.Itoa(int(host.JumpPort)))
+ ui.style[STYLE_DEF], strconv.Itoa(int(host.Jump.Port)))
if line += 1; line > ui.dim[H] - 3 {
return
}
@@ -219,11 +219,11 @@ func i_info_panel_host(ui HardUI, host *HostNode) {
ui.style[STYLE_TITLE], "User: ")
i_draw_text(ui.s,
(ui.dim[W] / 3) + 10, line, ui.dim[W] - 2, line,
- ui.style[STYLE_DEF], host.JumpUser)
+ ui.style[STYLE_DEF], host.Jump.User)
if line += 1; line > ui.dim[H] - 3 {
return
}
- if len(host.JumpPass) > 0 {
+ if len(host.Jump.Pass) > 0 {
i_draw_text(ui.s,
(ui.dim[W] / 3) + 4, line, ui.dim[W] - 2, line,
ui.style[STYLE_TITLE], "Pass: ")
@@ -234,13 +234,13 @@ func i_info_panel_host(ui HardUI, host *HostNode) {
return
}
}
- if host.Protocol == 0 && len(host.JumpPriv) > 0 {
+ if host.Protocol == 0 && len(host.Jump.Priv) > 0 {
i_draw_text(ui.s,
(ui.dim[W] / 3) + 4, line, ui.dim[W] - 2, line,
ui.style[STYLE_TITLE], "Privkey: ")
i_draw_text(ui.s,
(ui.dim[W] / 3) + 13, line, ui.dim[W] - 2, line,
- ui.style[STYLE_DEF], host.JumpPriv)
+ ui.style[STYLE_DEF], host.Jump.Priv)
if line += 1; line > ui.dim[H] - 3 {
return
}