Skip to content

Allow disabling proxy rules without deleting them - #195

Merged
wiresock merged 15 commits into
mainfrom
feature/disable-proxy-rules
Nov 30, 2026
Merged

wiresock merged 15 commits into
mainfrom
feature/disable-proxy-rules

Conversation

@wiresock

@wiresock wiresock commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds an optional enabled flag so a proxy rule can be turned off without deleting it (#191). The release version is bumped to 2.8.0.

  • enabled defaults to true. Omitted, null, or true means the rule is active, so existing configurations behave as before. Only "enabled": false is written when the configuration is saved.
  • The engine skips disabled rules at startup and logs each skipped rule at Info.
  • Disabled rules are still validated (a broken endpoint remains an error), so they can be re-enabled safely.

Configuration

{
  "proxies": [
    {
      "id": "office",
      "appNames": ["firefox"],
      "socks5ProxyEndpoint": "10.0.0.1:1080"
    },
    {
      "enabled": false,
      "appNames": ["firefox"],
      "socks5ProxyEndpoint": "10.0.0.2:1080"
    }
  ]
}

The strings "true" and "false" (any letter case) are accepted and saved as booleans. Any other value (a number, "yes", an object, and so on), or two keys that differ only in case (enabled and Enabled), is ignored: the rule stays enabled, as earlier releases ran it, and validation reports an ENABLED_FLAG_IGNORED warning. Saving from the GUI drops the ignored value.

Validation

  • Cross-rule overlap and shadowing, and catch-all ordering (CATCH_ALL_NOT_LAST), consider only enabled rules, so an unused alternative for the same application can be kept disabled beside the active one. Duplicate matches within a single rule are still reported whether or not the rule is enabled.
  • The GUI (rule row and rule editor) also warns when a disabled catch-all is not last, because it would shadow every later rule if it were enabled again or if the file were run by ProxiFyre 2.7.0 or earlier. The validator itself does not report that case, because a disabled catch-all shadows nothing at startup.
  • If every rule is disabled, the configuration is still valid and the service starts without proxying anything; validation reports a PROXIES_ALL_DISABLED warning. Exception: in DNS Proxy mode the rule selected by dns.proxyId must stay enabled. If it is disabled, validation reports the DNS_PROXY_DISABLED error (on that rule as well as in the full list) and the service does not start. DNS is never switched to another proxy automatically. In Direct mode a disabled rule with an id is fine.

GUI

  • The routing grid has an Enabled checkbox column. Toggling it (mouse or Space) updates the rule immediately and marks the configuration as changed; Save or Apply & Restart applies it. After a grid rebuild, the current cell is moved off the checkbox so Space does not toggle a rule by accident. A null entry's checkbox is read-only.
  • Toggling updates the row in place, without Rows.Clear(), so the .NET Framework DataGridViewCheckBoxCell is not detached while its key or mouse handler is still using it.
  • Disabled rows are shown in gray. A double-click on the checkbox itself toggles it; a double-click elsewhere in the Enabled cell, or on a read-only (null) checkbox, opens the editor, as the other cells do.
  • The rule editor has an Enable this rule checkbox on the OK/Cancel row, so the dialog keeps its previous size and opens focused on the applications list. Clearing the checkbox of the DNS proxy rule blocks OK.
  • The GUI will not uncheck the DNS proxy rule in the grid either: the checkbox is reverted and a message explains why. Disabled rules are marked "(disabled)" in the DNS proxy selector. If Proxy mode already points at a disabled rule, the DNS group shows a notice with an Enable rule N button.

Compatibility / upgrade notes

  • When upgrading to 2.8.0, a "enabled": false value that an earlier version ignored takes effect. If that rule is the DNS proxy in Proxy mode, the service does not start until the rule is enabled.
  • Older releases (ProxiFyre 2.7.0 and earlier) do not know enabled and ignore it. After downgrading, rules saved with "enabled": false become active again and traffic is routed through them. A disabled catch-all that is not last would then shadow every later rule; move it last or delete disabled rules before downgrading. This should be mentioned in the release notes.

README, docs/configuration.md, and docs/gui.md are updated to match.

Testing

  • CI on head bfb5daa is green: Build and publish release (x86, x64, and ARM64, plus artifact verification) and Native tests (netlib-tests Debug/Release and portable-native-tests) all passed. The x64 job ran the managed tests on Windows: 452 passed, 452 total.
  • This branch also retries and caches vcpkg and installer prerequisite downloads, which had been failing intermittently on hosted runners.
  • Not done: no real run of the service with the NDISRD driver.

Closes #191

Add an optional per-rule enabled flag (default true) so a rule can be
turned off, saved, and left in app-config.json. The engine skips
disabled rules at startup and logs each one. Overlap and catch-all
warnings consider only enabled rules. DNS Proxy mode rejects a
disabled selected proxy. The GUI exposes this as a checkbox on the
routing grid and in the rule editor.
Rebuilding the routing grid from CellValueChanged detached the check box
cell that was still handling the Space key, which crashed the GUI on
.NET Framework. Toggling now refreshes row styles, warnings and the DNS
proxy choices in place.

Also treat "enabled": null as enabled, reject case variants of the
enabled key, show DNS_PROXY_DISABLED on the rule's row, warn when every
rule is disabled, gate the disabled-rule log line on the Info level, skip
the editor's catch-all ordering warning for a disabled rule, fix the rule
editor tab order and align docs/gui.md with the editor's checkbox label.
- Reject non-boolean "enabled" values with an error naming the rule and
  property; null still means enabled, and "true"/"false" strings are
  accepted and saved as booleans.
- Move the rule editor's Enable checkbox to the OK/Cancel row so the
  dialog keeps its previous height and opens focused on the
  applications list instead of the checkbox.
- Document that DNS Proxy mode blocks startup when its rule is disabled,
  and that within-rule duplicates are still reported for disabled rules.
- Replace a vacuous validator assertion with positive controls.
…nt downgrade

The rule editor warned that an enabled catch-all shadows later rules
whenever any rule followed it, while CATCH_ALL_NOT_LAST now considers only
enabled rules. The editor now receives the later rules and warns only when
an enabled rule follows, so both report the same condition.

A disabled catch-all that is not last shadows nothing today, but would
shadow every later rule if re-enabled or run by ProxiFyre 2.7.0 or earlier,
which ignore "enabled". The editor now warns about that case, and the docs
explain that older versions run disabled rules.
- Validator: keep checking the DNS proxy's settings after DNS_PROXY_DISABLED,
  so re-enabling the rule does not reveal errors that were there all along.
- Validator: PROXIES_ALL_DISABLED now fires when null entries sit beside
  disabled rules (still not for a list of only null entries).
- Rule editor: block clearing "Enable this rule" on the rule DNS Proxy mode
  uses, instead of reporting the rule as valid until OK.
- Rule list: show the disabled-catch-all-not-last warning on the row, so
  disabling it from the grid checkbox is flagged like it is in the editor.
- Rule list: a null entry's Enabled box is unchecked.
- Engine log: only an explicit "" is shown as <catch-all>; null and
  whitespace entries are left out of the disabled-rule message.
- Model: drop the no-op Order = -1 on Enabled.
- Serializer: an "enabled" value that is not one true/false (a number,
  "yes", or keys differing only in case) no longer fails the load. Earlier
  releases ignored the key, so the rule stays enabled, the validator reports
  ENABLED_FLAG_IGNORED, and the GUI drops the value when it saves.
- Rule list: the Enabled check box of the DNS proxy rule cannot be cleared,
  matching the rule editor; the change is undone with an explanation.
- Rule list: a check box change the rule cannot follow is undone instead of
  leaving the row out of step with the configuration.
- Rule list: after a load, the current cell is moved off the Enabled check
  box so Space does not silently toggle rule 1.
- Rule editor: the blocking DNS proxy error is listed first so it is not cut
  off by the fixed-size validation label.
- Version 2.8.0: the docs and warnings already say 2.7.0 and earlier
  ignore "enabled"; documented the upgrade effect of a previously ignored
  "enabled": false.
@wiresock
wiresock force-pushed the feature/disable-proxy-rules branch from 2607553 to 7f8732b Compare November 30, 2026 20:14
- Rule list: toggling a rule's Enabled check box clears a flag that was
  ignored at load, so its ENABLED_FLAG_IGNORED warning no longer stays on a
  rule the user has just set.
- Serializer: with several "proxies" keys differing only in case, Json.NET
  appends every array to one list (a null value starts a new one); ignored
  flags are now keyed by that combined position, not the index within each
  array, so the warning is reported on the rule that has the flag.
… proxy choice

- CloneRule copies IgnoredEnabledFlag, so opening a rule in the editor or
  duplicating it no longer hides its ENABLED_FLAG_IGNORED warning; the
  editor clears the flag only when the user changes Enable this rule.
- Choosing a disabled rule as the DNS proxy, or switching DNS to Proxy mode
  with one selected, offers to enable that rule instead of silently
  producing DNS_PROXY_DISABLED.
- ENABLED_FLAG_IGNORED abbreviates the ignored value to 64 characters so a
  large object cannot flood the grid or the service log.
…inal

- The offer to enable a disabled DNS proxy rule is no longer raised on every
  selection change, which asked about each rule passed with the arrow keys or
  the mouse wheel. It is asked once, when the DNS mode or proxy list closes or
  loses focus and DNS Proxy mode still points at a disabled rule.
- ENABLED_FLAG_IGNORED no longer splits a surrogate pair when abbreviating.
- A duplicate rule id is reported with the rule's position across all
  "proxies" keys, as ignored enabled flags already are.
…g on duplicates

- DnsChoiceCommitted always defers the check for a pending offer. Windows
  can raise DropDownClosed before the SelectedIndexChanged it commits, so
  checking the flag immediately missed a disabled rule picked with the mouse.
- A duplicated rule no longer reports the original's ignored enabled flag;
  the copy was never read from the file and is saved as plainly enabled.
…re-picked

- After Yes to enabling the DNS proxy rule, the edit is applied only if no
  service or configuration operation happened while the question was open,
  as for the other confirmation dialogs.
- Closing the DNS proxy list on the disabled rule already shown now offers to
  enable it too; choosing it again raises no selection change.
- The modal offer to enable a disabled DNS proxy rule is replaced by a notice
  in the DNS group, shown in place of the explanation while DNS Proxy mode
  points at a disabled rule, with an Enable rule button. Choosing in the DNS
  boxes with the keyboard, mouse wheel, or list no longer raises a question,
  repeats it on Escape, or can swallow the click that moved focus.
- Double-clicking the Enabled cell outside the check box opens the rule
  editor like the other cells; a double-click on the box itself still only
  toggles it.
A null entry's Enabled check box is read-only and does not toggle, so a
double-click on it now opens the editor, where the entry is replaced, as a
double-click anywhere else on the row does.
GitHub release downloads (vcpkg.exe during vcpkg bootstrap, and the Windows
Packet Filter MSI in Build-Installer.ps1) intermittently fail on hosted
runners with HTTP 618, failing a build before it starts.

- New composite action .github/actions/setup-vcpkg, used by both workflows:
  retries the vcpkg clone, bootstrap, and package install with backoff, and
  caches the bootstrapped vcpkg.exe keyed on the vcpkg-tool release the clone
  pins.
- Build-Installer.ps1: prerequisites are downloaded with retry and backoff,
  and an optional -DownloadCacheDirectory reuses a copy that matches the
  pinned size and hashes (content-addressed by SHA-256). The existing size,
  hash, version, and signature checks still apply to every file.
- The release workflow caches that directory per platform and no longer
  cancels the other matrix legs when one fails.
A single package made the split result a scalar string, which vcpkg
received mangled. Force an array and pass it as plain arguments.
@wiresock
wiresock merged commit 4b36e3a into main Nov 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Отключение правил без их удаления

1 participant