platform: modularize api/gui, add docs-tests-web foundation, and refresh root config
This commit is contained in:
46
selective-vpn-api/app/transport_shared.go
Normal file
46
selective-vpn-api/app/transport_shared.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"net/netip"
|
||||
transporttoken "selective-vpn-api/app/transporttoken"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
transportStateVersion = 1
|
||||
transportDefaultIfaceID = "shared"
|
||||
transportConfirmTTL = 10 * time.Minute
|
||||
transportMarkStart uint64 = 0x100
|
||||
transportMarkEnd uint64 = 0x1ff
|
||||
transportMarkReserveEnd uint64 = 0x10f
|
||||
transportPrefStart = 13000
|
||||
transportPrefStep = 50
|
||||
transportPrefEnd = 19999
|
||||
transportPrefReserveEnd = 13249
|
||||
)
|
||||
|
||||
type transportClientsState struct {
|
||||
Version int `json:"version"`
|
||||
UpdatedAt string `json:"updated_at,omitempty"`
|
||||
Items []TransportClient `json:"items,omitempty"`
|
||||
}
|
||||
|
||||
type cidrIntent struct {
|
||||
ClientID string
|
||||
Prefix netip.Prefix
|
||||
Key string
|
||||
}
|
||||
|
||||
type transportValidationResult struct {
|
||||
Normalized []TransportPolicyIntent
|
||||
Conflicts []TransportConflictRecord
|
||||
Summary TransportPolicyValidateSummary
|
||||
Diff TransportPolicyDiff
|
||||
Valid bool
|
||||
}
|
||||
|
||||
var (
|
||||
transportMu sync.Mutex
|
||||
transportConfirmStore = transporttoken.NewStore(transportConfirmTTL)
|
||||
)
|
||||
Reference in New Issue
Block a user