67 lines
1.8 KiB
Go
67 lines
1.8 KiB
Go
// 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
|
|
events *Events // the event log
|
|
eventswin *stdEventTableWin // the event window
|
|
eventsChanged bool // are there new events?
|
|
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()
|
|
}
|
|
|
|
type stdEventTableWin struct {
|
|
sync.Mutex
|
|
win *gadgets.GenericWindow // the machines gui window
|
|
box *gui.Node // the machines gui parent box widget
|
|
TB *EventsTable // the gui table buffer
|
|
update bool // if the window should be updated
|
|
}
|
|
|
|
func (w *stdEventTableWin) Toggle() {
|
|
if w == nil {
|
|
return
|
|
}
|
|
if w.win == nil {
|
|
return
|
|
}
|
|
w.win.Toggle()
|
|
}
|