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