diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2019-07-04 11:13:35 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2019-07-04 12:59:18 +0200 |
| commit | 863a68511e534f4f1e50da5401afd2444a447600 (patch) | |
| tree | fbda3e54ecc24c4f3fa0477eabca57071771f897 | |
| parent | 0edd2904a54f56b41afcb41aef8d5e8fbf485f4e (diff) | |
| download | mullvadvpn-863a68511e534f4f1e50da5401afd2444a447600.tar.xz mullvadvpn-863a68511e534f4f1e50da5401afd2444a447600.zip | |
Sort problem report metadata
| -rw-r--r-- | mullvad-problem-report/src/lib.rs | 8 | ||||
| -rw-r--r-- | mullvad-problem-report/src/metadata.rs | 6 | ||||
| -rw-r--r-- | mullvad-rpc/src/lib.rs | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/mullvad-problem-report/src/lib.rs b/mullvad-problem-report/src/lib.rs index 42a369fbba..344d651e41 100644 --- a/mullvad-problem-report/src/lib.rs +++ b/mullvad-problem-report/src/lib.rs @@ -13,7 +13,7 @@ use regex::Regex; use std::{ borrow::Cow, cmp::min, - collections::{HashMap, HashSet}, + collections::{BTreeMap, HashSet}, ffi::OsStr, fs::{self, File}, io::{self, BufWriter, Read, Seek, SeekFrom, Write}, @@ -285,7 +285,7 @@ fn write_problem_report(path: &Path, problem_report: &ProblemReport) -> io::Resu #[derive(Debug)] struct ProblemReport { - metadata: HashMap<String, String>, + metadata: BTreeMap<String, String>, logs: Vec<(String, String)>, log_paths: HashSet<PathBuf>, redact_custom_strings: Vec<String>, @@ -409,14 +409,14 @@ impl ProblemReport { /// Tries to parse out the metadata map from a string that is supposed to be a report written by /// this struct. - pub fn parse_metadata(report: &str) -> Option<HashMap<String, String>> { + pub fn parse_metadata(report: &str) -> Option<BTreeMap<String, String>> { // IMPORTANT: Make sure this implementation stays in sync with `write_to` above. const PATTERN: &str = ": "; let mut lines = report.lines(); if lines.next() != Some("System information:") { return None; } - let mut metadata = HashMap::new(); + let mut metadata = BTreeMap::new(); for line in lines { // Abort on first empty line, as this is the separator between the metadata and the // first log diff --git a/mullvad-problem-report/src/metadata.rs b/mullvad-problem-report/src/metadata.rs index 8153e7671f..3bcb44948a 100644 --- a/mullvad-problem-report/src/metadata.rs +++ b/mullvad-problem-report/src/metadata.rs @@ -1,10 +1,10 @@ -use std::{collections::HashMap, process::Command}; +use std::{collections::BTreeMap, process::Command}; pub const PRODUCT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/product-version.txt")); -pub fn collect() -> HashMap<String, String> { - let mut metadata = HashMap::new(); +pub fn collect() -> BTreeMap<String, String> { + let mut metadata = BTreeMap::new(); metadata.insert("id".to_owned(), uuid::Uuid::new_v4().to_string()); metadata.insert( "mullvad-product-version".to_owned(), diff --git a/mullvad-rpc/src/lib.rs b/mullvad-rpc/src/lib.rs index 4e26bcd125..6261ef9c10 100644 --- a/mullvad-rpc/src/lib.rs +++ b/mullvad-rpc/src/lib.rs @@ -13,7 +13,7 @@ use jsonrpc_client_core::{expand_params, jsonrpc_client}; use jsonrpc_client_http::{header::Host, HttpTransport, HttpTransportBuilder}; use mullvad_types::{account::AccountToken, relay_list::RelayList, version}; use std::{ - collections::HashMap, + collections::BTreeMap, net::{IpAddr, Ipv4Addr}, path::{Path, PathBuf}, time::Duration, @@ -113,7 +113,7 @@ jsonrpc_client!(pub struct ProblemReportProxy { email: &str, message: &str, log: &str, - metadata: &HashMap<String, String>) + metadata: &BTreeMap<String, String>) -> RpcRequest<()>; }); |
