Reorder functions

This commit is contained in:
Andrey Golovizin 2021-06-29 23:16:08 +02:00
parent fb2fc57715
commit 12a9965f10

View file

@ -108,12 +108,6 @@ fn list_endpoints(opts: &Opts) -> Result<(), anyhow::Error> {
Ok(())
}
fn get_locations() -> Result<Locations, anyhow::Error> {
let url = format!("{}/locations", BASE_URL);
let locations: Locations = ureq::get(&url).call()?.into_json()?;
Ok(locations)
}
fn get_config(_opts: &Opts, config_opts: &ConfigOpts) -> Result<(), anyhow::Error> {
let locations = get_locations()?;
let location = locations
@ -164,6 +158,12 @@ fn check(opts: &Opts) -> Result<(), anyhow::Error> {
Ok(())
}
fn get_locations() -> Result<Locations, anyhow::Error> {
let url = format!("{}/locations", BASE_URL);
let locations: Locations = ureq::get(&url).call()?.into_json()?;
Ok(locations)
}
fn generage_keys() -> Result<WireguardKeyPair, anyhow::Error> {
let privkey = process::Command::new("wg").arg("genkey").output()?.stdout;
let mut pubkey_cmd = process::Command::new("wg")