diff options
Diffstat (limited to 'server/server/config.h')
-rw-r--r-- | server/server/config.h | 176 |
1 files changed, 108 insertions, 68 deletions
diff --git a/server/server/config.h b/server/server/config.h index 6683d7e..d411411 100644 --- a/server/server/config.h +++ b/server/server/config.h @@ -4,85 +4,101 @@ #include "headers.h" -struct proxy_entry -{ - std::string host, login, password, country, state, city; - int port; - proxy_entry(): port(0) - {} - proxy_entry (std::string login_, std::string password_, std::string host_, int port_, std::string country_, std::string state_, std::string city_) - { - login = login_; - password = password_; - host = host_; - port = port; - country = country_; - state = state_; - city = city_; - } -}; -struct static_proxy_entry +class config { - int port, position; - uint64_t speed; - std::string host, login, password, label; - static_proxy_entry(): port(0), position(0), speed(0) - {} - static_proxy_entry(std::string login_, std::string password_, std::string host_, int port_, std::string label_, int position_) +public: + struct proxy_entry { - login = login_; - password = password_; - host = host_; - port = port_; - label = label_; - position = position_; - } -}; + std::string host, login, password, country, state, city; + int port; + proxy_entry(): port(0) + {} + proxy_entry (std::string login_, std::string password_, std::string host_, int port_, std::string country_, std::string state_, std::string city_) + { + login = login_; + password = password_; + host = host_; + port = port; + country = country_; + state = state_; + city = city_; + } + }; -struct s_i -{ - std::string name; - int type; - s_i() + struct static_proxy_entry { - type = 0; - } - s_i(const std::string& n, int t) + int port, position; + uint64_t speed; + std::string host, login, password, label; + static_proxy_entry(): port(0), position(0), speed(0) + {} + static_proxy_entry(std::string login_, std::string password_, std::string host_, int port_, std::string label_, int position_) + { + login = login_; + password = password_; + host = host_; + port = port_; + label = label_; + position = position_; + } + }; + + struct s_i { - name = n; - type = t; - } -}; + std::string name; + int type; + s_i() + { + type = 0; + } + s_i(const std::string& n, int t) + { + name = n; + type = t; + } + }; -struct upload_entry -{ - std::string source, destination, hash; - upload_entry(){} - upload_entry(std::string source_, std::string destination_, std::string hash_) + struct upload_entry { - source = source_; - destination = destination_; - hash = hash_; - } - bool operator==(const s_i& s) + std::string source, destination, hash; + upload_entry(){} + upload_entry(std::string source_, std::string destination_, std::string hash_) + { + source = source_; + destination = destination_; + hash = hash_; + } + bool operator==(const s_i& s) + { + switch(s.type) + { + case 0: + return s.name == source; + case 1: + return s.name == destination; + default: + break; + } + return false; + } + }; + struct conn_server { - switch(s.type) + std::string host; + int interval, timeout; + conn_server() { - case 0: - return s.name == source; - case 1: - return s.name == destination; - default: - break; + interval = 600; + timeout = 60; } - return false; - } -}; - -class config -{ -public: + conn_server(const std::string& s, int i, int t) + { + host = s; + interval = i; + timeout = t; + } + }; config(const char *path); const int ban_time(); const int conn_count(); @@ -90,6 +106,14 @@ public: const int check_interval(); const int debug(); const int dos_conn_count(); + const int c_cfg_upd_int(); + const int c_cli_upd_int(); + bool c_speed_visibility(); + const std::string& c_welcome_msg(); + const std::string& c_cfg_download_msg(); + const std::string& c_top_text(); + const std::string& c_bottom_text(); + bool ignore_ssl_errors(); const std::string& bind_ip(); const std::string& log_path(); @@ -99,6 +123,7 @@ public: std::list<std::string> *get_firewall_list(); std::list<std::string> *get_deleted_list(); std::list<upload_entry> *get_upload_list(); + std::list<conn_server> *get_server_list(); private: struct cfg_data { @@ -115,6 +140,18 @@ private: dos_conn_count = 200; } }; + struct cli_cfg_data + { + int config_update_interval, client_update_interval; + std::string welcome_msg, cfg_downloaded_msg, top_text, bottom_text; + bool speed_visibility; + cli_cfg_data() + { + config_update_interval = 300; + client_update_interval = 60000; + speed_visibility = false; + } + }; const int get_int(const std::string& data, const char* var, int default_); const std::string get_string(const std::string& data, const char* var, const std::string& default_); void load_proxy_list(char* pth = NULL); @@ -122,11 +159,14 @@ private: void load_firewall_list(char* pth = NULL); void load_upload_list(char* pth = NULL); void load_deleted_list(char* pth = NULL); + void load_servers_list(char* pth = NULL); cfg_data vars; + cli_cfg_data cvars; std::list<proxy_entry> proxy_list; std::list<static_proxy_entry> static_proxy_list; std::list<std::string> firewall_list, deleted_list; std::list<upload_entry> upload_list; + std::list<conn_server> servers_list; }; #endif
\ No newline at end of file |