Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remote logic rules cannot be parsed #837

Merged
merged 1 commit into from Oct 31, 2023
Merged

fix: remote logic rules cannot be parsed #837

merged 1 commit into from Oct 31, 2023

Conversation

HolgerHuo
Copy link

Logic rules like AND,OR,SUB-RULE, etc have a different rule structure than traditional rules. The parser used in ./config/config.go was updated accordingly when adding these rule types but the parser used in ./rules/provider/parse.go was not, making logic rules in remote providers not working as expected.

@Skyxim
Copy link
Collaborator

Skyxim commented Oct 31, 2023

Are there any specific examples of errors? If you change it like this, it will affect the nested logic rules.

@HolgerHuo
Copy link
Author

For example, if we have a remote rule provider like the following:

payload:
  - AND,((IP-CIDR,192.168.1.0/24),(RULE-SET,Microsoft))

@xishang0128
Copy link
Contributor

It is a mistake to introduce complex rules into a rule set, which will lead to difficulty in parsing and various problems.

@HolgerHuo
Copy link
Author

It is a mistake to introduce complex rules into a rule set, which will lead to difficulty in parsing and various problems.

As is in my case, I use rule sets for separating routing logics from clash core as we currently have no api for modifying rules from REST api.

If you change it like this, it will affect the nested logic rules.

Did you mean the params var? I only saw it used in a few specific rule types. In which way can it affect other parts of the code?
image

@Skyxim
Copy link
Collaborator

Skyxim commented Oct 31, 2023

@HolgerHuo I seem to have found another error. Originally, RULE-SET did not allow nesting of RULE-SET. It may have been lost during reconstruction. If nested, it will be impossible to determine whether the provider corresponding to RULE-SET exists.

@Skyxim Skyxim merged commit 8ff476a into MetaCubeX:Alpha Oct 31, 2023
@HolgerHuo
Copy link
Author

It's great that those have been fixed now!

@HolgerHuo HolgerHuo deleted the fix-remote-logic-rules branch October 31, 2023 15:26
Larvan2 pushed a commit that referenced this pull request Dec 2, 2023
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.

None yet

3 participants