aboutsummaryrefslogtreecommitdiffstats
path: root/c_lhosts.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-01-04 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-01-04 20:20:20 +0100
commitc099d658545476a39855e55bca8ef9c42c9f43a3 (patch)
treee67b7805501c773d4bf34e94030d847ef3ce0376 /c_lhosts.go
parenttryna make it work (diff)
downloadhardflip-c099d658545476a39855e55bca8ef9c42c9f43a3.tar.gz
hardflip-c099d658545476a39855e55bca8ef9c42c9f43a3.tar.bz2
hardflip-c099d658545476a39855e55bca8ef9c42c9f43a3.tar.xz
hardflip-c099d658545476a39855e55bca8ef9c42c9f43a3.tar.zst
hardflip-c099d658545476a39855e55bca8ef9c42c9f43a3.zip
mixed is good
Diffstat (limited to 'c_lhosts.go')
-rw-r--r--c_lhosts.go28
1 files changed, 22 insertions, 6 deletions
diff --git a/c_lhosts.go b/c_lhosts.go
index bd02643..986fd71 100644
--- a/c_lhosts.go
+++ b/c_lhosts.go
@@ -54,7 +54,7 @@ package main
// 0: ssh
// 1: rdp
type HostNode struct {
- ID uint64
+ ID int
Protocol int8 `yaml:"type"`
Name string `yaml:"name"`
Host string `yaml:"host"`
@@ -104,13 +104,13 @@ func (lhost *HostList) add_back(node *HostNode) {
func (lhost *HostList) reset_id() {
curr := lhost.head
for i := 0; curr != nil; i++ {
- curr.ID = uint64(i)
+ curr.ID = i
curr = curr.next
}
}
// removes a host node from the list
-func (lhost *HostList) del(id uint64) {
+func (lhost *HostList) del(id int) {
if lhost.head == nil {
return
}
@@ -128,7 +128,7 @@ func (lhost *HostList) del(id uint64) {
}
// return the list node with the according id
-func (lhost *HostList) sel(id uint64) *HostNode {
+func (lhost *HostList) sel(id int) *HostNode {
curr := lhost.head
if curr == nil {
@@ -143,9 +143,9 @@ func (lhost *HostList) sel(id uint64) *HostNode {
return curr
}
-func (lhost *HostList) count() uint64 {
+func (lhost *HostList) count() int {
curr := lhost.head
- var count uint64
+ var count int
for count = 0; curr != nil; count++ {
curr = curr.next
@@ -156,3 +156,19 @@ func (lhost *HostList) count() uint64 {
func (host *HostNode) is_dir() bool {
return false
}
+
+func (host *HostNode) get_self_dirs() *DirsNode {
+ return nil
+}
+
+func (host *HostNode) get_self_host() *HostNode {
+ return host
+}
+
+func (host *HostNode) protocol_str() string {
+ switch host.Protocol {
+ case 0: return "SSH"
+ case 1: return "RDP"
+ default: return ""
+ }
+}