From 1de71785239d7b2a7805cfccdc0c51654edf13e2 Mon Sep 17 00:00:00 2001 From: ading2210 Date: Wed, 10 Jan 2024 17:28:17 -0500 Subject: [PATCH] initial support for wsproxy --- client/build.sh | 3 ++- client/main.c | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/client/build.sh b/client/build.sh index 57dfd04..eeddbbc 100755 --- a/client/build.sh +++ b/client/build.sh @@ -12,7 +12,7 @@ WRAPPER_SOURCE="main.js" EXPORTED_FUNCS="_load_certs,_perform_request" RUNTIME_METHODS="addFunction,removeFunction,allocate,ALLOC_NORMAL" COMPILER_OPTIONS="-o $MODULE_FILE -lcurl -lssl -lcrypto -lcjson -lz -lbrotlidec -lbrotlicommon -I $INCLUDE_DIR -L $LIB_DIR" -EMSCRIPTEN_OPTIONS="-lwebsocket.js -sSINGLE_FILE -sASYNCIFY -sALLOW_TABLE_GROWTH -sEXPORTED_FUNCTIONS=$EXPORTED_FUNCS -sEXPORTED_RUNTIME_METHODS=$RUNTIME_METHODS" +EMSCRIPTEN_OPTIONS="-lwebsocket.js -sASYNCIFY -sALLOW_TABLE_GROWTH -sEXPORTED_FUNCTIONS=$EXPORTED_FUNCS -sEXPORTED_RUNTIME_METHODS=$RUNTIME_METHODS" if [ "$1" = "release" ]; then COMPILER_OPTIONS="-O3 $COMPILER_OPTIONS" @@ -34,6 +34,7 @@ $COMPILE_CMD #patch the output to work around some emscripten bugs sed -i 's/err("__syscall_getsockname " \?+ \?fd);//' $MODULE_FILE sed -i 's/function _emscripten_console_error(str) {/& if(UTF8ToString(str).endsWith("__syscall_setsockopt\\n")) return;/' $MODULE_FILE +sed -i "s/var \?opts \?= \?undefined;/& var parts=addr.split('\/');url=url+parts[0]+':'+port;/" $MODULE_FILE #merge compiled emscripten module and wrapper code cp $WRAPPER_SOURCE $OUT_FILE diff --git a/client/main.c b/client/main.c index 9e7f7fc..c94b0d3 100644 --- a/client/main.c +++ b/client/main.c @@ -35,8 +35,6 @@ void perform_request(const char* url, const char* json_params, DataCallback data http_handle = curl_easy_init(); curl_easy_setopt(http_handle, CURLOPT_URL, url); - curl_easy_setopt(http_handle, CURLOPT_PROXY, "socks5h://127.0.0.1:1234"); - curl_easy_setopt(http_handle, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); curl_easy_setopt(http_handle, CURLOPT_CAINFO, "/cacert.pem"); curl_easy_setopt(http_handle, CURLOPT_CAPATH, "/cacert.pem");