clean up proxy_settings constructors
This commit is contained in:
parent
c7e705e158
commit
efe3036879
|
@ -117,23 +117,23 @@ namespace aux {
|
|||
|
||||
// tells libtorrent what kind of proxy server it is. See proxy_type
|
||||
// enum for options
|
||||
std::uint8_t type;
|
||||
std::uint8_t type = 0;
|
||||
|
||||
// the port the proxy server is running on
|
||||
std::uint16_t port;
|
||||
std::uint16_t port = 0;
|
||||
|
||||
// defaults to true. It means that hostnames should be attempted to be
|
||||
// resolved through the proxy instead of using the local DNS service.
|
||||
// This is only supported by SOCKS5 and HTTP.
|
||||
bool proxy_hostnames;
|
||||
bool proxy_hostnames = true;
|
||||
|
||||
// determines whether or not to exempt peer and web seed connections
|
||||
// from using the proxy. This defaults to true, i.e. peer connections are
|
||||
// proxied by default.
|
||||
bool proxy_peer_connections;
|
||||
bool proxy_peer_connections = true;
|
||||
|
||||
// if true, tracker connections are subject to the proxy settings
|
||||
bool proxy_tracker_connections;
|
||||
bool proxy_tracker_connections = true;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -35,41 +35,34 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/session_settings.hpp"
|
||||
|
||||
namespace libtorrent { namespace aux {
|
||||
proxy_settings::proxy_settings()
|
||||
: type(0)
|
||||
, port(0)
|
||||
, proxy_hostnames(true)
|
||||
, proxy_peer_connections(true)
|
||||
, proxy_tracker_connections(true)
|
||||
{}
|
||||
|
||||
proxy_settings::proxy_settings() = default;
|
||||
|
||||
proxy_settings::proxy_settings(settings_pack const& sett)
|
||||
{
|
||||
hostname = sett.get_str(settings_pack::proxy_hostname);
|
||||
username = sett.get_str(settings_pack::proxy_username);
|
||||
password = sett.get_str(settings_pack::proxy_password);
|
||||
type = std::uint8_t(sett.get_int(settings_pack::proxy_type));
|
||||
port = std::uint16_t(sett.get_int(settings_pack::proxy_port));
|
||||
proxy_hostnames = sett.get_bool(settings_pack::proxy_hostnames);
|
||||
proxy_peer_connections = sett.get_bool(
|
||||
settings_pack::proxy_peer_connections);
|
||||
proxy_tracker_connections = sett.get_bool(
|
||||
settings_pack::proxy_tracker_connections);
|
||||
}
|
||||
: hostname(sett.get_str(settings_pack::proxy_hostname))
|
||||
, username(sett.get_str(settings_pack::proxy_username))
|
||||
, password(sett.get_str(settings_pack::proxy_password))
|
||||
, type(std::uint8_t(sett.get_int(settings_pack::proxy_type)))
|
||||
, port(std::uint16_t(sett.get_int(settings_pack::proxy_port)))
|
||||
, proxy_hostnames(sett.get_bool(settings_pack::proxy_hostnames))
|
||||
, proxy_peer_connections(sett.get_bool(
|
||||
settings_pack::proxy_peer_connections))
|
||||
, proxy_tracker_connections(sett.get_bool(
|
||||
settings_pack::proxy_tracker_connections))
|
||||
{}
|
||||
|
||||
proxy_settings::proxy_settings(aux::session_settings const& sett)
|
||||
{
|
||||
hostname = sett.get_str(settings_pack::proxy_hostname);
|
||||
username = sett.get_str(settings_pack::proxy_username);
|
||||
password = sett.get_str(settings_pack::proxy_password);
|
||||
type = std::uint8_t(sett.get_int(settings_pack::proxy_type));
|
||||
port = std::uint16_t(sett.get_int(settings_pack::proxy_port));
|
||||
proxy_hostnames = sett.get_bool(settings_pack::proxy_hostnames);
|
||||
proxy_peer_connections = sett.get_bool(
|
||||
settings_pack::proxy_peer_connections);
|
||||
proxy_tracker_connections = sett.get_bool(
|
||||
settings_pack::proxy_tracker_connections);
|
||||
}
|
||||
: hostname(sett.get_str(settings_pack::proxy_hostname))
|
||||
, username(sett.get_str(settings_pack::proxy_username))
|
||||
, password(sett.get_str(settings_pack::proxy_password))
|
||||
, type(std::uint8_t(sett.get_int(settings_pack::proxy_type)))
|
||||
, port(std::uint16_t(sett.get_int(settings_pack::proxy_port)))
|
||||
, proxy_hostnames(sett.get_bool(settings_pack::proxy_hostnames))
|
||||
, proxy_peer_connections(sett.get_bool(
|
||||
settings_pack::proxy_peer_connections))
|
||||
, proxy_tracker_connections(sett.get_bool(
|
||||
settings_pack::proxy_tracker_connections))
|
||||
{}
|
||||
|
||||
} // namespace aux
|
||||
} // namespace libtorrent
|
||||
|
|
Loading…
Reference in New Issue