apernet / OpenGFW

OpenGFW is a flexible, easy-to-use, open source implementation of GFW (Great Firewall of China) on Linux
https://gfw.dev/
Mozilla Public License 2.0
9.47k stars 711 forks source link

Add CIDR support for expr #62

Closed KujouRinka closed 6 months ago

KujouRinka commented 6 months ago

I add CIDR support for expr. Here's example:

- name: block cidr
  action: block
  expr: cidr(string(ip.dst), "192.168.0.0/16")

I use Patch to parse CIDR string at expr compile time, for this avoids the use of lock and repeated parsing of the CIDR string.

tobyxdd commented 6 months ago

Much appreciated!