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

Whitelist domains #172

Closed
eminfedar opened this issue Oct 24, 2023 · 4 comments
Closed

Whitelist domains #172

eminfedar opened this issue Oct 24, 2023 · 4 comments

Comments

@eminfedar
Copy link

eminfedar commented Oct 24, 2023

Hello, I want to prevent access every website except white list.

I have tried a config like this:

address /google.com/-
address /*/#

Which I thought blocks every address but google.com. But it didn't work.

How can I create a whitelist of domains and block everything but them?

Edit: It can be something like server 1.1.1.1 but only for these ... domains? Other domains like just doesn't exists.

@mokeyish
Copy link
Owner

It's not supported yet, but it looks like it would be fairly simple to implement.

@mokeyish
Copy link
Owner

Now, it's supported.

@eminfedar
Copy link
Author

Now, it's supported.

Great! Any usage examples?

@mokeyish
Copy link
Owner

Same as you write above.

smartdns-rs/src/dns_conf.rs

Lines 2447 to 2464 in 018c977

fn test_config_address_whitelist_mode() {
let cfg = SmartDnsConfig::builder()
.with("address /google.com/-")
.with("address /*/#")
.build();
assert_eq!(
cfg.find_domain_rule(&Name::from_str("cloudflare.com").unwrap())
.and_then(|r| r.get(|n| n.address)),
Some(DomainAddress::SOA)
);
assert_eq!(
cfg.find_domain_rule(&Name::from_str("google.com").unwrap())
.and_then(|r| r.get(|n| n.address)),
Some(DomainAddress::IGN)
);
}

haven't release new version yet, but you can download from here.

https://github.com/mokeyish/smartdns-rs/actions/runs/6682783488

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

No branches or pull requests

2 participants