aboutsummaryrefslogtreecommitdiffstats
path: root/c_parse.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2023-12-19 20:20:20 +0100
committerJoe <rbo@gmx.us>2023-12-19 20:20:20 +0100
commitb9a79ec3d1c2dc1b90924477501a4470e57f9c01 (patch)
tree7d49f94f957beecbccc9b97cd91d8a36b647d914 /c_parse.go
parentup (diff)
downloadhardflip-b9a79ec3d1c2dc1b90924477501a4470e57f9c01.tar.gz
hardflip-b9a79ec3d1c2dc1b90924477501a4470e57f9c01.tar.bz2
hardflip-b9a79ec3d1c2dc1b90924477501a4470e57f9c01.tar.xz
hardflip-b9a79ec3d1c2dc1b90924477501a4470e57f9c01.tar.zst
hardflip-b9a79ec3d1c2dc1b90924477501a4470e57f9c01.zip
go
Diffstat (limited to 'c_parse.go')
-rw-r--r--c_parse.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/c_parse.go b/c_parse.go
index 43a270c..b341f7e 100644
--- a/c_parse.go
+++ b/c_parse.go
@@ -48,13 +48,13 @@
package main
import (
- "io/ioutil"
+ "os"
"gopkg.in/yaml.v3"
)
func c_read_yaml_file(file string) *HostNode {
var host HostNode
- yaml_file, err := ioutil.ReadFile(file)
+ yaml_file, err := os.ReadFile(file)
if err != nil {
c_die("error reading file " + file, err)
@@ -75,12 +75,20 @@ func c_read_yaml_file(file string) *HostNode {
if len(host.User) == 0 {
host.User = "root"
}
+ if len(host.Jump) > 0 {
+ if host.JumpPort == 0 {
+ host.JumpPort = 22
+ }
+ if len(host.JumpUser) == 0 {
+ host.JumpUser = "root"
+ }
+ }
} else if host.Type == 1 {
if host.Port == 0 {
host.Port = 3389
}
} else if host.Type > 1 {
- host_type = "Unknown"
+ return nil
}
return &host
}