diff --git a/src/core.h b/src/core.h index 13819f6..0b58e22 100644 --- a/src/core.h +++ b/src/core.h @@ -50,7 +50,8 @@ typedef enum { DYNAMIC_TYPE, STRICT_TYPE, RANDOM_TYPE, - ROUND_ROBIN_TYPE + ROUND_ROBIN_TYPE, + MAX_CHAIN_TYPE } chain_type; typedef enum { diff --git a/src/libproxychains.c b/src/libproxychains.c index 913f7e0..6074db1 100644 --- a/src/libproxychains.c +++ b/src/libproxychains.c @@ -330,17 +330,14 @@ static void get_chain_data(proxy_chain_list *pc_list) { } int get_chain_type(char *buff, chain_type *ct) { - if(strstr(buff, "random_chain")) - *ct = RANDOM_TYPE; - else if(strstr(buff, "strict_chain")) - *ct = STRICT_TYPE; - else if(strstr(buff, "dynamic_chain")) - *ct = DYNAMIC_TYPE; - else if(strstr(buff, "round_robin_chain")) - *ct = ROUND_ROBIN_TYPE; - else - return 1; - return 0; + int i = 0; + for (; i < MAX_CHAIN_TYPE; i++) { + if (strstr(buff, chain_type_strmap[i])) { + *ct = i; + return 0; + } + } + return 1; } int proxy_chain_list_load(proxy_chain_list *pc_list) {