From 50152cdeade8e6927cd34681525955be3c0ad1fe Mon Sep 17 00:00:00 2001 From: N0YB Date: Wed, 5 Jun 2013 21:09:16 -0700 Subject: Add Proxy Type Option --- .../openvpn-client-export.inc | 10 ++++++-- .../openvpn-client-export/vpn_openvpn_export.php | 27 ++++++++++++++++++---- 2 files changed, 30 insertions(+), 7 deletions(-) (limited to 'config/openvpn-client-export') diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc index d79c42c3..02e89eb9 100755 --- a/config/openvpn-client-export/openvpn-client-export.inc +++ b/config/openvpn-client-export/openvpn-client-export.inc @@ -230,7 +230,10 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $quotese $input_errors[] = "This server uses UDP protocol and cannot communicate with HTTP proxy."; return; } - $conf .= "http-proxy {$proxy['ip']} {$proxy['port']} "; + if ($proxy['proxy_type'] == "http") + $conf .= "http-proxy {$proxy['ip']} {$proxy['port']} "; + if ($proxy['proxy_type'] == "socks") + $conf .= "socks-proxy {$proxy['ip']} {$proxy['port']} "; if ($proxy['proxy_authtype'] != "none") { if (!isset($proxy['passwdfile'])) $proxy['passwdfile'] = openvpn_client_export_prefix($srvid, $usrid, $crtid) . "-proxy"; @@ -749,7 +752,10 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco $input_errors[] = "This server uses UDP protocol and cannot communicate with HTTP proxy."; return; } - $conf .= "http-proxy {$proxy['ip']} {$proxy['port']} "; + if ($proxy['proxy_type'] == "http") + $conf .= "http-proxy {$proxy['ip']} {$proxy['port']} "; + if ($proxy['proxy_type'] == "socks") + $conf .= "socks-proxy {$proxy['ip']} {$proxy['port']} "; if ($proxy['proxy_authtype'] != "none") { if (!isset($proxy['passwdfile'])) $proxy['passwdfile'] = openvpn_client_export_prefix($srvid) . "-proxy"; diff --git a/config/openvpn-client-export/vpn_openvpn_export.php b/config/openvpn-client-export/vpn_openvpn_export.php index cfec87f7..4f7e1caa 100755 --- a/config/openvpn-client-export/vpn_openvpn_export.php +++ b/config/openvpn-client-export/vpn_openvpn_export.php @@ -159,6 +159,7 @@ if (!empty($act)) { $input_errors[] = "You need to specify a port for the proxy ip."; } else $proxy['port'] = $_GET['proxy_port']; + $proxy['proxy_type'] = $_GET['proxy_type']; $proxy['proxy_authtype'] = $_GET['proxy_authtype']; if ($_GET['proxy_authtype'] != "none") { if (empty($_GET['proxy_user'])) { @@ -345,6 +346,8 @@ function download_begin(act, i, j) { if (document.getElementById("useproxypass").value != 'none') useproxypass = 1; + var proxytype = document.getElementById("useproxytype").value; + var proxyauth = document.getElementById("useproxypass").value; var proxyuser = document.getElementById("proxyuser").value; var proxypass = document.getElementById("proxypass").value; @@ -383,6 +386,7 @@ function download_begin(act, i, j) { if (usepass) dlurl += "&password=" + escape(pass); if (useproxy) { + dlurl += "&proxy_type=" + escape(proxytype); dlurl += "&proxy_addr=" + escape(proxyaddr); dlurl += "&proxy_port=" + escape(proxyport); dlurl += "&proxy_authtype=" + escape(proxyauth); @@ -603,7 +607,7 @@ function useproxy_changed(obj) {