mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-13 14:30:02 -04:00
add support for socks5, socks4, and http proxies
This commit is contained in:
parent
9f033fc848
commit
4d64b27a82
9 changed files with 58 additions and 5 deletions
|
@ -104,4 +104,14 @@ function c_func_str(target, args=[]) {
|
|||
let str = UTF8ToString(ptr);
|
||||
_free(ptr);
|
||||
return str;
|
||||
}
|
||||
|
||||
//ensure that the proxy url has a valid protocol
|
||||
function check_proxy(proxy) {
|
||||
if (typeof proxy === "string" || proxy instanceof String) {
|
||||
let protocol = new URL(proxy).protocol;
|
||||
if (!["socks5h:", "socks4a:", "http:"].includes(protocol)) {
|
||||
throw new TypeError("Only socks5h, socks4a, and http proxies are supported.");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue