The resource loading... loading...

exchange.SetProxy

The exchange.SetProxy() function is used to set the proxy configuration of the {@var/EXCHANGE exchange} exchange object.

exchange.SetProxy(proxy)

The proxy parameter is used to specify the proxy configuration. proxy true string

function main() {
    exchange.SetProxy("socks5://192.168.1.10:8080")
    // If you can't access the exchange ticker interface, set up an available ss5 proxy and you can access the ticker interface
    Log(exchange.GetTicker())
}
def main():
    exchange.SetProxy("socks5://192.168.1.10:8080")
    Log(exchange.GetTicker())
void main() {
    exchange.SetProxy("socks5://192.168.1.10:8080");
    Log(exchange.GetTicker());
}

Configure the {@var/EXCHANGE exchange} exchange object socks5 proxy:

function main(){
    exchange.SetProxy("ip://10.0.3.15")
    // The requested IP address is 10.0.3.15
    exchange.GetTicker()
}
def main():
    exchange.SetProxy("ip://10.0.3.15")
    exchange.GetTicker()
void main() {
    exchange.SetProxy("ip://10.0.3.15");
    exchange.GetTicker();
}

In addition to global specification of the IP address of the request from the {@var/EXCHANGE exchange} exchange object, there is also support for specifying an IP address based on {@var/EXCHANGE exchange}:

If the proxy setting fails, the exchange.SetProxy() function will return null when called. The exchange.SetProxy() function sets the proxy for the rest protocol only. One proxy can be set for each {@var/EXCHANGE exchange} exchange object, and access to the exchange interface bound to the {@var/EXCHANGE exchange} exchange object after setting the proxy will be accessed through the proxy. Support for setting socks5 proxy, taking the first exchange object added {@var/EXCHANGE exchange} i.e.: exchanges[0] as an example:

  • Set proxy, no username, no password: exchange.SetProxy("socks5://127.0.0.1:8889").
  • Set proxy, enter username and password: exchange.SetProxy("socks5://username:password@127.0.0.1:8889"). username is the user name and password is the password.
  • Switch to normal mode without proxy: exchange.SetProxy("").

Supports setting the IP address of the request from the {@var/EXCHANGE exchange} exchange object, globally specified.

{@var/EXCHANGE exchange}

exchange.GetBase exchange.SetTimeout