refactoring
This commit is contained in:
parent
60be389b5d
commit
90c88e3672
16
main.go
16
main.go
|
@ -130,13 +130,13 @@ func updateNotice(notice *canvas.Text, text string, c color.Color, isVisible, is
|
||||||
log.Println(text)
|
log.Println(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
func WgUp(config Config, notice *canvas.Text) {
|
func wgUp(config Config, notice *canvas.Text) {
|
||||||
updateNotice(notice, fmt.Sprintf("Interface is starting"), orange, true, false)
|
updateNotice(notice, fmt.Sprintf("Interface is starting"), orange, true, false)
|
||||||
exec.Command("wg-quick", "up", config.Name).Output()
|
exec.Command("wg-quick", "up", config.Name).Output()
|
||||||
updateNotice(notice, fmt.Sprintf("Interface is up"), green, true, true)
|
updateNotice(notice, fmt.Sprintf("Interface is up"), green, true, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func WgDown(config Config, notice *canvas.Text) {
|
func wgDown(config Config, notice *canvas.Text) {
|
||||||
updateNotice(notice, fmt.Sprintf("Interface is stopping"), orange, true, false)
|
updateNotice(notice, fmt.Sprintf("Interface is stopping"), orange, true, false)
|
||||||
exec.Command("wg-quick", "down", config.Name).Output()
|
exec.Command("wg-quick", "down", config.Name).Output()
|
||||||
updateNotice(notice, fmt.Sprintf("Interface is down"), green, true, true)
|
updateNotice(notice, fmt.Sprintf("Interface is down"), green, true, true)
|
||||||
|
@ -148,9 +148,9 @@ func WgDown(config Config, notice *canvas.Text) {
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func WgRestart(config Config, notice *canvas.Text) {
|
func wgRestart(config Config, notice *canvas.Text) {
|
||||||
WgDown(config, notice)
|
wgDown(config, notice)
|
||||||
WgUp(config, notice)
|
wgUp(config, notice)
|
||||||
}
|
}
|
||||||
|
|
||||||
func lintConfiguration(configuration string) string {
|
func lintConfiguration(configuration string) string {
|
||||||
|
@ -209,15 +209,15 @@ func createTab(config Config) *fyne.Container {
|
||||||
notice := createNotice()
|
notice := createNotice()
|
||||||
|
|
||||||
buttonStart := createColoredButton("Start", green, func() {
|
buttonStart := createColoredButton("Start", green, func() {
|
||||||
WgUp(config, notice)
|
wgUp(config, notice)
|
||||||
})
|
})
|
||||||
|
|
||||||
buttonStop := createColoredButton("Stop", red, func() {
|
buttonStop := createColoredButton("Stop", red, func() {
|
||||||
WgDown(config, notice)
|
wgDown(config, notice)
|
||||||
})
|
})
|
||||||
|
|
||||||
buttonRestart := createColoredButton("Restart", orange, func() {
|
buttonRestart := createColoredButton("Restart", orange, func() {
|
||||||
WgRestart(config, notice)
|
wgRestart(config, notice)
|
||||||
})
|
})
|
||||||
|
|
||||||
top := container.New(
|
top := container.New(
|
||||||
|
|
Loading…
Reference in a new issue