summaryrefslogtreecommitdiff
path: root/structs.go
blob: 1cf637085954673db4d3655e0558abe16f80b59e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0

package main

import (
	sync "sync"
	"time"

	"go.wit.com/gui"
	"go.wit.com/lib/gadgets"
)

var me *gusconf

// this app's variables
type gusconf struct {
	myGui        *gui.Node     // the base of the gui
	portmaps     *Portmaps     // the portmap window
	portwin      *stdTableWin  // the portwin window
	urlbase      string        // the dns name for the zookeeper
	hostname     string        // my hostname
	pollDelay    time.Duration // how often to report our status
	dog          *time.Ticker  // the watchdog timer
	failcount    int           // how many times we've failed to contact the zookeeper
	failcountmax int           // after this, exit and let systemd restart the daemon
}

type stdTableWin struct {
	sync.Mutex
	win    *gadgets.GenericWindow // the machines gui window
	box    *gui.Node              // the machines gui parent box widget
	TB     *PortmapsTable         // the gui table buffer
	update bool                   // if the window should be updated
}

func (w *stdTableWin) Toggle() {
	if w == nil {
		return
	}
	if w.win == nil {
		return
	}
	w.win.Toggle()
}