Skip to content

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

Open
@QSchulz

Description

@QSchulz

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions