mirror of
https://github.com/khairul169/vaulterm.git
synced 2025-04-28 08:39:37 +07:00
35 lines
567 B
Go
35 lines
567 B
Go
//go:build gui
|
|
// +build gui
|
|
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
// App struct
|
|
type App struct {
|
|
ctx context.Context
|
|
localPort int
|
|
}
|
|
|
|
// NewApp creates a new App application struct
|
|
func NewApp() *App {
|
|
return &App{}
|
|
}
|
|
|
|
// startup is called when the app starts. The context is saved
|
|
// so we can call the runtime methods
|
|
func (a *App) startup(ctx context.Context) {
|
|
a.ctx = ctx
|
|
}
|
|
|
|
// Returns local server address
|
|
func (a *App) GetLocalServer() string {
|
|
if a.localPort == 0 {
|
|
return ""
|
|
}
|
|
return fmt.Sprintf("http://localhost:%d", a.localPort)
|
|
}
|