platform: modularize api/gui, add docs-tests-web foundation, and refresh root config

This commit is contained in:
beckline
2026-03-26 22:40:54 +03:00
parent 0e2d7f61ea
commit 6a56d734c2
562 changed files with 70151 additions and 16423 deletions

View File

@@ -0,0 +1,51 @@
package app
import (
"sync"
"time"
)
const (
vpnLocationsCommandTimeout = 7 * time.Second
vpnLocationsFreshTTL = 10 * time.Minute
vpnLocationsBackoffMin = 2 * time.Second
vpnLocationsBackoffMax = 60 * time.Second
vpnLocationsCachePath = stateDir + "/vpn-locations-cache.json"
)
type vpnLocationItem struct {
Label string `json:"label"`
ISO string `json:"iso"`
Target string `json:"target,omitempty"`
}
type vpnLocationsSnapshot struct {
Locations []vpnLocationItem `json:"locations"`
UpdatedAt string `json:"updated_at,omitempty"`
Stale bool `json:"stale"`
RefreshInProgress bool `json:"refresh_in_progress"`
LastError string `json:"last_error,omitempty"`
NextRetryAt string `json:"next_retry_at,omitempty"`
}
type vpnLocationsCacheDisk struct {
Locations []vpnLocationItem `json:"locations"`
UpdatedAt string `json:"updated_at,omitempty"`
}
type vpnLocationsStore struct {
mu sync.Mutex
loaded bool
locations []vpnLocationItem
swr refreshCoordinator
}
var vpnLocationCache = &vpnLocationsStore{
swr: newRefreshCoordinator(
vpnLocationsFreshTTL,
vpnLocationsBackoffMin,
vpnLocationsBackoffMax,
),
}