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

Add $client modifier support #1761

Closed
ameshkov opened this issue Jun 1, 2020 · 0 comments
Closed

Add $client modifier support #1761

ameshkov opened this issue Jun 1, 2020 · 0 comments
Assignees
Milestone

Comments

@ameshkov
Copy link
Member

ameshkov commented Jun 1, 2020

The idea is to allow adding rules for specific clients as easy as possible.

Spec

The $client modifier allows specifying clients this rule will be working for. It accepts both client names or IP addresses.

The syntax is:

$client=value1|value2|...

You can also specify "restricted" clients by adding a ~ character before the client IP or name. In this case, the rule will not be applied to this client's DNS requests.

$client=~value1

Specifying client names

Client names usually contain spaces or other special characters, that's why you should enclose the name in quotes (both double-quotes and single-quotes are supported). If the client name contains quotes, use \ to escape them. Also, you need to escape commas (,) and pipes (|).

Please note, that when specifying a "restricted" client, you must keep ~ out of the quotes.

Examples

  • @@||*^$client=127.0.0.1 -- unblock everything for localhost
  • ||example.org^$client='Frank\'s laptop' -- block example.org for the client named Frank's laptop only. Note that quote (') must be escaped.
  • ||example.org^$client=~'Mary\'s\, John\'s\, and Boris\s laptops' -- block example.org for everyone except the client named Mary, John, and Boris. Note that comma (,) must be escaped as well.
  • ||example.org^$client=~Mom|~Dad|Kids -- block example.org for Kids, but not for Mom and Dad. This example demonstrates how to specify multiple clients in one rule.
@ameshkov ameshkov added this to the v0.103 milestone Jun 1, 2020
@ameshkov ameshkov self-assigned this Jun 1, 2020
@ameshkov ameshkov changed the title Add $client-ip modifier support Add $client modifier support Jun 1, 2020
@ameshkov ameshkov modified the milestones: v0.103, v0.104 Jun 22, 2020
adguard pushed a commit to AdguardTeam/urlfilter that referenced this issue Jun 23, 2020
The syntax is described here:
AdguardTeam/AdGuardHome#1761

Also, this commit fixes this bug:
AdguardTeam/AdGuardHome#1732

Squashed commit of the following:

commit 89ed791
Author: Andrey Meshkov <[email protected]>
Date:   Tue Jun 23 14:07:12 2020 +0300

    Fix separator: AdguardTeam/AdGuardHome#1732

commit 4016329
Author: Andrey Meshkov <[email protected]>
Date:   Tue Jun 23 13:48:45 2020 +0300

    Added DNSEngine tests

commit 576bf02
Merge: 8ed2f2e 5dd65ce
Author: Andrey Meshkov <[email protected]>
Date:   Tue Jun 23 13:16:10 2020 +0300

    Merge with master

commit 8ed2f2e
Author: Andrey Meshkov <[email protected]>
Date:   Tue Jun 23 13:06:53 2020 +0300

    Added handling new modifier to the DNS engine

commit aedc51a
Author: Andrey Meshkov <[email protected]>
Date:   Tue Jun 23 01:46:56 2020 +0300

    Adding  modifier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant