Added tls flag to Url
This commit is contained in:
parent
7f9e86a627
commit
e082a3d093
2 changed files with 8 additions and 2 deletions
|
@ -58,6 +58,7 @@ Url::Url() :
|
||||||
* @param url
|
* @param url
|
||||||
*/
|
*/
|
||||||
Url::Url(const char *url) :
|
Url::Url(const char *url) :
|
||||||
|
m_tls(false),
|
||||||
m_keepAlive(false),
|
m_keepAlive(false),
|
||||||
m_nicehash(false),
|
m_nicehash(false),
|
||||||
m_host(nullptr),
|
m_host(nullptr),
|
||||||
|
@ -69,7 +70,8 @@ Url::Url(const char *url) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Url::Url(const char *host, uint16_t port, const char *user, const char *password, bool keepAlive, bool nicehash) :
|
Url::Url(const char *host, uint16_t port, const char *user, const char *password, bool tls, bool keepAlive, bool nicehash) :
|
||||||
|
m_tls(tls),
|
||||||
m_keepAlive(keepAlive),
|
m_keepAlive(keepAlive),
|
||||||
m_nicehash(nicehash),
|
m_nicehash(nicehash),
|
||||||
m_password(password ? strdup(password) : nullptr),
|
m_password(password ? strdup(password) : nullptr),
|
||||||
|
@ -180,6 +182,7 @@ void Url::setUser(const char *user)
|
||||||
|
|
||||||
Url &Url::operator=(const Url *other)
|
Url &Url::operator=(const Url *other)
|
||||||
{
|
{
|
||||||
|
m_tls = other->m_tls;
|
||||||
m_keepAlive = other->m_keepAlive;
|
m_keepAlive = other->m_keepAlive;
|
||||||
m_nicehash = other->m_nicehash;
|
m_nicehash = other->m_nicehash;
|
||||||
m_port = other->m_port;
|
m_port = other->m_port;
|
||||||
|
|
|
@ -37,9 +37,10 @@ public:
|
||||||
|
|
||||||
Url();
|
Url();
|
||||||
Url(const char *url);
|
Url(const char *url);
|
||||||
Url(const char *host, uint16_t port, const char *user = nullptr, const char *password = nullptr, bool keepAlive = false, bool nicehash = false );
|
Url(const char *host, uint16_t port, const char *user = nullptr, const char *password = nullptr, bool tls = false, bool keepAlive = false, bool nicehash = false );
|
||||||
~Url();
|
~Url();
|
||||||
|
|
||||||
|
inline bool isTls() const { return m_tls; }
|
||||||
inline bool isKeepAlive() const { return m_keepAlive; }
|
inline bool isKeepAlive() const { return m_keepAlive; }
|
||||||
inline bool isNicehash() const { return m_nicehash; }
|
inline bool isNicehash() const { return m_nicehash; }
|
||||||
inline bool isValid() const { return m_host && m_port > 0; }
|
inline bool isValid() const { return m_host && m_port > 0; }
|
||||||
|
@ -47,6 +48,7 @@ public:
|
||||||
inline const char *password() const { return m_password ? m_password : kDefaultPassword; }
|
inline const char *password() const { return m_password ? m_password : kDefaultPassword; }
|
||||||
inline const char *user() const { return m_user ? m_user : kDefaultUser; }
|
inline const char *user() const { return m_user ? m_user : kDefaultUser; }
|
||||||
inline uint16_t port() const { return m_port; }
|
inline uint16_t port() const { return m_port; }
|
||||||
|
inline void setTls(bool tls) { m_tls = tls; }
|
||||||
inline void setKeepAlive(bool keepAlive) { m_keepAlive = keepAlive; }
|
inline void setKeepAlive(bool keepAlive) { m_keepAlive = keepAlive; }
|
||||||
inline void setNicehash(bool nicehash) { m_nicehash = nicehash; }
|
inline void setNicehash(bool nicehash) { m_nicehash = nicehash; }
|
||||||
|
|
||||||
|
@ -59,6 +61,7 @@ public:
|
||||||
Url &operator=(const Url *other);
|
Url &operator=(const Url *other);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool m_tls;
|
||||||
bool m_keepAlive;
|
bool m_keepAlive;
|
||||||
bool m_nicehash;
|
bool m_nicehash;
|
||||||
char *m_host;
|
char *m_host;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue