diff options
| author | Emīls Piņķis <emils@mullvad.net> | 2018-07-17 12:26:33 +0100 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2018-07-17 12:26:33 +0100 |
| commit | 0d5827f2d9be38e7c48deed7427feb189f13fcd6 (patch) | |
| tree | b5ade94eb9f6f32cc9ca7e64d972edf26b69b9a3 | |
| parent | 508fc0775e62f9361df2814cad5229b7706d4095 (diff) | |
| parent | f4125b8f3776ecdabd7a7eb0913ae47a39ab5c78 (diff) | |
| download | mullvadvpn-0d5827f2d9be38e7c48deed7427feb189f13fcd6.tar.xz mullvadvpn-0d5827f2d9be38e7c48deed7427feb189f13fcd6.zip | |
Merge branch 'replace-list-relays-with-curl'
| -rw-r--r-- | README.md | 8 | ||||
| -rwxr-xr-x | build.sh | 8 | ||||
| -rw-r--r-- | mullvad-daemon/src/bin/list-relays.rs | 34 |
3 files changed, 12 insertions, 38 deletions
@@ -86,8 +86,12 @@ homebrew: ``` 1. Get the latest list of Mullvad relays: - ``` - ./target/debug/list-relays > dist-assets/relays.json + ```bash + curl -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": "0", "method": "relay_list"}' \ + https://api.mullvad.net/rpc/ \ + -o dist-assets/relays.json ``` 1. Run the daemon debug binary with verbose logging to the terminal with: @@ -86,7 +86,7 @@ sed -i.bak \ mullvad-daemon/Cargo.toml \ mullvad-cli/Cargo.toml \ mullvad-problem-report/Cargo.toml - + SEMVER_ARRAY=($(echo $SEMVER_VERSION | sed -r 's/[.-]+/ /g')) SEMVER_MAJOR=${SEMVER_ARRAY[0]} @@ -131,7 +131,11 @@ if [[ "$(uname -s)" != "MINGW"* ]]; then fi echo "Updating relay list..." -MULLVAD_RESOURCE_DIR="$SCRIPT_DIR/dist-assets/" ./target/release/list-relays > dist-assets/relays.json +curl -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": "0", "method": "relay_list"}' \ + https://api.mullvad.net/rpc/ \ + -o dist-assets/relays.json echo "Installing JavaScript dependencies..." yarn install diff --git a/mullvad-daemon/src/bin/list-relays.rs b/mullvad-daemon/src/bin/list-relays.rs deleted file mode 100644 index a330297e20..0000000000 --- a/mullvad-daemon/src/bin/list-relays.rs +++ /dev/null @@ -1,34 +0,0 @@ -//! # License -//! -//! Copyright (C) 2017 Amagicom AB -//! -//! This program is free software: you can redistribute it and/or modify it under the terms of the -//! GNU General Public License as published by the Free Software Foundation, either version 3 of -//! the License, or (at your option) any later version. - -#[macro_use] -extern crate error_chain; - -extern crate mullvad_paths; -extern crate mullvad_rpc; -extern crate serde_json; - -error_chain!{} - -quick_main!(run); - -fn run() -> Result<()> { - let ca_path = mullvad_paths::resources::get_api_ca_path(); - let mut rpc_manager = mullvad_rpc::MullvadRpcFactory::new(ca_path); - let rpc_http_handle = rpc_manager - .new_connection() - .chain_err(|| "Unable to connect RPC")?; - let mut client = mullvad_rpc::RelayListProxy::new(rpc_http_handle); - - let relays = client - .relay_list() - .call() - .chain_err(|| "Error during RPC call")?; - println!("{}", serde_json::to_string_pretty(&relays).unwrap()); - Ok(()) -} |
