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

Document behavior when domain matches 2+ domains in conf #8

Open
QSchulz opened this issue May 1, 2024 · 0 comments
Open

Document behavior when domain matches 2+ domains in conf #8

QSchulz opened this issue May 1, 2024 · 0 comments

Comments

@QSchulz
Copy link
Contributor

QSchulz commented May 1, 2024

Considering that there's support for regex, it could be possible to have a domain that matches multiple domains in the configuration file. What happens in that case?

sniproxy/src/config.rs

Lines 97 to 99 in b16180e

pub(crate) fn get_route(&self, domain: &str) -> Option<&Route> {
self.routes.iter().find(|r| r.domains.is_match(domain))
}

seems to indicate only the first traversed route which has a domain matching the domain will be returned.

  1. Is the serdes guaranteed to always return the data in a reproducible manner (ideally top to bottom as in the config file?)
  2. is iter() guaranteed to always iterate over the data generated by serdes in a reproducible manner (ideally same order as the data generated by serdes)?

If it is to be documented, maybe a test would be a nice thing to have as well?

A use case could be:

  • have a specific subdomain in one route, e.g. "my.example.com" -> backend:address = "10.10.10.10:443"
  • have all other subdomains in a default route, e.g. "*.example.com" -> backend:address = "11.11.11.11:443"

Note that I do not have a use for this right now, but just thought of it while reading through the denylist where it could make sense to have a denylist for one (or several subdomains) but not by default. (Or vice-versa).

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

1 participant