Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strip link-local zone ids from IPv6 socket addrs
This is a fairly ugly hack to temporarily work around the issue #10. Until now Rust doesn't support so-called zone-ids[1] in link-local IPv6 socket-addresses and has a pending RFC on this topic. As I'm encountering this issue on one of my machines I decided to work around this issue (for now) by removing the zone-id from the IPv6 address. This won't harm any other cases as `regex.replace_all` simply returns the input if the regex doesn't match: ``` >> extern crate regex; >> let re = regex::Regex::new(r"^\[(?P<ip>[A-Fa-f0-9:]+)%(.*)\]:(?P<port>[0-9]+)$"); >> let rs = re.replace_all("fairly unrelated stuff", "[$ip]:$port"); >> rs "fairly unrelated stuff" ``` Please note that (1) this regex isn't RFC-compliant[2] and is just a heuristic to remove zone-ids that currently break this exporter and (2) this is something that probably shouldn't be merged as-is. I mainly pushed this since I needed a workaround for this issue (and others probably too), but it may be better to wait for proper support from the language. [1] https://tools.ietf.org/html/rfc4007#section-11
- Loading branch information