Refactor all plugins to functional options constructors#324
Draft
Codex wants to merge 7 commits into
Draft
Conversation
Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
…t/cutter Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
… plugins Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
Codex created this pull request from a session on behalf of
Loyalsoldier
April 28, 2026 17:56
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactors plugin implementations under
plugin/*to consistently use the functional options pattern, aligned with the latestsingboxplugin refactor. Preserves existing config semantics, including required/optional args and mutually-exclusive option relationships derived from the priornew**(action, data)constructors.API Shape (All Plugins)
New*constructors accepting...lib.InputOption/...lib.OutputOptionWith*option setters for each plugin’s configurable fieldsNew*FromBytes(action, data)and wireRegister*ConfigCreatorto that entrypointPlugins Updated
plugin/mihomo:MRSIn,MRSOutplugin/plaintext:text,json,clashRuleSet*,surgeRuleSet(input/output)plugin/special:private,stdin,stdout,lookup,test,cutterplugin/v2ray:GeoIPDatIn,GeoIPDatOutplugin/maxmind: MMDB in/out (MaxMind/DB-IP/IPInfo) + GeoLite2 CSV (country/ASN)Option Semantics Preserved
inputDirvsname/uri, JSONjsonPathrequired, defaults for paths/output dirs/names/extensions).Example (new construction style):