summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEmīls <emils@mullvad.net>2023-05-22 14:06:44 +0200
committerEmīls <emils@mullvad.net>2023-05-22 14:06:44 +0200
commit19ecc5e09d112b5a3486fc027f23b3f3a03b986e (patch)
tree7084b3911b7e13b3e481c3a124a02c0d779dbdeb
parentd6ecc3f4770541eeb2e7fdf0b7361411ab218b97 (diff)
parentd6164463b169d756c09958f430732fe061a87071 (diff)
downloadmullvadvpn-19ecc5e09d112b5a3486fc027f23b3f3a03b986e.tar.xz
mullvadvpn-19ecc5e09d112b5a3486fc027f23b3f3a03b986e.zip
Merge branch 'fix-cargo-build-script-to-properly-ios-174'
-rw-r--r--ios/MullvadREST/shadowsocks-proxy/Cargo.toml2
-rw-r--r--ios/MullvadREST/shadowsocks-proxy/build.rs4
-rw-r--r--ios/MullvadREST/shadowsocks-proxy/include/shadowsocks.h13
3 files changed, 16 insertions, 3 deletions
diff --git a/ios/MullvadREST/shadowsocks-proxy/Cargo.toml b/ios/MullvadREST/shadowsocks-proxy/Cargo.toml
index 364952f73c..48f2c92539 100644
--- a/ios/MullvadREST/shadowsocks-proxy/Cargo.toml
+++ b/ios/MullvadREST/shadowsocks-proxy/Cargo.toml
@@ -21,5 +21,5 @@ log = "0.4"
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
oslog = "0.2"
-[target.'cfg(target_os = "ios")'.build-dependencies]
+[target.'cfg(any(target_os = "macos", target_os = "ios"))'.build-dependencies]
cbindgen = "0.24"
diff --git a/ios/MullvadREST/shadowsocks-proxy/build.rs b/ios/MullvadREST/shadowsocks-proxy/build.rs
index 3a0ffb572b..7154b2d785 100644
--- a/ios/MullvadREST/shadowsocks-proxy/build.rs
+++ b/ios/MullvadREST/shadowsocks-proxy/build.rs
@@ -1,4 +1,4 @@
-#[cfg(target_os = "ios")]
+#[cfg(any(target_os = "macos", target_os = "ios"))]
fn main() {
let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
@@ -10,5 +10,5 @@ fn main() {
.write_to_file("include/shadowsocks.h");
}
-#[cfg(not(target_os = "ios"))]
+#[cfg(not(any(target_os = "macos", target_os = "ios")))]
fn main() {}
diff --git a/ios/MullvadREST/shadowsocks-proxy/include/shadowsocks.h b/ios/MullvadREST/shadowsocks-proxy/include/shadowsocks.h
index eecb240d67..487199ecc5 100644
--- a/ios/MullvadREST/shadowsocks-proxy/include/shadowsocks.h
+++ b/ios/MullvadREST/shadowsocks-proxy/include/shadowsocks.h
@@ -8,6 +8,14 @@ typedef struct ProxyHandle {
uint16_t port;
} ProxyHandle;
+/**
+ * # Safety
+ * `addr`, `password`, `cipher` must be valid for the lifetime of this function call and they must
+ * be backed by the amount of bytes as stored in the respective `*_len` parameters.
+ *
+ * `proxy_config` must be pointing to a valid memory region for the size of a `ProxyHandle`
+ * instance.
+ */
int32_t start_shadowsocks_proxy(const uint8_t *addr,
uintptr_t addr_len,
uint16_t port,
@@ -17,4 +25,9 @@ int32_t start_shadowsocks_proxy(const uint8_t *addr,
uintptr_t cipher_len,
struct ProxyHandle *proxy_config);
+/**
+ * # Safety
+ * `proxy_config` must be pointing to a valid instance of a `ProxyInstance`, as instantiated by
+ * `start_shadowsocks_proxy`.
+ */
int32_t stop_shadowsocks_proxy(struct ProxyHandle *proxy_config);