Add WireGuard TUI implementation
- 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
This commit is contained in:
27
internal/wireguard/tea_messages.go
Normal file
27
internal/wireguard/tea_messages.go
Normal file
@@ -0,0 +1,27 @@
|
||||
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{}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user