Updated "ipaddress"

garry-ut99 2024-11-03 17:03:55 +00:00
parent 7aa51bf6e7
commit c8484b6949

@ -587,8 +587,8 @@ The value assigned to `ipaddress` can be ...
- ... a plain string which must match exactly a given IP address<br>
e.g. `ipaddress=192.168.1.1` to match exactly IP address `192.168.1.1`
- ... a plain string followed by a wildcard to match IP addresses starting with the pattern<br>
e.g. `ipaddress=192.168.*` to match IP addresses starting with `192.168.`
- ... a plain string followed by a wildcard at the end to match IP addresses starting with the pattern<br>
e.g. `ipaddress=192.168.*` to match IP addresses starting with `192.168.` (wildcards inside: `192.168.*.1` or at the beginning: `*.168.1.1` are not supported, but a regex can be used in such cases)
- ... a regex which will be matched against the IP address<br>
e.g. `ipaddress=/^192.168.1.\d{1-2}/` to match IP address between `192.168.1.0` and `192.168.1.99`.
- ... `lan` to match [IP addresses reserved for private networks](https://en.wikipedia.org/wiki/Reserved_IP_addresses)<br>
@ -606,6 +606,21 @@ Examples:
Cached resources do not have a valid IP address and thus can't be a match to `ipaddress` option.
The `ipaddress` value is not validated, so you can enter anything. Only one ipv4 or ipv6 address or regex is valid.
Exclusions `~` and `|` operators are not supported, e.g. `ipaddress=~192.168.1.1` or `ipaddress=192.168.1.1|192.168.8.4`, however as partial solution a regex can be used, examples:
```adb
*$ipaddress=/^(?!95\.216\.7\.22|9\.9\.9\.9).*$/
*$ipaddress=/^((?!95\.216\.7\.22|9\.9\.9\.9).)*$/
```
but the above solution is not perfect:
- the first above filter doesn't match/exclude `95.216.7.22y` where `y` is any digit, for example `95.216.7.228`
- the second above filter even worse: doesn't match/exclude: `x95.216.7.22y` where `x` and/or `y` is any digit, for example `195.216.7.22` or `95.216.7.221` or `195.216.7.221`.
But still some users might find them useful.
<details><summary>Technical notes</summary>
First commit in [1.59.1b15](https://github.com/gorhill/uBlock/commit/c6dedd253f). Related commit: [1.59.1b17](https://github.com/gorhill/uBlock/commit/030d7334e4), [1.59.1b19](https://github.com/gorhill/uBlock/commit/6acf97bf51), [1.59.1rc1](https://github.com/gorhill/uBlock/commit/6a042f152b513bbf5b3c8623ea3fbe2574ac0e24), [1.59.1rc4*](https://github.com/uBlockOrigin/uBlock-issues/issues/3381).