Allow configuring IPv6 address for upstream proxy (#492)
* Added support to configure IPv6 upstream proxy servers using bracket syntax. * Added regular expression for IPv6 scope identifier to re for IPv6 address.
This commit is contained in:
parent
ef60434b39
commit
2bec15ee40
14
src/conf.c
14
src/conf.c
@ -66,9 +66,10 @@
|
||||
#define PASSWORD "([^@]*)"
|
||||
#define IP "((([0-9]{1,3})\\.){3}[0-9]{1,3})"
|
||||
#define IPMASK "(" IP "(/" DIGIT "+)?)"
|
||||
#define IPV6SCOPE "((%[^ \t\\/]{1,16})?)"
|
||||
#define IPV6 "(" \
|
||||
"(([0-9a-f:]{2,39}))|" \
|
||||
"(([0-9a-f:]{0,29}:" IP "))" \
|
||||
"([0-9a-f:]{2,39})" IPV6SCOPE "|" \
|
||||
"([0-9a-f:]{0,29}:" IP ")" IPV6SCOPE \
|
||||
")"
|
||||
|
||||
#define IPV6MASK "(" IPV6 "(/" DIGIT "+)?)"
|
||||
@ -80,7 +81,7 @@
|
||||
* number. Given the usual structure of the configuration file, sixteen
|
||||
* substring matches should be plenty.
|
||||
*/
|
||||
#define RE_MAX_MATCHES 24
|
||||
#define RE_MAX_MATCHES 33
|
||||
|
||||
#define CP_WARN(FMT, ...) \
|
||||
log_message (LOG_WARNING, "line %lu: " FMT, lineno, __VA_ARGS__)
|
||||
@ -249,7 +250,7 @@ struct {
|
||||
"(" "(none)" WS STR ")|" \
|
||||
"(" "(http|socks4|socks5)" WS \
|
||||
"(" USERNAME /*username*/ ":" PASSWORD /*password*/ "@" ")?"
|
||||
"(" IP "|" ALNUM ")"
|
||||
"(" IP "|" "\\[(" IPV6 ")\\]" "|" ALNUM ")"
|
||||
":" INT "(" WS STR ")?" ")", handle_upstream),
|
||||
#endif
|
||||
/* loglevel */
|
||||
@ -1114,10 +1115,13 @@ static HANDLE_FUNC (handle_upstream)
|
||||
pass = get_string_arg (line, &match[mi]);
|
||||
mi++;
|
||||
|
||||
if (match[mi+4].rm_so != -1) /* IPv6 address in square brackets */
|
||||
ip = get_string_arg (line, &match[mi+4]);
|
||||
else
|
||||
ip = get_string_arg (line, &match[mi]);
|
||||
if (!ip)
|
||||
return -1;
|
||||
mi += 5;
|
||||
mi += 16;
|
||||
|
||||
port = (int) get_long_arg (line, &match[mi]);
|
||||
mi += 3;
|
||||
|
Loading…
Reference in New Issue
Block a user