#include <NetworkSettings.h>
Public Types | |
enum | ProxyType { ProxyTypeMin = -1, NoProxy = -1, Socks4Proxy = 0, Socks5Proxy = 1, HttpProxy = 2, HttpHttpsProxy = 3, ProxyTypeMax = 3 } |
Public Member Functions | |
NetworkSettings (TorControl *torControl) | |
bool | apply (QString *errmsg=0) |
bool | getFascistFirewall () |
void | setFascistFirewall (bool fascistFirewall) |
QList< quint16 > | getReachablePorts () |
void | setReachablePorts (const QList< quint16 > &reachablePorts) |
ProxyType | getProxyType () |
void | setProxyType (ProxyType type) |
QString | getProxyAddress () |
void | setProxyAddress (const QString &addr) |
QString | getProxyUsername () |
void | setProxyUsername (const QString &user) |
QString | getProxyPassword () |
void | setProxyPassword (const QString &pass) |
bool | getUseBridges () |
void | setUseBridges (bool useBridges) |
QStringList | getBridgeList () |
void | setBridgeList (const QStringList &bridgeList) |
bool | getTunnelDirConns () |
Private Member Functions | |
QString | proxyTypeToString (ProxyType type) |
ProxyType | proxyTypeFromString (const QString &type) |
Definition at line 26 of file NetworkSettings.h.
Definition at line 31 of file NetworkSettings.h.
NetworkSettings::NetworkSettings | ( | TorControl * | torControl | ) |
Default constructor.
Default constructor
Definition at line 46 of file NetworkSettings.cpp.
References NoProxy, VSettings::setDefault(), SETTING_BRIDGE_LIST, SETTING_FASCIST_FIREWALL, SETTING_PROXY_ADDRESS, SETTING_PROXY_PASSWORD, SETTING_PROXY_TYPE, SETTING_PROXY_USERNAME, SETTING_REACHABLE_ADDRESSES, SETTING_TUNNEL_DIR_CONNS, and SETTING_USE_BRIDGES.
bool NetworkSettings::apply | ( | QString * | errmsg = 0 |
) | [virtual] |
Applies the current network configuration settings to Tor. If * errmsg is specified and an error occurs while applying the settings, it will be set to a string describing the error.
Applies the current network configuration settings to Tor. If errmsg is specified and an error occurs while applying the settings, it will be set to a string describing the error.
Implements AbstractTorSettings.
Definition at line 65 of file NetworkSettings.cpp.
References getFascistFirewall(), getProxyType(), TorControl::getTorVersion(), getUseBridges(), HttpHttpsProxy, HttpProxy, AbstractTorSettings::localValue(), NoProxy, TorControl::setConf(), SETTING_BRIDGE_LIST, SETTING_HTTP_PROXY, SETTING_HTTP_PROXY_AUTH, SETTING_HTTPS_PROXY, SETTING_HTTPS_PROXY_AUTH, SETTING_PREFER_TUNNELED_DIR_CONNS, SETTING_PROXY_ADDRESS, SETTING_PROXY_PASSWORD, SETTING_PROXY_USERNAME, SETTING_REACHABLE_ADDRESSES, SETTING_SOCKS4_PROXY, SETTING_SOCKS5_PASSWORD, SETTING_SOCKS5_PROXY, SETTING_SOCKS5_USERNAME, SETTING_TUNNEL_DIR_CONNS, SETTING_UPDATE_BRIDGES, SETTING_USE_BRIDGES, Socks4Proxy, Socks5Proxy, and AbstractTorSettings::torControl().
QStringList NetworkSettings::getBridgeList | ( | ) |
Returns a list of bridge nodes Tor should use.
Definition at line 274 of file NetworkSettings.cpp.
References SETTING_BRIDGE_LIST, and AbstractTorSettings::value().
Referenced by NetworkPage::load().
bool NetworkSettings::getFascistFirewall | ( | ) |
Returns true if we need to set ReachableAddresses because we're behind a restrictive firewall that limits the ports Tor can connect to.
Definition at line 148 of file NetworkSettings.cpp.
References AbstractTorSettings::localValue(), and SETTING_FASCIST_FIREWALL.
Referenced by apply(), and NetworkPage::load().
QString NetworkSettings::getProxyAddress | ( | ) |
Returns the address of the proxy server Tor makes connections through.
Definition at line 216 of file NetworkSettings.cpp.
References SETTING_PROXY_ADDRESS, and AbstractTorSettings::value().
Referenced by NetworkPage::load().
QString NetworkSettings::getProxyPassword | ( | ) |
Returns the password used to login to the proxy server.
Definition at line 244 of file NetworkSettings.cpp.
References SETTING_PROXY_PASSWORD, and AbstractTorSettings::value().
Referenced by NetworkPage::load().
NetworkSettings::ProxyType NetworkSettings::getProxyType | ( | ) |
Returns the proxy type Tor is using, or NoProxy if it makes direct connections.
Definition at line 201 of file NetworkSettings.cpp.
References proxyTypeFromString(), SETTING_PROXY_TYPE, and AbstractTorSettings::value().
Referenced by apply(), and NetworkPage::load().
QString NetworkSettings::getProxyUsername | ( | ) |
Returns the username used to login to the proxy server.
Definition at line 230 of file NetworkSettings.cpp.
References SETTING_PROXY_USERNAME, and AbstractTorSettings::value().
Referenced by NetworkPage::load().
QList< quint16 > NetworkSettings::getReachablePorts | ( | ) |
Returns a list of ports to be specified in ReachableAddresses.
Definition at line 164 of file NetworkSettings.cpp.
References SETTING_REACHABLE_ADDRESSES, and AbstractTorSettings::value().
Referenced by NetworkPage::load().
bool NetworkSettings::getTunnelDirConns | ( | ) |
Returns true if Tor is configured to try to tunnel its directory connections through a one-hop circuit.
Definition at line 289 of file NetworkSettings.cpp.
References SETTING_TUNNEL_DIR_CONNS, and AbstractTorSettings::value().
bool NetworkSettings::getUseBridges | ( | ) |
Returns true if Tor should try to use bridge nodes to access the Tor network.
Definition at line 259 of file NetworkSettings.cpp.
References SETTING_USE_BRIDGES, and AbstractTorSettings::value().
Referenced by apply(), and NetworkPage::load().
NetworkSettings::ProxyType NetworkSettings::proxyTypeFromString | ( | const QString & | type | ) | [private] |
Converts the proxy type string type to its ProxyType counterpart.
Definition at line 325 of file NetworkSettings.cpp.
References HttpHttpsProxy, HttpProxy, NoProxy, Socks4Proxy, and Socks5Proxy.
Referenced by getProxyType().
QString NetworkSettings::proxyTypeToString | ( | ProxyType | type | ) | [private] |
Converts the ProxyType type to a string to store in the configuration file.
Definition at line 297 of file NetworkSettings.cpp.
References HttpHttpsProxy, HttpProxy, NoProxy, Socks4Proxy, and Socks5Proxy.
Referenced by setProxyType().
void NetworkSettings::setBridgeList | ( | const QStringList & | bridgeList | ) |
Sets to bridgeList the list of bridge nodes Tor should use.
Definition at line 281 of file NetworkSettings.cpp.
References SETTING_BRIDGE_LIST, and AbstractTorSettings::setValue().
Referenced by NetworkPage::save().
void NetworkSettings::setFascistFirewall | ( | bool | fascistFirewall | ) |
Sets to fascistFirewall whether Tor should only create outgoing connections to the list of ports specified to setReachablePorts().
Definition at line 157 of file NetworkSettings.cpp.
References SETTING_FASCIST_FIREWALL, and AbstractTorSettings::setValue().
Referenced by NetworkPage::save().
void NetworkSettings::setProxyAddress | ( | const QString & | addr | ) |
Sets the proxy address and port to addr.
Definition at line 223 of file NetworkSettings.cpp.
References SETTING_PROXY_ADDRESS, and AbstractTorSettings::setValue().
Referenced by NetworkPage::save().
void NetworkSettings::setProxyPassword | ( | const QString & | pass | ) |
Sets the proxy server password to pass.
Definition at line 251 of file NetworkSettings.cpp.
References SETTING_PROXY_PASSWORD, and AbstractTorSettings::setValue().
Referenced by NetworkPage::save().
void NetworkSettings::setProxyType | ( | ProxyType | type | ) |
Set the type of proxy Tor should use to type.
Definition at line 209 of file NetworkSettings.cpp.
References proxyTypeToString(), SETTING_PROXY_TYPE, and AbstractTorSettings::setValue().
Referenced by NetworkPage::save().
void NetworkSettings::setProxyUsername | ( | const QString & | user | ) |
Sets the proxy server username to user.
Definition at line 237 of file NetworkSettings.cpp.
References SETTING_PROXY_USERNAME, and AbstractTorSettings::setValue().
Referenced by NetworkPage::save().
void NetworkSettings::setReachablePorts | ( | const QList< quint16 > & | reachablePorts | ) |
Sets the list of ports that will be specified in ReachableAddresses to reachablePorts.
Definition at line 187 of file NetworkSettings.cpp.
References SETTING_REACHABLE_ADDRESSES, and AbstractTorSettings::setValue().
Referenced by NetworkPage::save().
void NetworkSettings::setUseBridges | ( | bool | useBridges | ) |
Sets to useBridges whether Tor should try to use bridge nodes to access the Tor network.
Definition at line 267 of file NetworkSettings.cpp.
References SETTING_USE_BRIDGES, and AbstractTorSettings::setValue().
Referenced by NetworkPage::save().