105 lines
3.4 KiB
Go
105 lines
3.4 KiB
Go
package app
|
|
|
|
// ---------------------------------------------------------------------
|
|
// структуры
|
|
// ---------------------------------------------------------------------
|
|
|
|
// EN: Shared DTO/model definitions exchanged between HTTP handlers, workers,
|
|
// EN: SSE stream, and internal orchestration logic.
|
|
// RU: Общие DTO/модели, которыми обмениваются HTTP-обработчики, воркеры,
|
|
// RU: SSE-поток и внутренняя оркестрация.
|
|
|
|
type Status struct {
|
|
Timestamp string `json:"timestamp"`
|
|
IPCount int `json:"ip_count"`
|
|
DomainCount int `json:"domain_count"`
|
|
Iface string `json:"iface"`
|
|
Table string `json:"table"`
|
|
Mark string `json:"mark"`
|
|
|
|
PolicyRouteOK *bool `json:"policy_route_ok,omitempty"`
|
|
RouteOK *bool `json:"route_ok,omitempty"`
|
|
}
|
|
|
|
type cmdResult struct {
|
|
OK bool `json:"ok"`
|
|
Message string `json:"message,omitempty"`
|
|
ExitCode int `json:"exitCode,omitempty"`
|
|
Stdout string `json:"stdout,omitempty"`
|
|
Stderr string `json:"stderr,omitempty"`
|
|
}
|
|
|
|
type VPNLoginState struct {
|
|
State string `json:"state"`
|
|
Email string `json:"email,omitempty"`
|
|
Msg string `json:"msg,omitempty"`
|
|
|
|
// для GUI
|
|
Text string `json:"text,omitempty"`
|
|
Color string `json:"color,omitempty"`
|
|
}
|
|
|
|
type SystemdState struct {
|
|
State string `json:"state"`
|
|
}
|
|
|
|
// ---------------------------------------------------------------------
|
|
// события / SSE
|
|
// ---------------------------------------------------------------------
|
|
|
|
type Event struct {
|
|
ID int64 `json:"id"`
|
|
Kind string `json:"kind"`
|
|
Ts string `json:"ts"`
|
|
Data interface{} `json:"data,omitempty"`
|
|
}
|
|
|
|
// EN: Callback for streaming user-visible progress from long-running nft updates.
|
|
// RU: Колбэк для отправки прогресса длительных nft-операций в пользовательский интерфейс.
|
|
type ProgressCallback func(percent int, message string)
|
|
|
|
// ---------------------------------------------------------------------
|
|
// resolver модели
|
|
// ---------------------------------------------------------------------
|
|
|
|
// EN: Input contract for the Go-based domain resolver job.
|
|
// RU: Контракт входных параметров для Go-резолвера доменов.
|
|
type ResolverOpts struct {
|
|
DomainsPath string
|
|
MetaPath string
|
|
StaticPath string
|
|
CachePath string
|
|
PtrCachePath string
|
|
TraceLog string
|
|
TTL int
|
|
Workers int
|
|
DNSConfigPath string
|
|
|
|
ViaSmartDNS bool
|
|
Mode DNSResolverMode
|
|
SmartDNSAddr string
|
|
SmartDNSWildcards []string
|
|
}
|
|
|
|
// EN: Aggregated resolver outputs consumed by routes update pipeline.
|
|
// RU: Агрегированные результаты резолвера, используемые пайплайном обновления маршрутов.
|
|
type resolverResult struct {
|
|
IPs []string
|
|
IPMap [][2]string
|
|
DirectIPs []string
|
|
DirectIPMap [][2]string
|
|
WildcardIPs []string
|
|
WildcardIPMap [][2]string
|
|
DomainCache map[string]any
|
|
PtrCache map[string]any
|
|
}
|
|
|
|
// EN: Runtime DNS upstream pools for standard and meta-special lookups.
|
|
// RU: Наборы DNS-апстримов для обычных и meta-special резолвов.
|
|
type dnsConfig struct {
|
|
Default []string
|
|
Meta []string
|
|
SmartDNS string
|
|
Mode DNSResolverMode
|
|
}
|