Initial multiple pools support [1/2].
This commit is contained in:
parent
faf793b0aa
commit
952017ae7a
6 changed files with 162 additions and 111 deletions
|
@ -31,19 +31,35 @@
|
|||
class Url
|
||||
{
|
||||
public:
|
||||
constexpr static const char *kDefaultPassword = "x";
|
||||
constexpr static const char *kDefaultUser = "x";
|
||||
constexpr static uint16_t kDefaultPort = 3333;
|
||||
|
||||
Url();
|
||||
Url(const char *url);
|
||||
Url(const char *host, uint16_t port);
|
||||
Url(const char *host, uint16_t port, const char *user = nullptr, const char *password = nullptr, bool keepAlive = false, bool nicehash = false );
|
||||
~Url();
|
||||
|
||||
bool isNicehash() const;
|
||||
inline bool isKeepAlive() const { return m_keepAlive; }
|
||||
inline bool isValid() const { return m_host && m_port > 0; }
|
||||
inline const char *host() const { return m_host; }
|
||||
inline const char *password() const { return m_password ? m_password : kDefaultPassword; }
|
||||
inline const char *user() const { return m_user ? m_user : kDefaultUser; }
|
||||
inline uint16_t port() const { return m_port; }
|
||||
inline void setKeepAlive(bool keepAlive) { m_keepAlive = keepAlive; }
|
||||
inline void setNicehash(bool nicehash) { m_nicehash = nicehash; }
|
||||
|
||||
inline bool isValid() const { return m_host && m_port > 0; }
|
||||
inline const char *host() const { return m_host; }
|
||||
inline uint16_t port() const { return m_port; }
|
||||
bool isNicehash() const;
|
||||
bool parse(const char *url);
|
||||
void setPassword(const char *password, bool force = true);
|
||||
void setUser(const char *user, bool force = true);
|
||||
|
||||
private:
|
||||
bool m_keepAlive;
|
||||
bool m_nicehash;
|
||||
char *m_host;
|
||||
char *m_password;
|
||||
char *m_user;
|
||||
uint16_t m_port;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue