summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-01-04 23:43:48 +0100
committerSebastien Helleu <flashcode@flashtux.org>2009-01-04 23:43:48 +0100
commitc2438ec222182c2c2892882c405ce3183b47f6f2 (patch)
tree127f8d26a71d95aaba63b9e5f000e28c0f25cded /src
parentba7bb638349c8139aa1cd0e0a7892bcca5936969 (diff)
downloadweechat-c2438ec222182c2c2892882c405ce3183b47f6f2.zip
Rename options in proxy structure
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-command.c20
-rw-r--r--src/core/wee-network.c49
-rw-r--r--src/core/wee-proxy.c194
-rw-r--r--src/core/wee-proxy.h19
4 files changed, 108 insertions, 174 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 36ebcd0a2..4dae7ae10 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -2357,16 +2357,16 @@ command_proxy_list ()
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
ptr_proxy->name,
GUI_COLOR(GUI_COLOR_CHAT),
- proxy_type_string[CONFIG_INTEGER(ptr_proxy->type)],
- CONFIG_STRING(ptr_proxy->address),
- CONFIG_INTEGER(ptr_proxy->port),
- (CONFIG_INTEGER(ptr_proxy->ipv6)) ? "IPv6" : "IPv4",
- (CONFIG_STRING(ptr_proxy->username) &&
- CONFIG_STRING(ptr_proxy->username)[0]) ?
- CONFIG_STRING(ptr_proxy->username) : _("(none)"),
- (CONFIG_STRING(ptr_proxy->password) &&
- CONFIG_STRING(ptr_proxy->password)[0]) ?
- CONFIG_STRING(ptr_proxy->password) : _("(none)"));
+ proxy_type_string[CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_TYPE])],
+ CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_ADDRESS]),
+ CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_PORT]),
+ (CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_IPV6])) ? "IPv6" : "IPv4",
+ (CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_USERNAME]) &&
+ CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_USERNAME])[0]) ?
+ CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_USERNAME]) : _("(none)"),
+ (CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_PASSWORD]) &&
+ CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_PASSWORD])[0]) ?
+ CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_PASSWORD]) : _("(none)"));
}
}
else
diff --git a/src/core/wee-network.c b/src/core/wee-network.c
index 740cffc8b..3fb952095 100644
--- a/src/core/wee-network.c
+++ b/src/core/wee-network.c
@@ -161,14 +161,14 @@ network_pass_httpproxy (struct t_proxy *proxy, int sock, const char *address,
char buffer[256], authbuf[128], authbuf_base64[196];
int n, m;
- if (CONFIG_STRING(proxy->username)
- && CONFIG_STRING(proxy->username)[0])
+ if (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])
+ && CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])[0])
{
/* authentification */
snprintf (authbuf, sizeof (authbuf), "%s:%s",
- CONFIG_STRING(proxy->username),
- (CONFIG_STRING(proxy->password)) ?
- CONFIG_STRING(proxy->password) : "");
+ CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]),
+ (CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD])) ?
+ CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]) : "");
network_base64encode (authbuf, authbuf_base64);
n = snprintf (buffer, sizeof (buffer),
"CONNECT %s:%d HTTP/1.0\r\nProxy-Authorization: Basic %s\r\n\r\n",
@@ -264,7 +264,7 @@ network_pass_socks4proxy (struct t_proxy *proxy, int sock, const char *address,
socks4.port = htons (port);
network_resolve (address, ip_addr, NULL);
socks4.address = inet_addr (ip_addr);
- strncpy (socks4.user, CONFIG_STRING(proxy->username),
+ strncpy (socks4.user, CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]),
sizeof (socks4.user) - 1);
send (sock, (char *) &socks4, 8 + strlen (socks4.user) + 1, 0);
@@ -302,8 +302,8 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
socks5.version = 5;
socks5.nmethods = 1;
- if (CONFIG_STRING(proxy->username)
- && CONFIG_STRING(proxy->username)[0])
+ if (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])
+ && CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])[0])
socks5.method = 2; /* with authentication */
else
socks5.method = 0; /* without authentication */
@@ -313,8 +313,8 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
if (recv (sock, buffer, 2, 0) != 2)
return 0;
- if (CONFIG_STRING(proxy->username)
- && CONFIG_STRING(proxy->username)[0])
+ if (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])
+ && CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])[0])
{
/* with authentication */
/* -> socks server must respond with :
@@ -326,16 +326,16 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
return 0;
/* authentication as in RFC 1929 */
- username_len = strlen (CONFIG_STRING(proxy->username));
- password_len = strlen (CONFIG_STRING(proxy->password));
+ username_len = strlen (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]));
+ password_len = strlen (CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]));
/* make username/password buffer */
buffer[0] = 1;
buffer[1] = (unsigned char) username_len;
- memcpy(buffer + 2, CONFIG_STRING(proxy->username), username_len);
+ memcpy(buffer + 2, CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]), username_len);
buffer[2 + username_len] = (unsigned char) password_len;
memcpy (buffer + 3 + username_len,
- CONFIG_STRING(proxy->password), password_len);
+ CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]), password_len);
send (sock, buffer, 3 + username_len + password_len, 0);
@@ -438,7 +438,7 @@ network_pass_proxy (const char *proxy, int sock, const char *address, int port)
ptr_proxy = proxy_search (proxy);
if (ptr_proxy)
{
- switch (CONFIG_INTEGER(ptr_proxy->type))
+ switch (CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_TYPE]))
{
case PROXY_TYPE_HTTP:
rc = network_pass_httpproxy (ptr_proxy, sock, address, port);
@@ -485,9 +485,9 @@ network_connect_to (const char *proxy, int sock,
ip4 = inet_ntoa(addr.sin_addr);
memset (&addr, 0, sizeof (addr));
- addr.sin_port = htons (CONFIG_INTEGER(ptr_proxy->port));
+ addr.sin_port = htons (CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_PORT]));
addr.sin_family = AF_INET;
- hostent = gethostbyname (CONFIG_STRING(ptr_proxy->address));
+ hostent = gethostbyname (CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_ADDRESS]));
if (!hostent)
return 0;
memcpy(&(addr.sin_addr), *(hostent->h_addr_list), sizeof(struct in_addr));
@@ -547,9 +547,10 @@ network_connect_child (struct t_hook *hook_connect)
{
/* get info about peer */
memset (&hints, 0, sizeof (hints));
- hints.ai_family = (CONFIG_BOOLEAN(ptr_proxy->ipv6)) ? AF_INET6 : AF_INET;
+ hints.ai_family = (CONFIG_BOOLEAN(ptr_proxy->options[PROXY_OPTION_IPV6])) ?
+ AF_INET6 : AF_INET;
hints.ai_socktype = SOCK_STREAM;
- if (getaddrinfo (CONFIG_STRING(ptr_proxy->address), NULL, &hints, &res) !=0)
+ if (getaddrinfo (CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_ADDRESS]), NULL, &hints, &res) !=0)
{
/* address not found */
status_str[0] = '0' + WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND;
@@ -563,8 +564,8 @@ network_connect_child (struct t_hook *hook_connect)
write (HOOK_CONNECT(hook_connect, child_write), status_str, 1);
return;
}
- if ((CONFIG_BOOLEAN(ptr_proxy->ipv6) && (res->ai_family != AF_INET6))
- || ((!CONFIG_BOOLEAN(ptr_proxy->ipv6) && (res->ai_family != AF_INET))))
+ if ((CONFIG_BOOLEAN(ptr_proxy->options[PROXY_OPTION_IPV6]) && (res->ai_family != AF_INET6))
+ || ((!CONFIG_BOOLEAN(ptr_proxy->options[PROXY_OPTION_IPV6]) && (res->ai_family != AF_INET))))
{
/* IP address not found */
status_str[0] = '0' + WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND;
@@ -573,10 +574,10 @@ network_connect_child (struct t_hook *hook_connect)
return;
}
- if (CONFIG_BOOLEAN(ptr_proxy->ipv6))
- ((struct sockaddr_in6 *)(res->ai_addr))->sin6_port = htons (CONFIG_INTEGER(ptr_proxy->port));
+ if (CONFIG_BOOLEAN(ptr_proxy->options[PROXY_OPTION_IPV6]))
+ ((struct sockaddr_in6 *)(res->ai_addr))->sin6_port = htons (CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_PORT]));
else
- ((struct sockaddr_in *)(res->ai_addr))->sin_port = htons (CONFIG_INTEGER(ptr_proxy->port));
+ ((struct sockaddr_in *)(res->ai_addr))->sin_port = htons (CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_PORT]));
/* connect to peer */
if (connect (HOOK_CONNECT(hook_connect, sock),
diff --git a/src/core/wee-proxy.c b/src/core/wee-proxy.c
index 3b01ced61..0f42165aa 100644
--- a/src/core/wee-proxy.c
+++ b/src/core/wee-proxy.c
@@ -35,6 +35,8 @@
char *proxy_option_string[PROXY_NUM_OPTIONS] =
{ "type", "ipv6", "address", "port", "username", "password" };
+char *proxy_option_default[PROXY_NUM_OPTIONS] =
+{ "http", "off", "127.0.0.1", "3128", "", "" };
char *proxy_type_string[PROXY_NUM_TYPES] =
{ "http", "socks4", "socks5" };
@@ -165,17 +167,17 @@ proxy_set_name (struct t_proxy *proxy, const char *name)
if (option_name)
{
snprintf (option_name, length, "%s.type", name);
- config_file_option_rename (proxy->type, option_name);
+ config_file_option_rename (proxy->options[PROXY_OPTION_TYPE], option_name);
snprintf (option_name, length, "%s.ipv6", name);
- config_file_option_rename (proxy->ipv6, option_name);
+ config_file_option_rename (proxy->options[PROXY_OPTION_IPV6], option_name);
snprintf (option_name, length, "%s.address", name);
- config_file_option_rename (proxy->address, option_name);
+ config_file_option_rename (proxy->options[PROXY_OPTION_ADDRESS], option_name);
snprintf (option_name, length, "%s.port", name);
- config_file_option_rename (proxy->port, option_name);
+ config_file_option_rename (proxy->options[PROXY_OPTION_PORT], option_name);
snprintf (option_name, length, "%s.username", name);
- config_file_option_rename (proxy->username, option_name);
+ config_file_option_rename (proxy->options[PROXY_OPTION_USERNAME], option_name);
snprintf (option_name, length, "%s.password", name);
- config_file_option_rename (proxy->password, option_name);
+ config_file_option_rename (proxy->options[PROXY_OPTION_PASSWORD], option_name);
if (proxy->name)
free (proxy->name);
@@ -203,32 +205,32 @@ proxy_set (struct t_proxy *proxy, const char *property, const char *value)
}
else if (string_strcasecmp (property, "type") == 0)
{
- config_file_option_set (proxy->type, value, 1);
+ config_file_option_set (proxy->options[PROXY_OPTION_TYPE], value, 1);
return 1;
}
else if (string_strcasecmp (property, "ipv6") == 0)
{
- config_file_option_set (proxy->ipv6, value, 1);
+ config_file_option_set (proxy->options[PROXY_OPTION_IPV6], value, 1);
return 1;
}
else if (string_strcasecmp (property, "address") == 0)
{
- config_file_option_set (proxy->address, value, 1);
+ config_file_option_set (proxy->options[PROXY_OPTION_ADDRESS], value, 1);
return 1;
}
else if (string_strcasecmp (property, "port") == 0)
{
- config_file_option_set (proxy->port, value, 1);
+ config_file_option_set (proxy->options[PROXY_OPTION_PORT], value, 1);
return 1;
}
else if (string_strcasecmp (property, "username") == 0)
{
- config_file_option_set (proxy->username, value, 1);
+ config_file_option_set (proxy->options[PROXY_OPTION_USERNAME], value, 1);
return 1;
}
else if (string_strcasecmp (property, "password") == 0)
{
- config_file_option_set (proxy->password, value, 1);
+ config_file_option_set (proxy->options[PROXY_OPTION_PASSWORD], value, 1);
return 1;
}
@@ -330,30 +332,8 @@ proxy_create_option_temp (struct t_proxy *temp_proxy, int index_option,
new_option = proxy_create_option (temp_proxy->name,
index_option,
value);
- if (new_option)
- {
- switch (index_option)
- {
- case PROXY_OPTION_TYPE:
- temp_proxy->type = new_option;
- break;
- case PROXY_OPTION_IPV6:
- temp_proxy->ipv6 = new_option;
- break;
- case PROXY_OPTION_ADDRESS:
- temp_proxy->address = new_option;
- break;
- case PROXY_OPTION_PORT:
- temp_proxy->port = new_option;
- break;
- case PROXY_OPTION_USERNAME:
- temp_proxy->username = new_option;
- break;
- case PROXY_OPTION_PASSWORD:
- temp_proxy->password = new_option;
- break;
- }
- }
+ if (new_option && (index_option >= 0))
+ temp_proxy->options[index_option] = new_option;
}
/*
@@ -364,17 +344,16 @@ struct t_proxy *
proxy_alloc (const char *name)
{
struct t_proxy *new_proxy;
+ int i;
new_proxy = malloc (sizeof (*new_proxy));
if (new_proxy)
{
new_proxy->name = strdup (name);
- new_proxy->type = NULL;
- new_proxy->ipv6 = NULL;
- new_proxy->address = NULL;
- new_proxy->port = NULL;
- new_proxy->username = NULL;
- new_proxy->password = NULL;
+ for (i = 0; i < PROXY_NUM_OPTIONS; i++)
+ {
+ new_proxy->options[i] = NULL;
+ }
new_proxy->prev_proxy = NULL;
new_proxy->next_proxy = NULL;
}
@@ -401,12 +380,12 @@ proxy_new_with_options (const char *name,
new_proxy = proxy_alloc (name);
if (new_proxy)
{
- new_proxy->type = type;
- new_proxy->ipv6 = ipv6;
- new_proxy->address = address;
- new_proxy->port = port;
- new_proxy->username = username;
- new_proxy->password = password;
+ new_proxy->options[PROXY_OPTION_TYPE] = type;
+ new_proxy->options[PROXY_OPTION_IPV6] = ipv6;
+ new_proxy->options[PROXY_OPTION_ADDRESS] = address;
+ new_proxy->options[PROXY_OPTION_PORT] = port;
+ new_proxy->options[PROXY_OPTION_USERNAME] = username;
+ new_proxy->options[PROXY_OPTION_PASSWORD] = password;
/* add proxy to proxies list */
new_proxy->prev_proxy = last_weechat_proxy;
@@ -488,78 +467,43 @@ void
proxy_use_temp_proxies ()
{
struct t_proxy *ptr_temp_proxy, *next_temp_proxy;
+ int i, num_options_ok;
for (ptr_temp_proxy = weechat_temp_proxies; ptr_temp_proxy;
ptr_temp_proxy = ptr_temp_proxy->next_proxy)
{
- if (!ptr_temp_proxy->type)
- ptr_temp_proxy->type = proxy_create_option (ptr_temp_proxy->name,
- PROXY_OPTION_TYPE,
- "http");
- if (!ptr_temp_proxy->ipv6)
- ptr_temp_proxy->ipv6 = proxy_create_option (ptr_temp_proxy->name,
- PROXY_OPTION_IPV6,
- "off");
- if (!ptr_temp_proxy->address)
- ptr_temp_proxy->address = proxy_create_option (ptr_temp_proxy->name,
- PROXY_OPTION_ADDRESS,
- "127.0.0.1");
- if (!ptr_temp_proxy->port)
- ptr_temp_proxy->port = proxy_create_option (ptr_temp_proxy->name,
- PROXY_OPTION_PORT,
- "3128");
- if (!ptr_temp_proxy->username)
- ptr_temp_proxy->username = proxy_create_option (ptr_temp_proxy->name,
- PROXY_OPTION_USERNAME,
- "");
- if (!ptr_temp_proxy->password)
- ptr_temp_proxy->password = proxy_create_option (ptr_temp_proxy->name,
- PROXY_OPTION_PASSWORD,
- "");
+ num_options_ok = 0;
+ for (i = 0; i < PROXY_NUM_OPTIONS; i++)
+ {
+ if (!ptr_temp_proxy->options[i])
+ {
+ ptr_temp_proxy->options[i] = proxy_create_option (ptr_temp_proxy->name,
+ i,
+ proxy_option_default[i]);
+ }
+ if (ptr_temp_proxy->options[i])
+ num_options_ok++;
+ }
- if (ptr_temp_proxy->type && ptr_temp_proxy->ipv6
- && ptr_temp_proxy->address && ptr_temp_proxy->port
- && ptr_temp_proxy->username && ptr_temp_proxy->password)
+ if (num_options_ok == PROXY_NUM_OPTIONS)
{
proxy_new_with_options (ptr_temp_proxy->name,
- ptr_temp_proxy->type,
- ptr_temp_proxy->ipv6,
- ptr_temp_proxy->address,
- ptr_temp_proxy->port,
- ptr_temp_proxy->username,
- ptr_temp_proxy->password);
+ ptr_temp_proxy->options[PROXY_OPTION_TYPE],
+ ptr_temp_proxy->options[PROXY_OPTION_IPV6],
+ ptr_temp_proxy->options[PROXY_OPTION_ADDRESS],
+ ptr_temp_proxy->options[PROXY_OPTION_PORT],
+ ptr_temp_proxy->options[PROXY_OPTION_USERNAME],
+ ptr_temp_proxy->options[PROXY_OPTION_PASSWORD]);
}
else
{
- if (ptr_temp_proxy->type)
- {
- config_file_option_free (ptr_temp_proxy->type);
- ptr_temp_proxy->type = NULL;
- }
- if (ptr_temp_proxy->ipv6)
- {
- config_file_option_free (ptr_temp_proxy->ipv6);
- ptr_temp_proxy->ipv6 = NULL;
- }
- if (ptr_temp_proxy->address)
- {
- config_file_option_free (ptr_temp_proxy->address);
- ptr_temp_proxy->address = NULL;
- }
- if (ptr_temp_proxy->port)
+ for (i = 0; i < PROXY_NUM_OPTIONS; i++)
{
- config_file_option_free (ptr_temp_proxy->port);
- ptr_temp_proxy->port = NULL;
- }
- if (ptr_temp_proxy->username)
- {
- config_file_option_free (ptr_temp_proxy->username);
- ptr_temp_proxy->username = NULL;
- }
- if (ptr_temp_proxy->password)
- {
- config_file_option_free (ptr_temp_proxy->password);
- ptr_temp_proxy->password = NULL;
+ if (ptr_temp_proxy->options[i])
+ {
+ config_file_option_free (ptr_temp_proxy->options[i]);
+ ptr_temp_proxy->options[i] = NULL;
+ }
}
}
}
@@ -585,6 +529,8 @@ proxy_use_temp_proxies ()
void
proxy_free (struct t_proxy *proxy)
{
+ int i;
+
if (!proxy)
return;
@@ -601,18 +547,10 @@ proxy_free (struct t_proxy *proxy)
/* free data */
if (proxy->name)
free (proxy->name);
- if (proxy->type)
- config_file_option_free (proxy->type);
- if (proxy->ipv6)
- config_file_option_free (proxy->ipv6);
- if (proxy->address)
- config_file_option_free (proxy->address);
- if (proxy->port)
- config_file_option_free (proxy->port);
- if (proxy->username)
- config_file_option_free (proxy->username);
- if (proxy->password)
- config_file_option_free (proxy->password);
+ for (i = 0; i < PROXY_NUM_OPTIONS; i++)
+ {
+ config_file_option_free (proxy->options[i]);
+ }
free (proxy);
}
@@ -646,13 +584,13 @@ proxy_print_log ()
log_printf ("[proxy (addr:0x%lx)]", ptr_proxy);
log_printf (" name . . . . . . . . . : '%s'", ptr_proxy->name);
log_printf (" type . . . . . . . . . : %d (%s)",
- CONFIG_INTEGER(ptr_proxy->type),
- proxy_type_string[CONFIG_INTEGER(ptr_proxy->type)]);
- log_printf (" ipv6 . . . . . . . . . : %d", CONFIG_INTEGER(ptr_proxy->ipv6));
- log_printf (" address. . . . . . . . : '%s'", CONFIG_STRING(ptr_proxy->address));
- log_printf (" port . . . . . . . . . : %d", CONFIG_INTEGER(ptr_proxy->port));
- log_printf (" username . . . . . . . : '%s'", CONFIG_STRING(ptr_proxy->username));
- log_printf (" password . . . . . . . : '%s'", CONFIG_STRING(ptr_proxy->password));
+ CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_TYPE]),
+ proxy_type_string[CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_TYPE])]);
+ log_printf (" ipv6 . . . . . . . . . : %d", CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_IPV6]));
+ log_printf (" address. . . . . . . . : '%s'", CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_ADDRESS]));
+ log_printf (" port . . . . . . . . . : %d", CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_PORT]));
+ log_printf (" username . . . . . . . : '%s'", CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_USERNAME]));
+ log_printf (" password . . . . . . . : '%s'", CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_PASSWORD]));
log_printf (" prev_proxy . . . . . . : 0x%lx", ptr_proxy->prev_proxy);
log_printf (" next_proxy . . . . . . : 0x%lx", ptr_proxy->next_proxy);
}
diff --git a/src/core/wee-proxy.h b/src/core/wee-proxy.h
index 1b5203470..b4fde0b44 100644
--- a/src/core/wee-proxy.h
+++ b/src/core/wee-proxy.h
@@ -22,12 +22,12 @@
enum t_proxy_option
{
- PROXY_OPTION_TYPE = 0,
- PROXY_OPTION_IPV6,
- PROXY_OPTION_ADDRESS,
- PROXY_OPTION_PORT,
- PROXY_OPTION_USERNAME,
- PROXY_OPTION_PASSWORD,
+ PROXY_OPTION_TYPE = 0, /* type: http, socks4, socks5 */
+ PROXY_OPTION_IPV6, /* ipv6 ? or ipv4 ? */
+ PROXY_OPTION_ADDRESS, /* address (IP or hostname) */
+ PROXY_OPTION_PORT, /* port */
+ PROXY_OPTION_USERNAME, /* username (optional) */
+ PROXY_OPTION_PASSWORD, /* password (optional) */
/* number of proxy options */
PROXY_NUM_OPTIONS,
};
@@ -44,12 +44,7 @@ enum t_proxy_type
struct t_proxy
{
char *name; /* proxy name */
- struct t_config_option *type; /* type: http, socks4, socks5 */
- struct t_config_option *ipv6; /* ipv6 ? or ipv4 ? */
- struct t_config_option *address; /* address (IP or hostname) */
- struct t_config_option *port; /* port */
- struct t_config_option *username; /* username (optional) */
- struct t_config_option *password; /* password (optional) */
+ struct t_config_option *options[PROXY_NUM_OPTIONS];
struct t_proxy *prev_proxy; /* link to previous bar */
struct t_proxy *next_proxy; /* link to next bar */