Documentation
¶
Index ¶
- func AutoExcludedNodeKey(subscriptionID, nodeID string) string
- func CloneFirewallTargetCatalog(catalog map[string]FirewallTargetDefinition) map[string]FirewallTargetDefinition
- func EffectiveTransparentBlockQUIC(settings FirewallSettings, node *Node) bool
- func ExpandFirewallSelectorSetCIDRs(customCatalog map[string]FirewallTargetDefinition, ...) []string
- func ExpandFirewallSelectorSetDomains(customCatalog map[string]FirewallTargetDefinition, ...) []string
- func ExpandFirewallTargetCIDRs(customCatalog map[string]FirewallTargetDefinition, services, cidrs []string) []string
- func ExpandFirewallTargetDomains(customCatalog map[string]FirewallTargetDefinition, services, domains []string) []string
- func ExpandZapretSelectorCIDRs(customCatalog map[string]FirewallTargetDefinition, ...) []string
- func ExpandZapretSelectorDomains(customCatalog map[string]FirewallTargetDefinition, ...) []string
- func FirewallRoutingEnabled(settings FirewallSettings) bool
- func FirewallSelectorSetHasEntries(value FirewallSelectorSet) bool
- func FirewallTargetServiceNames() []string
- func HumanizeProviderName(value string) string
- func IsAutoExcludedNode(values []string, subscriptionID, nodeID string) bool
- func NormalizeAutoExcludedNodes(values []string) []string
- func NormalizeZapretCIDRList(cidrs []string) []string
- func NormalizeZapretDomainList(domains []string) []string
- func ParseFirewallSources(selectors []string) ([]string, error)
- func ProviderNameFromURL(rawURL string) string
- func SplitAutoExcludedNodeKey(raw string) (string, string, bool)
- func StableNodeID(node Node) string
- func ZapretSelectorSetHasEntries(value FirewallSelectorSet) bool
- type ActiveConnection
- type DNSMode
- type DNSRuntimeStatus
- type DNSSettings
- type DNSTransport
- type Duration
- type FirewallDefaultAction
- type FirewallMode
- type FirewallModeDraft
- type FirewallModeDrafts
- type FirewallSelectorSet
- type FirewallSettings
- type FirewallSplitDraft
- type FirewallSplitSettings
- type FirewallTargetDefinition
- type FirewallTargetMode
- type FirewallTargetService
- type FirewallTargetServiceSource
- type FirewallTargets
- type IPv6Status
- type Node
- type NodeHealth
- type Protocol
- type ProviderNameSource
- type RuntimeState
- type ScoreResult
- type SelectionMode
- type Settings
- type SourceType
- type Subscription
- type SubscriptionTraffic
- type TransportMode
- type ZapretSettings
- func CanonicalZapretSettings(settings ZapretSettings) ZapretSettings
- func CanonicalZapretSettingsWithCatalog(settings ZapretSettings, customCatalog map[string]FirewallTargetDefinition) ZapretSettings
- func DefaultZapretSettings() ZapretSettings
- func NormalizeZapretSettings(settings ZapretSettings) ZapretSettings
- type ZapretStatus
- type ZapretTestRestoreState
- type ZapretTestState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoExcludedNodeKey ¶ added in v0.1.7
AutoExcludedNodeKey builds the persisted auto-exclusion key for one node.
func CloneFirewallTargetCatalog ¶ added in v0.1.5
func CloneFirewallTargetCatalog(catalog map[string]FirewallTargetDefinition) map[string]FirewallTargetDefinition
CloneFirewallTargetCatalog deep-copies the provided service catalog.
func EffectiveTransparentBlockQUIC ¶ added in v0.1.6
func EffectiveTransparentBlockQUIC(settings FirewallSettings, node *Node) bool
EffectiveTransparentBlockQUIC returns the runtime QUIC policy for transparent mode.
Some outbound types, notably VLESS over TCP Reality/XTLS Vision, reject UDP/443 in Xray. For those nodes we block QUIC and rely on TCP fallback even when the user has not explicitly enabled block_quic.
func ExpandFirewallSelectorSetCIDRs ¶ added in v0.1.6
func ExpandFirewallSelectorSetCIDRs(customCatalog map[string]FirewallTargetDefinition, selectors FirewallSelectorSet) []string
ExpandFirewallSelectorSetCIDRs expands one selector set to IPv4 selectors.
func ExpandFirewallSelectorSetDomains ¶ added in v0.1.6
func ExpandFirewallSelectorSetDomains(customCatalog map[string]FirewallTargetDefinition, selectors FirewallSelectorSet) []string
ExpandFirewallSelectorSetDomains expands one selector set to domain matchers.
func ExpandFirewallTargetCIDRs ¶ added in v0.1.5
func ExpandFirewallTargetCIDRs(customCatalog map[string]FirewallTargetDefinition, services, cidrs []string) []string
ExpandFirewallTargetCIDRs expands service aliases to static CIDR targets and appends user-entered IPv4 selectors.
func ExpandFirewallTargetDomains ¶ added in v0.1.5
func ExpandFirewallTargetDomains(customCatalog map[string]FirewallTargetDefinition, services, domains []string) []string
ExpandFirewallTargetDomains expands service aliases and well-known built-in root domains.
func ExpandZapretSelectorCIDRs ¶ added in v0.1.7
func ExpandZapretSelectorCIDRs(customCatalog map[string]FirewallTargetDefinition, selectors FirewallSelectorSet) []string
ExpandZapretSelectorCIDRs expands legacy service aliases to static IPv4 selectors.
func ExpandZapretSelectorDomains ¶ added in v0.1.7
func ExpandZapretSelectorDomains(customCatalog map[string]FirewallTargetDefinition, selectors FirewallSelectorSet) []string
ExpandZapretSelectorDomains expands any legacy service aliases into domains.
func FirewallRoutingEnabled ¶ added in v0.1.6
func FirewallRoutingEnabled(settings FirewallSettings) bool
FirewallRoutingEnabled reports whether the firewall has active routing selectors.
func FirewallSelectorSetHasEntries ¶ added in v0.1.6
func FirewallSelectorSetHasEntries(value FirewallSelectorSet) bool
FirewallSelectorSetHasEntries reports whether the selector set contains any selectors.
func FirewallTargetServiceNames ¶ added in v0.1.5
func FirewallTargetServiceNames() []string
FirewallTargetServiceNames returns the built-in preset names accepted by firewall targets.
func HumanizeProviderName ¶
HumanizeProviderName converts provider metadata or source hosts into a stable display title such as "Sample VPN" or "Demo VPN".
func IsAutoExcludedNode ¶ added in v0.1.7
IsAutoExcludedNode reports whether one node is excluded from auto mode.
func NormalizeAutoExcludedNodes ¶ added in v0.1.7
NormalizeAutoExcludedNodes trims, validates, deduplicates, and sorts node exclusions.
func NormalizeZapretCIDRList ¶ added in v0.1.7
NormalizeZapretCIDRList sorts and deduplicates expanded IPv4 selectors.
func NormalizeZapretDomainList ¶ added in v0.1.7
NormalizeZapretDomainList sorts and deduplicates expanded domains.
func ParseFirewallSources ¶ added in v0.1.6
ParseFirewallSources validates LAN source selectors.
func ProviderNameFromURL ¶
ProviderNameFromURL derives a display provider title from a subscription URL.
func SplitAutoExcludedNodeKey ¶ added in v0.1.7
SplitAutoExcludedNodeKey parses one persisted auto-exclusion key.
func StableNodeID ¶
StableNodeID derives a deterministic ID from the node identity.
func ZapretSelectorSetHasEntries ¶ added in v0.1.7
func ZapretSelectorSetHasEntries(value FirewallSelectorSet) bool
ZapretSelectorSetHasEntries reports whether the selector set contains usable Zapret selectors.
Types ¶
type ActiveConnection ¶
type ActiveConnection struct {
SubscriptionID string `json:"subscription_id"`
NodeID string `json:"node_id"`
ConnectedAt time.Time `json:"connected_at"`
Mode SelectionMode `json:"mode"`
}
ActiveConnection describes the currently applied runtime selection.
type DNSMode ¶
type DNSMode string
DNSMode controls how RouteFlux manages runtime DNS behavior.
const ( // DNSModeSystem leaves DNS handling to the router or host system. DNSModeSystem DNSMode = "system" // DNSModeRemote forces DNS queries to configured upstream servers. DNSModeRemote DNSMode = "remote" // DNSModeSplit keeps selected domains on system DNS and sends the rest upstream. DNSModeSplit DNSMode = "split" // DNSModeDisabled omits RouteFlux-managed DNS config. DNSModeDisabled DNSMode = "disabled" )
func ParseDNSMode ¶
ParseDNSMode validates and normalizes a DNS mode value.
type DNSRuntimeStatus ¶ added in v0.1.7
type DNSRuntimeStatus struct {
Available bool `json:"available"`
Active bool `json:"active"`
LocalDNSListen string `json:"local_dns_listen,omitempty"`
LocalDNSPort int `json:"local_dns_port,omitempty"`
DNSMasqSnippetPath string `json:"dnsmasq_snippet_path,omitempty"`
DNSMasqSnippetFound bool `json:"dnsmasq_snippet_found"`
ResolvFile string `json:"resolv_file,omitempty"`
SystemResolvers []string `json:"system_resolvers,omitempty"`
DegradedReason string `json:"degraded_reason,omitempty"`
Error string `json:"error,omitempty"`
}
DNSRuntimeStatus reports the effective OpenWrt DNS runtime managed by RouteFlux.
type DNSSettings ¶
type DNSSettings struct {
Mode DNSMode `json:"mode"`
Transport DNSTransport `json:"transport"`
Servers []string `json:"servers"`
Bootstrap []string `json:"bootstrap"`
DirectDomains []string `json:"direct_domains"`
}
DNSSettings stores RouteFlux-managed DNS preferences.
func DefaultDNSSettings ¶
func DefaultDNSSettings() DNSSettings
DefaultDNSSettings returns the recommended DNS profile for RouteFlux.
type DNSTransport ¶
type DNSTransport string
DNSTransport controls how RouteFlux talks to upstream DNS servers.
const ( // DNSTransportPlain uses plain DNS as written by the server address. DNSTransportPlain DNSTransport = "plain" // DNSTransportDoH uses DNS over HTTPS. DNSTransportDoH DNSTransport = "doh" // DNSTransportDoT is reserved for future backends. DNSTransportDoT DNSTransport = "dot" )
func ParseDNSTransport ¶
func ParseDNSTransport(raw string) (DNSTransport, error)
ParseDNSTransport validates and normalizes a DNS transport value.
type Duration ¶
Duration wraps time.Duration with string JSON encoding.
func NewDuration ¶
NewDuration converts a time.Duration into a serializable Duration.
func ParseDurationValue ¶
ParseDurationValue accepts either a Go duration string or an integer nanosecond value.
func (Duration) MarshalJSON ¶
MarshalJSON encodes the duration as a string.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON decodes either a duration string or a raw integer.
type FirewallDefaultAction ¶ added in v0.1.6
type FirewallDefaultAction string
FirewallDefaultAction controls what happens when no split selector matches.
const ( // FirewallDefaultActionDirect keeps unmatched split traffic direct. FirewallDefaultActionDirect FirewallDefaultAction = "direct" // FirewallDefaultActionProxy sends unmatched split traffic through the proxy. FirewallDefaultActionProxy FirewallDefaultAction = "proxy" )
func NormalizeFirewallDefaultAction ¶ added in v0.1.6
func NormalizeFirewallDefaultAction(action FirewallDefaultAction) FirewallDefaultAction
NormalizeFirewallDefaultAction coerces unknown values to direct.
type FirewallMode ¶ added in v0.1.6
type FirewallMode string
FirewallMode controls the active transparent-routing strategy.
const ( // FirewallModeDisabled turns off transparent routing. FirewallModeDisabled FirewallMode = "disabled" // FirewallModeHosts proxies all traffic from selected LAN clients. FirewallModeHosts FirewallMode = "hosts" // FirewallModeTargets proxies only selected destinations. FirewallModeTargets FirewallMode = "targets" // FirewallModeSplit applies an explicit proxy/bypass policy. FirewallModeSplit FirewallMode = "split" )
func CanonicalFirewallMode ¶ added in v0.1.6
func CanonicalFirewallMode(settings FirewallSettings) FirewallMode
CanonicalFirewallMode infers the effective firewall mode for legacy or partial settings.
func NormalizeFirewallMode ¶ added in v0.1.6
func NormalizeFirewallMode(mode FirewallMode) FirewallMode
NormalizeFirewallMode coerces unknown values to disabled.
type FirewallModeDraft ¶ added in v0.1.6
type FirewallModeDraft struct {
TargetServices []string `json:"target_services"`
TargetCIDRs []string `json:"target_cidrs"`
TargetDomains []string `json:"target_domains"`
SourceCIDRs []string `json:"source_cidrs"`
}
FirewallModeDraft stores saved selectors for one LuCI firewall mode.
func CloneFirewallModeDraft ¶ added in v0.1.6
func CloneFirewallModeDraft(draft FirewallModeDraft) FirewallModeDraft
CloneFirewallModeDraft deep-copies one firewall mode draft.
type FirewallModeDrafts ¶ added in v0.1.6
type FirewallModeDrafts struct {
Hosts FirewallModeDraft `json:"hosts"`
Targets FirewallModeDraft `json:"targets"`
Split FirewallSplitDraft `json:"split"`
}
FirewallModeDrafts stores saved selectors for each supported LuCI firewall mode.
func CloneFirewallModeDrafts ¶ added in v0.1.6
func CloneFirewallModeDrafts(drafts FirewallModeDrafts) FirewallModeDrafts
CloneFirewallModeDrafts deep-copies all firewall mode drafts.
type FirewallSelectorSet ¶ added in v0.1.6
type FirewallSelectorSet struct {
Services []string `json:"services"`
Domains []string `json:"domains"`
CIDRs []string `json:"cidrs"`
}
FirewallSelectorSet stores service aliases, domains, and IPv4 selectors.
func CloneFirewallSelectorSet ¶ added in v0.1.6
func CloneFirewallSelectorSet(value FirewallSelectorSet) FirewallSelectorSet
CloneFirewallSelectorSet deep-copies one firewall selector set.
func FirewallSelectorSetFromTargets ¶ added in v0.1.6
func FirewallSelectorSetFromTargets(targets FirewallTargets) FirewallSelectorSet
FirewallSelectorSetFromTargets converts parsed mixed selectors into a selector set.
func ParseZapretSelectors ¶ added in v0.1.7
func ParseZapretSelectors(selectors []string, customCatalog map[string]FirewallTargetDefinition) (FirewallSelectorSet, error)
ParseZapretSelectors validates selectors supported by Zapret fallback.
type FirewallSettings ¶
type FirewallSettings struct {
Enabled bool `json:"enabled"`
TransparentPort int `json:"transparent_port"`
Mode FirewallMode `json:"mode"`
DisableIPv6 bool `json:"disable_ipv6"`
Hosts []string `json:"hosts"`
Targets FirewallSelectorSet `json:"targets"`
Split FirewallSplitSettings `json:"split"`
TargetServiceCatalog map[string]FirewallTargetDefinition `json:"target_service_catalog"`
ModeDrafts FirewallModeDrafts `json:"mode_drafts"`
BlockQUIC bool `json:"block_quic"`
}
FirewallSettings stores transparent proxy routing preferences.
func CanonicalFirewallSettings ¶ added in v0.1.6
func CanonicalFirewallSettings(settings FirewallSettings) FirewallSettings
CanonicalFirewallSettings normalizes firewall settings for compatibility with older persisted states.
type FirewallSplitDraft ¶ added in v0.1.6
type FirewallSplitDraft struct {
Proxy FirewallSelectorSet `json:"proxy"`
Bypass FirewallSelectorSet `json:"bypass"`
ExcludedSources []string `json:"excluded_sources"`
}
FirewallSplitDraft stores saved selectors for the split firewall mode.
func CloneFirewallSplitDraft ¶ added in v0.1.6
func CloneFirewallSplitDraft(draft FirewallSplitDraft) FirewallSplitDraft
CloneFirewallSplitDraft deep-copies one split firewall draft.
type FirewallSplitSettings ¶ added in v0.1.6
type FirewallSplitSettings struct {
Proxy FirewallSelectorSet `json:"proxy"`
Bypass FirewallSelectorSet `json:"bypass"`
ExcludedSources []string `json:"excluded_sources"`
DefaultAction FirewallDefaultAction `json:"default_action"`
}
FirewallSplitSettings stores the full split tunnelling policy.
func CloneFirewallSplitSettings ¶ added in v0.1.6
func CloneFirewallSplitSettings(value FirewallSplitSettings) FirewallSplitSettings
CloneFirewallSplitSettings deep-copies one split tunnelling policy.
func DefaultFirewallSplitSettings ¶ added in v0.1.6
func DefaultFirewallSplitSettings() FirewallSplitSettings
DefaultFirewallSplitSettings returns the default split tunnelling policy.
type FirewallTargetDefinition ¶ added in v0.1.5
type FirewallTargetDefinition struct {
Services []string `json:"services"`
Domains []string `json:"domains"`
CIDRs []string `json:"cidrs"`
}
FirewallTargetDefinition stores reusable aliases, domains, and IPv4 selectors for a target service.
func ParseFirewallTargetDefinition ¶ added in v0.1.5
func ParseFirewallTargetDefinition(name string, selectors []string, customCatalog map[string]FirewallTargetDefinition) (string, FirewallTargetDefinition, error)
ParseFirewallTargetDefinition validates a user-defined target service entry.
type FirewallTargetMode ¶ added in v0.1.6
type FirewallTargetMode string
FirewallTargetMode is kept for legacy anti-target migration and CLI compatibility.
const ( // FirewallTargetModeProxy maps legacy target mode to explicit proxy selectors. FirewallTargetModeProxy FirewallTargetMode = "proxy" // FirewallTargetModeBypass maps legacy target mode to explicit bypass selectors. FirewallTargetModeBypass FirewallTargetMode = "bypass" )
func NormalizeFirewallTargetMode ¶ added in v0.1.6
func NormalizeFirewallTargetMode(mode FirewallTargetMode) FirewallTargetMode
NormalizeFirewallTargetMode coerces unknown legacy values to proxy.
type FirewallTargetService ¶ added in v0.1.5
type FirewallTargetService struct {
Name string `json:"name"`
Source FirewallTargetServiceSource `json:"source"`
ReadOnly bool `json:"readonly"`
Services []string `json:"services"`
Domains []string `json:"domains"`
CIDRs []string `json:"cidrs"`
}
FirewallTargetService describes one resolved service entry from the merged registry.
func FirewallTargetServices ¶ added in v0.1.5
func FirewallTargetServices(customCatalog map[string]FirewallTargetDefinition) []FirewallTargetService
FirewallTargetServices returns the merged built-in and custom registry as sorted entries.
func LookupFirewallTargetService ¶ added in v0.1.5
func LookupFirewallTargetService(customCatalog map[string]FirewallTargetDefinition, name string) (FirewallTargetService, bool)
LookupFirewallTargetService returns one service entry from the merged registry.
type FirewallTargetServiceSource ¶ added in v0.1.5
type FirewallTargetServiceSource string
FirewallTargetServiceSource identifies whether a target service is built in or user-defined.
const ( FirewallTargetServiceSourceBuiltin FirewallTargetServiceSource = "builtin" FirewallTargetServiceSourceCustom FirewallTargetServiceSource = "custom" )
type FirewallTargets ¶ added in v0.1.5
FirewallTargets stores validated transparent proxy selectors.
func ParseFirewallTargets ¶ added in v0.1.5
func ParseFirewallTargets(selectors []string, customCatalog map[string]FirewallTargetDefinition) (FirewallTargets, error)
ParseFirewallTargets validates and splits mixed IPv4, service, and domain selectors.
type IPv6Status ¶ added in v0.1.6
type IPv6Status struct {
Available bool `json:"available"`
ConfigPath string `json:"config_path,omitempty"`
PersistentDisabled bool `json:"persistent_disabled"`
RuntimeDisabled bool `json:"runtime_disabled"`
EnabledInterfaces []string `json:"enabled_interfaces,omitempty"`
}
IPv6Status reports the current router IPv6 state relevant to RouteFlux.
type Node ¶
type Node struct {
ID string `json:"id"`
SubscriptionID string `json:"subscription_id"`
Name string `json:"name"`
ProviderName string `json:"provider_name"`
Protocol Protocol `json:"protocol"`
Address string `json:"address"`
Port int `json:"port"`
UUID string `json:"uuid"`
Password string `json:"password"`
Encryption string `json:"encryption"`
Security string `json:"security"`
ServerName string `json:"server_name"`
ALPN []string `json:"alpn"`
Fingerprint string `json:"fingerprint"`
PublicKey string `json:"public_key"`
ShortID string `json:"short_id"`
Flow string `json:"flow"`
Transport string `json:"transport"`
Path string `json:"path"`
Host string `json:"host"`
Remark string `json:"remark"`
RawQuery string `json:"raw_query"`
Extras map[string]string `json:"extras"`
}
Node is the normalized representation of a provider endpoint.
func (Node) DisplayName ¶
DisplayName returns a user-facing node label.
type NodeHealth ¶
type NodeHealth struct {
NodeID string `json:"node_id"`
LastLatency Duration `json:"last_latency"`
AverageLatency Duration `json:"average_latency"`
SuccessCount int `json:"success_count"`
FailureCount int `json:"failure_count"`
ConsecutiveFailures int `json:"consecutive_failures"`
ConsecutiveSuccesses int `json:"consecutive_successes"`
LastCheckedAt time.Time `json:"last_checked_at"`
Healthy bool `json:"healthy"`
Score float64 `json:"score"`
LastFailureReason string `json:"last_failure_reason"`
}
NodeHealth stores rolling probe metrics for a node.
type Protocol ¶
type Protocol string
Protocol identifies a supported outbound protocol.
const ( // ProtocolVLESS represents a VLESS node. ProtocolVLESS Protocol = "vless" // ProtocolVMess represents a VMess node. ProtocolVMess Protocol = "vmess" // ProtocolTrojan represents a Trojan node. ProtocolTrojan Protocol = "trojan" // ProtocolShadowsocks represents a Shadowsocks node. ProtocolShadowsocks Protocol = "shadowsocks" )
type ProviderNameSource ¶
type ProviderNameSource string
ProviderNameSource identifies where the current provider name came from.
const ( // ProviderNameSourceDefault means the generic fallback name is in use. ProviderNameSourceDefault ProviderNameSource = "default" // ProviderNameSourceURL means the name was derived from the subscription URL. ProviderNameSourceURL ProviderNameSource = "url" // ProviderNameSourceHeader means the name came from subscription response metadata. ProviderNameSourceHeader ProviderNameSource = "header" // ProviderNameSourceManual means the user explicitly set or renamed the name. ProviderNameSourceManual ProviderNameSource = "manual" )
type RuntimeState ¶
type RuntimeState struct {
SchemaVersion int `json:"schema_version"`
ActiveSubscriptionID string `json:"active_subscription_id"`
ActiveNodeID string `json:"active_node_id"`
Mode SelectionMode `json:"mode"`
Connected bool `json:"connected"`
ActiveTransport TransportMode `json:"active_transport"`
LastRefreshAt map[string]time.Time `json:"last_refresh_at"`
Health map[string]NodeHealth `json:"health"`
LastSwitchAt time.Time `json:"last_switch_at"`
LastTransportSwitchAt time.Time `json:"last_transport_switch_at"`
LastSuccessAt time.Time `json:"last_success_at"`
LastFailureReason string `json:"last_failure_reason"`
LastTransportFailureReason string `json:"last_transport_failure_reason"`
ZapretTest ZapretTestState `json:"zapret_test,omitempty"`
}
RuntimeState persists the operational state across restarts.
func DefaultRuntimeState ¶
func DefaultRuntimeState() RuntimeState
DefaultRuntimeState returns an empty persisted state.
type ScoreResult ¶
type ScoreResult struct {
NodeID string `json:"node_id"`
Healthy bool `json:"healthy"`
Score float64 `json:"score"`
Reason string `json:"reason"`
Selected bool `json:"selected"`
}
ScoreResult represents the calculated node quality.
type SelectionMode ¶
type SelectionMode string
SelectionMode defines how RouteFlux selects the active node.
const ( // SelectionModeManual pins a user-selected node. SelectionModeManual SelectionMode = "manual" // SelectionModeAuto automatically selects the best node. SelectionModeAuto SelectionMode = "auto" // SelectionModeDisconnected means no node is active. SelectionModeDisconnected SelectionMode = "disconnected" )
type Settings ¶
type Settings struct {
SchemaVersion int `json:"schema_version"`
RefreshInterval Duration `json:"refresh_interval"`
HealthCheckInterval Duration `json:"health_check_interval"`
SwitchCooldown Duration `json:"switch_cooldown"`
LatencyThreshold Duration `json:"latency_threshold"`
AutoExcludedNodes []string `json:"auto_excluded_nodes"`
DNS DNSSettings `json:"dns"`
Firewall FirewallSettings `json:"firewall"`
Zapret ZapretSettings `json:"zapret"`
AutoMode bool `json:"auto_mode"`
Mode SelectionMode `json:"mode"`
LogLevel string `json:"log_level"`
}
Settings stores user-configurable application behavior.
func DefaultSettings ¶
func DefaultSettings() Settings
DefaultSettings returns the baseline configuration used on first start.
type SourceType ¶
type SourceType string
SourceType identifies how a subscription was added.
const ( // SourceTypeURL represents a remote HTTP or HTTPS subscription. SourceTypeURL SourceType = "url" // SourceTypeRaw represents raw link or raw subscription content. SourceTypeRaw SourceType = "raw" )
type Subscription ¶
type Subscription struct {
ID string `json:"id"`
SourceType SourceType `json:"source_type"`
Source string `json:"source"`
ProviderName string `json:"provider_name"`
ProviderNameSource ProviderNameSource `json:"provider_name_source,omitempty"`
DisplayName string `json:"display_name"`
LastUpdatedAt time.Time `json:"last_updated_at"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
Traffic *SubscriptionTraffic `json:"traffic,omitempty"`
RefreshInterval Duration `json:"refresh_interval"`
LastError string `json:"last_error"`
ParserStatus string `json:"parser_status"`
Nodes []Node `json:"nodes"`
}
Subscription stores a provider payload and its normalized nodes.
type SubscriptionTraffic ¶ added in v0.1.6
type SubscriptionTraffic struct {
UploadBytes int64 `json:"upload_bytes"`
DownloadBytes int64 `json:"download_bytes"`
TotalBytes int64 `json:"total_bytes"`
}
SubscriptionTraffic stores provider quota counters from subscription metadata.
type TransportMode ¶ added in v0.1.7
type TransportMode string
TransportMode identifies the currently active routing transport.
const ( // TransportModeProxy means RouteFlux uses the proxy backend. TransportModeProxy TransportMode = "proxy" // TransportModeZapret means RouteFlux uses Zapret fallback. TransportModeZapret TransportMode = "zapret" // TransportModeDirect means RouteFlux is currently fail-open direct. TransportModeDirect TransportMode = "direct" )
func NormalizeTransportMode ¶ added in v0.1.7
func NormalizeTransportMode(mode TransportMode) TransportMode
NormalizeTransportMode coerces unknown values to direct.
type ZapretSettings ¶ added in v0.1.7
type ZapretSettings struct {
Enabled bool `json:"enabled"`
Selectors FirewallSelectorSet `json:"selectors"`
FailbackSuccessThreshold int `json:"failback_success_threshold"`
}
ZapretSettings stores RouteFlux-managed Zapret fallback preferences.
func CanonicalZapretSettings ¶ added in v0.1.7
func CanonicalZapretSettings(settings ZapretSettings) ZapretSettings
CanonicalZapretSettings normalizes Zapret settings for persisted compatibility.
func CanonicalZapretSettingsWithCatalog ¶ added in v0.1.7
func CanonicalZapretSettingsWithCatalog(settings ZapretSettings, customCatalog map[string]FirewallTargetDefinition) ZapretSettings
CanonicalZapretSettingsWithCatalog expands any legacy service aliases into plain domains and IPv4 selectors so runtime settings stay explicit.
func DefaultZapretSettings ¶ added in v0.1.7
func DefaultZapretSettings() ZapretSettings
DefaultZapretSettings returns the baseline Zapret fallback configuration.
func NormalizeZapretSettings ¶ added in v0.1.7
func NormalizeZapretSettings(settings ZapretSettings) ZapretSettings
NormalizeZapretSettings deep-copies selectors and restores safe defaults.
type ZapretStatus ¶ added in v0.1.7
type ZapretStatus struct {
Installed bool `json:"installed"`
Managed bool `json:"managed"`
Active bool `json:"active"`
ServiceActive bool `json:"service_active"`
TestActive bool `json:"test_active,omitempty"`
ServiceState string `json:"service_state"`
LastReason string `json:"last_reason,omitempty"`
}
ZapretStatus describes the observed Zapret runtime state.
type ZapretTestRestoreState ¶ added in v0.1.7
type ZapretTestRestoreState struct {
ActiveSubscriptionID string `json:"active_subscription_id,omitempty"`
ActiveNodeID string `json:"active_node_id,omitempty"`
Mode SelectionMode `json:"mode,omitempty"`
Connected bool `json:"connected"`
ActiveTransport TransportMode `json:"active_transport,omitempty"`
}
ZapretTestRestoreState keeps the runtime selection that should be restored when a manual Zapret test ends.
type ZapretTestState ¶ added in v0.1.7
type ZapretTestState struct {
Active bool `json:"active"`
Restore ZapretTestRestoreState `json:"restore,omitempty"`
}
ZapretTestState persists whether RouteFlux is in a user-forced Zapret test mode and which runtime selection should be restored afterwards.