TCA.setProxy
Enables you to set a proxy address manually in the script.
TCA.setProxy(option, settings);
Arguments
Name | Description |
---|---|
option | Specify the type of proxy you want to use.
|
settings | (string) The details of the proxy setting. |
Return value
A promise that will be fulfilled with no arguments.
Example
Use system proxy settings. The second argument is ignored, so it can be any string value, usually empty.
Note: Because schema needs two arguments, the second one cannot be omitted.
Copy codeTCA.setProxy("PROXY_SYSTEM", "").then(function(){
TCA.done();
}).catch(function (error) {
TCA.doneWithError(error);
});Manually set proxy and set separate proxy for different protocols (HTTP and HTTPS).
Copy codeTCA.setProxy("PROXY_MANUAL", '{"proxyShare":false,"proxyHttp":" proxy.xxx.com ","proxyHttpPort":8080,"proxySsl":" proxy.yyy.com ","proxySslPort":8080}').then(function(){
TCA.done();
}).catch(function (error) {
TCA.doneWithError(error);
});Manually set proxy and share the proxy settings for all protocols (HTTP, HTTPS, ...).
Note: If you also specify an address for
proxySsl
, it will be ignored becauseproxyShare
is set to true.Copy codeTCA.setProxy("PROXY_MANUAL", '{"proxyShare":true,"proxyHttp":"proxy.xxx.com","proxyHttpPort":8080}').then(function(){
TCA.done();
}).catch(function (error) {
TCA.doneWithError(error);
});Use manually set proxy that is already in memory (maybe set previously, or maybe nothing is set).
Note: If you are not sure which setting is in memory, it is recommended that you explicitly specify the proxy settings you want to use every time.
Copy codeTCA.setProxy("PROXY_MANUAL ", "").then(function(){
TCA.done();
}).catch(function (error) {
TCA.doneWithError(error);
});Do not use any proxy.
Note: The proxy address/port that are set in the options sections are not removed. The settings in memory can be activated in another call.
Copy codeTCA.setProxy("PROXY_NONE", "").then(function(){
TCA.done();
}).catch(function (error) {
TCA.doneWithError(error);
});Use PAC.
Copy codeTCA.setProxy("PROXY_PAC",'{"proxyPAC":"http://autocache.xyzcorp.net/"}').then(function(){
TCA.done();
}).catch(function (error) {
TCA.doneWithError(error);
});