1
0
mirror of https://github.com/rofl0r/proxychains-ng synced 2025-01-24 02:02:53 +08:00

More generically parse proxy chain type

This commit is contained in:
crass 2013-06-24 11:37:51 +07:00
parent ea4ca0a6b2
commit 1ac3334e99
2 changed files with 10 additions and 12 deletions

View File

@ -50,7 +50,8 @@ typedef enum {
DYNAMIC_TYPE, DYNAMIC_TYPE,
STRICT_TYPE, STRICT_TYPE,
RANDOM_TYPE, RANDOM_TYPE,
ROUND_ROBIN_TYPE ROUND_ROBIN_TYPE,
MAX_CHAIN_TYPE
} chain_type; } chain_type;
typedef enum { typedef enum {

View File

@ -330,18 +330,15 @@ static void get_chain_data(proxy_chain_list *pc_list) {
} }
int get_chain_type(char *buff, chain_type *ct) { int get_chain_type(char *buff, chain_type *ct) {
if(strstr(buff, "random_chain")) int i = 0;
*ct = RANDOM_TYPE; for (; i < MAX_CHAIN_TYPE; i++) {
else if(strstr(buff, "strict_chain")) if (strstr(buff, chain_type_strmap[i])) {
*ct = STRICT_TYPE; *ct = i;
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; return 0;
} }
}
return 1;
}
int proxy_chain_list_load(proxy_chain_list *pc_list) { int proxy_chain_list_load(proxy_chain_list *pc_list) {
char *env = NULL; char *env = NULL;