2

How can I configure the upstream of tinyproxy for an IPv6 address?

The following does not work.

Upstream "[2001:xxxx:xxx:xx:xxx:xxxx:xxxx:380f]:8888"

Update

I get the following error: Unable to parse config file. Not starting.

mossaab
  • 175
  • 1
  • 6

2 Answers2

1

Correct syntax of upstream is:

Upstream http "[2001:xxxx:xxx:xx:xxx:xxxx:xxxx:380f]:8888"

You simply missed http.

0

I tried

upstream http "[fe80::1]:8888"

but I also get an error:

ERROR: Syntax error on line 157
Unable to parse config file. Not starting.

It looks like tiniyproxy (at least version 1.11.1) does not support IPv6 addresses.

src/conf.c:

#define IP "((([0-9]{1,3})\\.){3}[0-9]{1,3})"
...
#ifdef UPSTREAM_SUPPORT
STDCONF (upstream,
     "(" "(none)" WS STR ")|" \
     "(" "(http|socks4|socks5)" WS \
         "(" USERNAME /*username*/ ":" PASSWORD /*password*/ "@" ")?"
         "(" IP "|" ALNUM ")"
         ":" INT "(" WS STR ")?" ")", handle_upstream),
#endif

The regular expression #defined in IP only matches numerical IPv4 addresses.

I changed conf.c to include IPv6 addresses:

STDCONF (upstream,
     "(" "(none)" WS STR ")|" \
     "(" "(http|socks4|socks5)" WS \
         "(" USERNAME /*username*/ ":" PASSWORD /*password*/ "@" ")?"
         "(" IP "|" "\\[" IPV6 "\\]" "|" ALNUM ")"
         ":" INT "(" WS STR ")?" ")", handle_upstream),

and I also removed the double quotes from the config statement:

upstream http [fe80::1]:8888

Now, tinyproxy starts without complainig on its config file. But I did not check, wether the upstream connection really works or wether other fixes are needed to use an IPv6 addres for the upstream proxy. My prime suspect is, that I probably need to strip the square brackes off the numerical IPv6 address.