Mercurial > thymian
annotate server/config.h @ 0:a4671277546c tip
created the repository for the thymian project
| author | ferencd |
|---|---|
| date | Tue, 17 Aug 2021 11:19:54 +0200 |
| parents | |
| children |
| rev | line source |
|---|---|
| ferencd@0 | 1 #ifndef CONFIG |
| ferencd@0 | 2 #define CONFIG |
| ferencd@0 | 3 |
| ferencd@0 | 4 #include <stdint.h> |
| ferencd@0 | 5 |
| ferencd@0 | 6 class config final |
| ferencd@0 | 7 { |
| ferencd@0 | 8 public: |
| ferencd@0 | 9 |
| ferencd@0 | 10 config(); |
| ferencd@0 | 11 |
| ferencd@0 | 12 static config& instance(); |
| ferencd@0 | 13 |
| ferencd@0 | 14 bool valid() const {return m_valid;} |
| ferencd@0 | 15 |
| ferencd@0 | 16 struct c_flood final |
| ferencd@0 | 17 { |
| ferencd@0 | 18 // How many times a host can request from us in a second before we decide that it is flooding us. |
| ferencd@0 | 19 int max_offense_per_second = 100; |
| ferencd@0 | 20 |
| ferencd@0 | 21 // How many times do we accept a flooding offense/second before we consider to put the host on a ban list |
| ferencd@0 | 22 int max_accepted_offenses = 10; |
| ferencd@0 | 23 |
| ferencd@0 | 24 //how long time must pass after the first offense in order to really put the host on ban list |
| ferencd@0 | 25 double max_offense_time = 60.0; |
| ferencd@0 | 26 |
| ferencd@0 | 27 // the default time an offenser gets kicked out, 1 minute |
| ferencd@0 | 28 int default_suspension_time = 60; |
| ferencd@0 | 29 }; |
| ferencd@0 | 30 |
| ferencd@0 | 31 struct c_server final |
| ferencd@0 | 32 { |
| ferencd@0 | 33 // how many seconds do we allow for a host to be invisible before we switch it'sstatus to red on the dashboard |
| ferencd@0 | 34 int max_offline_seconds_allowed = 10; |
| ferencd@0 | 35 |
| ferencd@0 | 36 // how many seconds do we allow for waiting for a client to appear before showing an error message |
| ferencd@0 | 37 int max_client_notconnected_seconds_allowed = 60; |
| ferencd@0 | 38 |
| ferencd@0 | 39 // how many seconds do we allow for waiting for a client to appear before showing an error message |
| ferencd@0 | 40 int max_client_grace_seconds = 60; |
| ferencd@0 | 41 |
| ferencd@0 | 42 // how many extra grace seconds can a client get |
| ferencd@0 | 43 int max_extra_grace_seconds = 60; |
| ferencd@0 | 44 |
| ferencd@0 | 45 // how many seconds when we check in the pending query handling if a host has checked out or not |
| ferencd@0 | 46 int host_logout_check_seconds = 5; |
| ferencd@0 | 47 |
| ferencd@0 | 48 // how many grace seconds do we allow to a host when dealing with query |
| ferencd@0 | 49 int host_grace_time_extension = 10; |
| ferencd@0 | 50 |
| ferencd@0 | 51 // how many seconds must pass before we consider the host to be offline |
| ferencd@0 | 52 int host_offline_confirmed_seconds = 360; |
| ferencd@0 | 53 |
| ferencd@0 | 54 // how many seconds must pass before we suspect the host to be offline |
| ferencd@0 | 55 int host_offline_suspect_seconds = 10; |
| ferencd@0 | 56 |
| ferencd@0 | 57 // initially we support 50MB as download |
| ferencd@0 | 58 uint64_t max_download_support = 52428800; |
| ferencd@0 | 59 }; |
| ferencd@0 | 60 |
| ferencd@0 | 61 public: |
| ferencd@0 | 62 |
| ferencd@0 | 63 c_flood flood; |
| ferencd@0 | 64 c_server server; |
| ferencd@0 | 65 |
| ferencd@0 | 66 private: |
| ferencd@0 | 67 |
| ferencd@0 | 68 bool m_valid; |
| ferencd@0 | 69 }; |
| ferencd@0 | 70 |
| ferencd@0 | 71 #endif // CONFIG |
| ferencd@0 | 72 |
