diff options
| -rw-r--r-- | README.md | 6 | ||||
| -rwxr-xr-x | build.sh | 1 | ||||
| -rw-r--r-- | env.bat | 4 | ||||
| -rw-r--r-- | env.ps1 | 5 | ||||
| -rwxr-xr-x | env.sh | 4 | ||||
| -rw-r--r-- | mullvad-rpc/Cargo.toml | 3 | ||||
| -rw-r--r-- | mullvad-rpc/src/bin/relay_list.rs | 17 | ||||
| -rwxr-xr-x | update-relays.sh | 20 |
8 files changed, 23 insertions, 37 deletions
@@ -279,13 +279,9 @@ sections. ## Building and running mullvad-daemon on desktop -1. Firstly, one should source `env.sh` to set the default environment variables. - One can also source the variables on Powershell with `env.ps1`, - however most of our scripts require bash. +1. Firstly, on MacOS and Linux, one should source `env.sh` to set the default environment variables. ```bash source env.sh - # Or if you use Powershell: - . .\env.ps1 ``` 1. If you are on Windows, then you have to build the C++ libraries before compiling the daemon: @@ -210,6 +210,7 @@ fi ./update-relays.sh + pushd "$SCRIPT_DIR/gui" echo "Installing JavaScript dependencies..." diff --git a/env.bat b/env.bat deleted file mode 100644 index 44483bf993..0000000000 --- a/env.bat +++ /dev/null @@ -1,4 +0,0 @@ -SET SCRIPT_DIR=%~dp0 -SET OPENSSL_STATIC=1 -SET OPENSSL_LIB_DIR=%SCRIPT_DIR%\dist-assets\binaries\x86_64-pc-windows-msvc -SET OPENSSL_INCLUDE_DIR=%SCRIPT_DIR%\dist-assets\binaries\x86_64-pc-windows-msvc\include diff --git a/env.ps1 b/env.ps1 deleted file mode 100644 index 0f8899e404..0000000000 --- a/env.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -$SCRIPT_DIR = split-path -parent $MyInvocation.MyCommand.Definition - -$env:OPENSSL_STATIC="1" -$env:OPENSSL_LIB_DIR="$SCRIPT_DIR\dist-assets\binaries\x86_64-pc-windows-msvc" -$env:OPENSSL_INCLUDE_DIR="$SCRIPT_DIR\dist-assets\binaries\x86_64-pc-windows-msvc\include" @@ -39,7 +39,3 @@ case "$TARGET" in exit 1 ;; esac - -export OPENSSL_STATIC="1" -export OPENSSL_LIB_DIR="$SCRIPT_DIR/dist-assets/binaries/$TARGET" -export OPENSSL_INCLUDE_DIR="$SCRIPT_DIR/dist-assets/binaries/$TARGET/include" diff --git a/mullvad-rpc/Cargo.toml b/mullvad-rpc/Cargo.toml index 2463f78efb..a88c75aff2 100644 --- a/mullvad-rpc/Cargo.toml +++ b/mullvad-rpc/Cargo.toml @@ -31,3 +31,6 @@ talpid-types = { path = "../talpid-types" } [dev-dependencies] filetime = "0.2" tempfile = "3.0" + +[[bin]] +name = "relay_list" diff --git a/mullvad-rpc/src/bin/relay_list.rs b/mullvad-rpc/src/bin/relay_list.rs new file mode 100644 index 0000000000..330d53bc11 --- /dev/null +++ b/mullvad-rpc/src/bin/relay_list.rs @@ -0,0 +1,17 @@ +/// Intended to be used to pre-load a relay list when creating an installer for the Mullvad VPN +/// app. +use futures01::future::Future; +use mullvad_rpc::{MullvadRpcRuntime, RelayListProxy}; + +fn main() { + let mut runtime = MullvadRpcRuntime::new("dist-assets/api_root_ca.pem".as_ref()) + .expect("Failed to load runtime"); + + let relay_list_request = RelayListProxy::new(runtime.mullvad_rest_handle()).relay_list(); + + let relay_list = relay_list_request + .wait() + .expect("Failed to fetch relay list"); + + println!("{}", serde_json::to_string_pretty(&relay_list).unwrap()); +} diff --git a/update-relays.sh b/update-relays.sh index 711afe342a..2a2fde13fe 100755 --- a/update-relays.sh +++ b/update-relays.sh @@ -1,23 +1,5 @@ #!/usr/bin/env bash echo "Updating relay list..." -set +e -read -d '' JSONRPC_CODE <<-JSONRPC_CODE -var buff = ""; -process.stdin.on('data', function (chunk) { - buff += chunk; -}) -process.stdin.on('end', function () { - var obj = JSON.parse(buff); - var output = JSON.stringify(obj.result, null, ' '); - process.stdout.write(output); -}) -JSONRPC_CODE set -e - -JSONRPC_RESPONSE="$(curl -X POST \ - --fail \ - -H "Content-Type: application/json" \ - -d '{"jsonrpc": "2.0", "id": "0", "method": "relay_list_v3"}' \ - https://api.mullvad.net/rpc/)" -echo $JSONRPC_RESPONSE | node -e "$JSONRPC_CODE" > dist-assets/relays.json +cargo run -p mullvad-rpc --bin relay_list > dist-assets/relays.json |
