- Add Go TUI with bubbletea for WireGuard management - Implement client CRUD operations with QR code generation - Add configuration and validation modules - Install/update scripts for client setup - Update Makefile to build binaries to bin/ directory - Add .gitignore for Go projects
28 lines
655 B
Go
28 lines
655 B
Go
package wireguard
|
|
|
|
import (
|
|
"time"
|
|
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
)
|
|
|
|
// StatusTickMsg is sent when it's time to refresh the status
|
|
type StatusTickMsg struct{}
|
|
|
|
// RefreshStatusMsg is sent when manual refresh is triggered
|
|
type RefreshStatusMsg struct{}
|
|
|
|
// Tick returns a tea.Cmd that will send StatusTickMsg at the specified interval
|
|
func Tick(interval int) tea.Cmd {
|
|
return tea.Tick(time.Duration(interval)*time.Second, func(t time.Time) tea.Msg {
|
|
return StatusTickMsg{}
|
|
})
|
|
}
|
|
|
|
// ManualRefresh returns a tea.Cmd to trigger immediate status refresh
|
|
func ManualRefresh() tea.Cmd {
|
|
return func() tea.Msg {
|
|
return RefreshStatusMsg{}
|
|
}
|
|
}
|