diff options
author | Lars-Dominik Braun <PromyLOPh@gmail.com> | 2008-06-16 11:38:19 +0200 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@gmail.com> | 2008-06-16 11:38:19 +0200 |
commit | 5708e1a023c349af53383d8bfe52e2af65c597bc (patch) | |
tree | e09b659c08674808345cb36b0cf42f8f9d222d98 | |
parent | 852e19a64893fe3109a42719782c3099ec6ce3d5 (diff) | |
download | pianobar-windows-5708e1a023c349af53383d8bfe52e2af65c597bc.tar.gz pianobar-windows-5708e1a023c349af53383d8bfe52e2af65c597bc.tar.bz2 pianobar-windows-5708e1a023c349af53383d8bfe52e2af65c597bc.zip |
client: Proxy type config option added
-rw-r--r-- | src/main.c | 7 | ||||
-rw-r--r-- | src/pianobar.1 | 15 | ||||
-rw-r--r-- | src/settings.c | 13 | ||||
-rw-r--r-- | src/settings.h | 3 |
4 files changed, 33 insertions, 5 deletions
@@ -292,8 +292,11 @@ int main (int argc, char **argv) { PianoInit (&ph); /* setup control connection */ - curl_easy_setopt (ph.curlHandle, CURLOPT_PROXY, bsettings.controlProxy); - curl_easy_setopt (ph.curlHandle, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A); + if (bsettings.controlProxy != NULL && bsettings.controlProxyType != -1) { + curl_easy_setopt (ph.curlHandle, CURLOPT_PROXY, bsettings.controlProxy); + curl_easy_setopt (ph.curlHandle, CURLOPT_PROXYTYPE, + bsettings.controlProxyType); + } curl_easy_setopt (ph.curlHandle, CURLOPT_CONNECTTIMEOUT, 60); termSetBuffer (0); diff --git a/src/pianobar.1 b/src/pianobar.1 index 3d00a53..0b1d4f5 100644 --- a/src/pianobar.1 +++ b/src/pianobar.1 @@ -24,7 +24,8 @@ Per-user configuration file. See .SH CONFIGURATION The configuration file consists of simple .B key = value -lines. Each terminated with a newline (\\n) character. +lines. Each terminated with a newline (\\n) character. Keys and values are both +case sensitive. .TP .B control_proxy = host:port @@ -32,12 +33,20 @@ Non-american users need a proxy to use pandora.com. Currently this needs to be a SOCKS4a proxy like Tor. .TP -.B user = your@user.name -Your pandora.com username. +.B control_proxy_type = {http,socks4,socks4a,socks5} +If you want to use a proxy you need to specify the proxy type you're going to +use. Note that +.B socks5 +needs an IP address specified in +.B control_proxy .TP .B password = plaintext_password Your pandora.com password. Plain-text. +.TP +.B user = your@user.name +Your pandora.com username. + .SH AUTHOR Lars-Dominik Braun <PromyLOPh@gmail.com> diff --git a/src/settings.c b/src/settings.c index 40a5064..588a34f 100644 --- a/src/settings.c +++ b/src/settings.c @@ -90,6 +90,19 @@ void readSettings (BarSettings_t *settings) { } if (strcmp ("control_proxy", key) == 0) { settings->controlProxy = strdup (val); + } else if (strcmp ("control_proxy_type", key) == 0) { + if (strcmp ("http", val) == 0) { + settings->controlProxyType = CURLPROXY_HTTP; + } else if (strcmp ("socks4", val) == 0) { + settings->controlProxyType = CURLPROXY_SOCKS4; + } else if (strcmp ("socks4a", val) == 0) { + settings->controlProxyType = CURLPROXY_SOCKS4A; + } else if (strcmp ("socks5", val) == 0) { + settings->controlProxyType = CURLPROXY_SOCKS5; + } else { + /* error: don't use proxy at all */ + settings->controlProxyType = -1; + } } else if (strcmp ("user", key) == 0) { settings->username = strdup (val); } else if (strcmp ("password", key) == 0) { diff --git a/src/settings.h b/src/settings.h index 26ca527..15b5396 100644 --- a/src/settings.h +++ b/src/settings.h @@ -23,10 +23,13 @@ THE SOFTWARE. #ifndef _SETTINGS_H #define _SETTINGS_H +#include <curl/curl.h> + struct BarSettings { char *username; char *password; char *controlProxy; /* non-american listeners need this */ + curl_proxytype controlProxyType; }; typedef struct BarSettings BarSettings_t; |