ferencd@0: #ifndef CONFIG ferencd@0: #define CONFIG ferencd@0: ferencd@0: #include ferencd@0: ferencd@0: class config final ferencd@0: { ferencd@0: public: ferencd@0: ferencd@0: config(); ferencd@0: ferencd@0: static config& instance(); ferencd@0: ferencd@0: bool valid() const {return m_valid;} ferencd@0: ferencd@0: struct c_flood final ferencd@0: { ferencd@0: // How many times a host can request from us in a second before we decide that it is flooding us. ferencd@0: int max_offense_per_second = 100; ferencd@0: ferencd@0: // How many times do we accept a flooding offense/second before we consider to put the host on a ban list ferencd@0: int max_accepted_offenses = 10; ferencd@0: ferencd@0: //how long time must pass after the first offense in order to really put the host on ban list ferencd@0: double max_offense_time = 60.0; ferencd@0: ferencd@0: // the default time an offenser gets kicked out, 1 minute ferencd@0: int default_suspension_time = 60; ferencd@0: }; ferencd@0: ferencd@0: struct c_server final ferencd@0: { ferencd@0: // how many seconds do we allow for a host to be invisible before we switch it'sstatus to red on the dashboard ferencd@0: int max_offline_seconds_allowed = 10; ferencd@0: ferencd@0: // how many seconds do we allow for waiting for a client to appear before showing an error message ferencd@0: int max_client_notconnected_seconds_allowed = 60; ferencd@0: ferencd@0: // how many seconds do we allow for waiting for a client to appear before showing an error message ferencd@0: int max_client_grace_seconds = 60; ferencd@0: ferencd@0: // how many extra grace seconds can a client get ferencd@0: int max_extra_grace_seconds = 60; ferencd@0: ferencd@0: // how many seconds when we check in the pending query handling if a host has checked out or not ferencd@0: int host_logout_check_seconds = 5; ferencd@0: ferencd@0: // how many grace seconds do we allow to a host when dealing with query ferencd@0: int host_grace_time_extension = 10; ferencd@0: ferencd@0: // how many seconds must pass before we consider the host to be offline ferencd@0: int host_offline_confirmed_seconds = 360; ferencd@0: ferencd@0: // how many seconds must pass before we suspect the host to be offline ferencd@0: int host_offline_suspect_seconds = 10; ferencd@0: ferencd@0: // initially we support 50MB as download ferencd@0: uint64_t max_download_support = 52428800; ferencd@0: }; ferencd@0: ferencd@0: public: ferencd@0: ferencd@0: c_flood flood; ferencd@0: c_server server; ferencd@0: ferencd@0: private: ferencd@0: ferencd@0: bool m_valid; ferencd@0: }; ferencd@0: ferencd@0: #endif // CONFIG ferencd@0: