dns ui: compact tab + benchmark dialog and api endpoint

This commit is contained in:
beckline
2026-02-22 14:40:40 +03:00
parent 0b28586f31
commit a7ec4fe801
7 changed files with 1089 additions and 50 deletions

View File

@@ -77,6 +77,43 @@ type DNSModeRequest struct {
Mode DNSResolverMode `json:"mode"`
}
type DNSBenchmarkUpstream struct {
Addr string `json:"addr"`
Enabled bool `json:"enabled"`
}
type DNSBenchmarkRequest struct {
Upstreams []DNSBenchmarkUpstream `json:"upstreams"`
Domains []string `json:"domains"`
TimeoutMS int `json:"timeout_ms"`
Attempts int `json:"attempts"`
Concurrency int `json:"concurrency"`
}
type DNSBenchmarkResult struct {
Upstream string `json:"upstream"`
Attempts int `json:"attempts"`
OK int `json:"ok"`
Fail int `json:"fail"`
NXDomain int `json:"nxdomain"`
Timeout int `json:"timeout"`
Temporary int `json:"temporary"`
Other int `json:"other"`
AvgMS int `json:"avg_ms"`
P95MS int `json:"p95_ms"`
Score float64 `json:"score"`
Color string `json:"color"`
}
type DNSBenchmarkResponse struct {
Results []DNSBenchmarkResult `json:"results"`
DomainsUsed []string `json:"domains_used"`
TimeoutMS int `json:"timeout_ms"`
AttemptsPerDomain int `json:"attempts_per_domain"`
RecommendedDefault []string `json:"recommended_default"`
RecommendedMeta []string `json:"recommended_meta"`
}
type SmartDNSRuntimeStatusResponse struct {
Enabled bool `json:"enabled"`
AppliedEnable bool `json:"applied_enabled"`
@@ -105,6 +142,7 @@ type TrafficModeState struct {
Mode TrafficMode `json:"mode"`
PreferredIface string `json:"preferred_iface,omitempty"`
AutoLocalBypass bool `json:"auto_local_bypass"`
IngressReplyBypass bool `json:"ingress_reply_bypass"`
ForceVPNSubnets []string `json:"force_vpn_subnets,omitempty"`
ForceVPNUIDs []string `json:"force_vpn_uids,omitempty"`
ForceVPNCGroups []string `json:"force_vpn_cgroups,omitempty"`
@@ -118,6 +156,7 @@ type TrafficModeRequest struct {
Mode TrafficMode `json:"mode"`
PreferredIface *string `json:"preferred_iface,omitempty"`
AutoLocalBypass *bool `json:"auto_local_bypass,omitempty"`
IngressReplyBypass *bool `json:"ingress_reply_bypass,omitempty"`
ForceVPNSubnets *[]string `json:"force_vpn_subnets,omitempty"`
ForceVPNUIDs *[]string `json:"force_vpn_uids,omitempty"`
ForceVPNCGroups *[]string `json:"force_vpn_cgroups,omitempty"`
@@ -131,7 +170,11 @@ type TrafficModeStatusResponse struct {
DesiredMode TrafficMode `json:"desired_mode"`
AppliedMode TrafficMode `json:"applied_mode"`
PreferredIface string `json:"preferred_iface,omitempty"`
AdvancedActive bool `json:"advanced_active"`
AutoLocalBypass bool `json:"auto_local_bypass"`
AutoLocalActive bool `json:"auto_local_active"`
IngressReplyBypass bool `json:"ingress_reply_bypass"`
IngressReplyActive bool `json:"ingress_reply_active"`
BypassCandidates int `json:"bypass_candidates"`
ForceVPNSubnets []string `json:"force_vpn_subnets,omitempty"`
ForceVPNUIDs []string `json:"force_vpn_uids,omitempty"`
@@ -146,6 +189,8 @@ type TrafficModeStatusResponse struct {
IfaceReason string `json:"iface_reason,omitempty"`
RuleMark bool `json:"rule_mark"`
RuleFull bool `json:"rule_full"`
IngressRulePresent bool `json:"ingress_rule_present"`
IngressNftActive bool `json:"ingress_nft_active"`
TableDefault bool `json:"table_default"`
ProbeOK bool `json:"probe_ok"`
ProbeMessage string `json:"probe_message,omitempty"`
@@ -208,7 +253,7 @@ type TrafficAppMarksRequest struct {
Unit string `json:"unit,omitempty"`
Command string `json:"command,omitempty"`
AppKey string `json:"app_key,omitempty"`
TimeoutSec int `json:"timeout_sec,omitempty"` // only for add
TimeoutSec int `json:"timeout_sec,omitempty"` // only for add; 0 = persistent
}
type TrafficAppMarksResponse struct {
@@ -240,7 +285,7 @@ type TrafficAppMarkItemView struct {
AppKey string `json:"app_key,omitempty"`
AddedAt string `json:"added_at,omitempty"`
ExpiresAt string `json:"expires_at,omitempty"`
RemainingSec int `json:"remaining_sec,omitempty"`
RemainingSec int `json:"remaining_sec,omitempty"` // -1 = persistent
}
type TrafficAppMarksItemsResponse struct {
@@ -259,8 +304,8 @@ type TrafficAppProfile struct {
Name string `json:"name,omitempty"`
AppKey string `json:"app_key,omitempty"`
Command string `json:"command,omitempty"`
Target string `json:"target,omitempty"` // vpn|direct
TTLSec int `json:"ttl_sec,omitempty"`
Target string `json:"target,omitempty"` // vpn|direct
TTLSec int `json:"ttl_sec,omitempty"` // 0 = persistent
VPNProfile string `json:"vpn_profile,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
@@ -276,8 +321,8 @@ type TrafficAppProfileUpsertRequest struct {
Name string `json:"name,omitempty"`
AppKey string `json:"app_key,omitempty"`
Command string `json:"command,omitempty"`
Target string `json:"target,omitempty"` // vpn|direct
TTLSec int `json:"ttl_sec,omitempty"`
Target string `json:"target,omitempty"` // vpn|direct
TTLSec int `json:"ttl_sec,omitempty"` // 0 = persistent
VPNProfile string `json:"vpn_profile,omitempty"`
}