0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-11-22 14:08:23 -05:00

Compare commits

...

32 Commits

Author SHA1 Message Date
Abhinav Pandey
edef4424b1
Merge f2a32252ce into 41ab8a2a76 2024-02-28 12:09:35 +00:00
ddotthomas
41ab8a2a76
config option to configure the https adaptive window size for requests (#529)
* Added config option to enable the reqwest client adaptive window

* Change adaptive window config name

Co-authored-by: neon_arch <mustafadhuleb53@gmail.com>

* Modified documentation

* Trimmed down aggregate parameters

---------

Co-authored-by: neon_arch <mustafadhuleb53@gmail.com>
2024-02-28 15:08:29 +03:00
mergify[bot]
f2a32252ce
Merge branch 'rolling' into rolling 2023-12-30 16:07:42 +00:00
mergify[bot]
bdc5170c87
Merge branch 'rolling' into rolling 2023-12-30 06:58:26 +00:00
mergify[bot]
f59a68ea41
Merge branch 'rolling' into rolling 2023-12-25 13:13:46 +00:00
mergify[bot]
6b3e309670
Merge branch 'rolling' into rolling 2023-12-22 04:32:43 +00:00
mergify[bot]
154880ca94
Merge branch 'rolling' into rolling 2023-12-14 16:38:12 +00:00
mergify[bot]
78d84ae6cb
Merge branch 'rolling' into rolling 2023-12-13 13:24:46 +00:00
mergify[bot]
c8a80d0d3b
Merge branch 'rolling' into rolling 2023-12-11 03:46:06 +00:00
mergify[bot]
4e11bedc91
Merge branch 'rolling' into rolling 2023-12-06 02:45:37 +00:00
alamin655
0991fe8ed9
Merge branch 'rolling' into rolling 2023-12-02 17:16:39 +05:30
mergify[bot]
6cc3f49fb7
Merge branch 'rolling' into rolling 2023-11-30 12:09:54 +00:00
neon_arch
ab8f38b1ef
Merge branch 'rolling' into rolling 2023-11-25 12:38:11 +03:00
Abhinav Pandey
9706363527
Merge branch 'rolling' into rolling 2023-11-21 20:08:27 +05:30
mergify[bot]
9aa817cb59
Merge branch 'rolling' into rolling 2023-10-31 05:39:09 +00:00
mergify[bot]
8a7d2773cf
Merge branch 'rolling' into rolling 2023-10-27 20:39:22 +00:00
mergify[bot]
965af2f92c
Merge branch 'rolling' into rolling 2023-10-23 13:35:37 +00:00
Abhinav Pandey
8f3aceb9dd
Merge branch 'rolling' into rolling 2023-10-22 11:01:56 +05:30
alamin655
b0ece9b921
Merge branch 'rolling' into rolling 2023-10-19 18:03:00 +05:30
Abhinav Pandey
25730ba5fa
Merge branch 'neon-mmd:rolling' into rolling 2023-10-16 04:03:28 +05:30
mergify[bot]
23f74599d7
Merge branch 'rolling' into rolling 2023-10-13 04:15:31 +00:00
mergify[bot]
5c53c6b4cd
Merge branch 'rolling' into rolling 2023-10-04 04:07:51 +00:00
alamin655
dc5f1f0e38
Merge branch 'rolling' into rolling 2023-10-04 09:35:06 +05:30
alamin655
66fbf2382f
Merge branch 'rolling' into rolling 2023-10-03 11:58:23 +05:30
alamin655
efc2908ea9
Merge branch 'rolling' into rolling 2023-10-03 09:01:11 +05:30
alamin655
8b21aca1b2
Merge branch 'rolling' into rolling 2023-10-01 12:38:21 +05:30
alamin655
a41d2be0ac
Merge branch 'rolling' into rolling 2023-09-28 07:55:07 +05:30
alamin655
ff141c1df1
Merge branch 'rolling' into rolling 2023-09-26 17:32:48 +05:30
alamin655
8016362008
Merge branch 'rolling' into rolling 2023-09-24 14:41:06 +05:30
alamin655
5437b99d0e
Merge branch 'rolling' into rolling 2023-09-23 18:53:34 +05:30
Abhinav Pandey
f716dfbc80
Merge branch 'neon-mmd:rolling' into rolling 2023-09-23 18:08:59 +05:30
Abhinav Pandey
02a098c169 Update CODE_OF_CONDUCT 2023-09-23 18:08:43 +05:30
5 changed files with 69 additions and 61 deletions

View File

@ -4,82 +4,86 @@
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community and as such we strongly believe in **give respect and take respect** policy. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. We firmly believe in the **give respect and take respect** policy.
# What We Strive At ---
* **Be patient.** ## What We Strive At
* **Be welcoming and be friendly**: We strive to be a community that welcomes, supports and remain friendly to people of all backgrounds and identities. This includes, but is not limited to members of any race, ethnicity, culture, national origin, colour, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and mental and physical ability.
* **Be considerate**: Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and you should take those consequences into account when making decisions. Remember that we're a world-wide community, so you might not be communicating in someone else's primary language.
* **Be respectful**: Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. Its important to remember that a community where people feel uncomfortable or threatened is not a productive one.
* **Be careful in the words that you choose**: we are a community of professionals, and we conduct ourselves professionally. Be kind to others. Do not insult or put down other participants. Harassment and other exclusionary behavior aren't acceptable. This includes, but is not limited to:
* Violent threats or language directed against another person.
* Discriminatory jokes and language.
* Using political talks and political orientated views.
* Posting sexually explicit or violent material.
* Posting (or threatening to post) other people's personally identifying information ("doxing").
* Personal insults, especially those using racist or sexist terms.
* Unwelcome sexual attention.
* Advocating for, or encouraging, any of the above behavior.
* Humor is acceptable but should not be done to harass, demean or to insult others.
* Repeated harassment of others. In general, if someone asks you to stop, then stop.
* Using overtly sexual aliases or other nicknames that might detract from a friendly, safe and welcoming environment for all.
* Using bad words or cursing.
* **When we disagree, try to understand why**: Disagreements, both social and technical, happen all the time. It is important that we resolve disagreements and differing views constructively. Remember that were different. The strength of our community comes from its diversity, people from a wide range of backgrounds. Different people have different perspectives on issues. Being unable to understand why someone holds a viewpoint doesnt mean that theyre wrong. Dont forget that it is human to err and blaming each other doesnt get us anywhere. Instead, focus on helping to resolve issues and learning from mistakes.
* **Treat everyone equally:** we are community of mature people and maturity in the way we act, behave and treat others and as such we treat others as our brothers and sisters.
# Scope ### Be patient.
### Be welcoming and be friendly
We strive to be a community that welcomes and supports people from all backgrounds and identities. This includes, but is not limited to members of any race, ethnicity, culture, national origin, color, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and mental and physical ability.
The scope of the conduct of code is not limited to one individual or few individuals. This code of conduct applies for all be it the maintainer, the developer or any role assigned to the project or involved in any other way to the project. This code of conduct is not to provide privelages of one over the other. Any failure to enforce, act, using the code of conduct for your benefit or to evade certain situations or findings way to evade this conduct or a failure to provide a safe environment for others under the umberalla of this code of conduct will be considered a clear act of violation. ### Be considerate
Your work will be used by other people, and you will depend on the work of others. Consider the global nature of our community when communicating, as you might not be interacting in someone else's primary language.
# Violation ### Be respectful
Disagreement is no excuse for poor behavior. While we all get frustrated, it should never result in personal attacks. A community where people feel uncomfortable is counterproductive.
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### Be careful in the words that you choose
We expect professional conduct. Harassment, exclusionary behavior, and other unprofessional behaviors are unacceptable. This includes:
- Violent threats or discriminatory language.
- Discriminatory jokes.
- Exclusion based on political talks/views.
- Posting explicit content or doxing.
- Personal insults, especially those with harmful intent.
- Unwanted sexual attention or behavior.
- Encouraging any of the above behaviors.
- Inappropriate humor.
- Persistent harassment.
- Using offensive aliases or nicknames.
- Using profanities.
### When we disagree, try to understand why
Our community is diverse. Approach disagreements with an open mind and a willingness to understand.
### Treat everyone equally
We are a community of maturity. Treat everyone as a sibling.
---
## Scope
This Code of Conduct applies to everyone, irrespective of their role. Using this Code of Conduct for personal gain or to evade responsibilities will be considered a violation.
---
## Violation
Violations will result in consequences as described:
1. **Correction** 1. **Correction**
*Community Impact:* Inappropriate or unprofessional behavior.
**Community Impact:** Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. *Consequence:* A private written warning and possibly a public apology.
**Consequence:** A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
2. **Warning** 2. **Warning**
*Community Impact:* A single serious violation or multiple minor ones.
**Community Impact:** A violation through a single incident or series of actions. *Consequence:* A warning with stipulated consequences for future breaches. This may include limited interaction with certain individuals or platforms.
**Consequence:** A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
3. **Temporary Ban** 3. **Temporary Ban**
*Community Impact:* A serious, sustained violation of community standards.
**Community Impact:** A serious violation of community standards, including sustained inappropriate behavior. *Consequence:* A temporary ban from community interactions.
**Consequence:** A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
4. **Permanent Ban** 4. **Permanent Ban**
*Community Impact:* Prolonged harmful behavior.
*Consequence:* A permanent ban from community interactions.
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. ---
**Consequence**: A permanent ban from any sort of public interaction within the community. ## Reporting Issues
Experiencing or witnessing unacceptable behavior? Report it by [Emailing Us](mailto:mustafadhuleb53@gmail.com). Reports are confidential. In your report, please provide:
- Your contact details.
- Involved individuals.
- Description of the occurrence.
- Relevant links if available.
# Reporting Issues Anyone asked to cease unacceptable behavior is expected to comply immediately.
If you experience or witness unacceptable behavior—or have any other concerns—please report it by contacting the community leader via [mustafadhuleb53@gmail.com](mustafadhuleb53@gmail.com). All reports will be handled with discretion. In your report please include: ---
- Your contact information.
- Names (real, nicknames, or pseudonyms) of any individuals involved. If there are additional witnesses, please
include them as well. Your account of what occurred, and if you believe the incident is ongoing. If there is a publicly available record (e.g. a mailing list archive or a public IRC logger), please include a link.
- Any additional information that may be helpful.
Anyone asked to stop unacceptable behavior is expected to comply immediately. If an individual engages in unacceptable behavior, We will act according to the [violations rules](#violation) as stated above.
## Attribution ## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html, [Rust Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct) and [Twitter's Code of Conduct](https://github.com/twitter/.github/blob/main/code-of-conduct.md?plain=1) This Code of Conduct draws inspiration from [Contributor Covenant](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html), [Rust Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct), and [Twitter's Code of Conduct](https://github.com/twitter/.github/blob/main/code-of-conduct.md?plain=1).
Community Impact Guidelines reference [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). For further information, refer to the [FAQ](https://www.contributor-covenant.org/faq) or view [translations](https://www.contributor-covenant.org/translations).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

View File

@ -30,6 +30,8 @@ pub struct Config {
pub logging: bool, pub logging: bool,
/// It stores the option to whether enable or disable debug mode. /// It stores the option to whether enable or disable debug mode.
pub debug: bool, pub debug: bool,
/// It toggles whether to use adaptive HTTP windows
pub adaptive_window: bool,
/// It stores all the engine names that were enabled by the user. /// It stores all the engine names that were enabled by the user.
pub upstream_search_engines: HashMap<String, bool>, pub upstream_search_engines: HashMap<String, bool>,
/// It stores the time (secs) which controls the server request timeout. /// It stores the time (secs) which controls the server request timeout.
@ -68,6 +70,7 @@ impl Config {
let debug: bool = globals.get::<_, bool>("debug")?; let debug: bool = globals.get::<_, bool>("debug")?;
let logging: bool = globals.get::<_, bool>("logging")?; let logging: bool = globals.get::<_, bool>("logging")?;
let adaptive_window: bool = globals.get::<_, bool>("adaptive_window")?;
if !logging_initialized { if !logging_initialized {
set_logging_level(debug, logging); set_logging_level(debug, logging);
@ -125,6 +128,7 @@ impl Config {
}, },
logging, logging,
debug, debug,
adaptive_window,
upstream_search_engines: globals upstream_search_engines: globals
.get::<_, HashMap<String, bool>>("upstream_search_engines")?, .get::<_, HashMap<String, bool>>("upstream_search_engines")?,
request_timeout: globals.get::<_, u8>("request_timeout")?, request_timeout: globals.get::<_, u8>("request_timeout")?,

View File

@ -2,6 +2,7 @@
//! search engines and then removes duplicate results. //! search engines and then removes duplicate results.
use super::user_agent::random_user_agent; use super::user_agent::random_user_agent;
use crate::config::parser::Config;
use crate::handler::{file_path, FileType}; use crate::handler::{file_path, FileType};
use crate::models::{ use crate::models::{
aggregation_models::{EngineErrorInfo, SearchResult, SearchResults}, aggregation_models::{EngineErrorInfo, SearchResult, SearchResults},
@ -66,18 +67,17 @@ type FutureVec = Vec<JoinHandle<Result<HashMap<String, SearchResult>, Report<Eng
pub async fn aggregate( pub async fn aggregate(
query: &str, query: &str,
page: u32, page: u32,
random_delay: bool, config: &Config,
debug: bool,
upstream_search_engines: &[EngineHandler], upstream_search_engines: &[EngineHandler],
request_timeout: u8,
safe_search: u8, safe_search: u8,
) -> Result<SearchResults, Box<dyn std::error::Error>> { ) -> Result<SearchResults, Box<dyn std::error::Error>> {
let client = CLIENT.get_or_init(|| { let client = CLIENT.get_or_init(|| {
ClientBuilder::new() ClientBuilder::new()
.timeout(Duration::from_secs(request_timeout as u64)) // Add timeout to request to avoid DDOSing the server .timeout(Duration::from_secs(config.request_timeout as u64)) // Add timeout to request to avoid DDOSing the server
.https_only(true) .https_only(true)
.gzip(true) .gzip(true)
.brotli(true) .brotli(true)
.http2_adaptive_window(config.adaptive_window)
.build() .build()
.unwrap() .unwrap()
}); });
@ -85,7 +85,7 @@ pub async fn aggregate(
let user_agent: &str = random_user_agent(); let user_agent: &str = random_user_agent();
// Add a random delay before making the request. // Add a random delay before making the request.
if random_delay || !debug { if config.aggregator.random_delay || !config.debug {
let nanos = SystemTime::now().duration_since(UNIX_EPOCH)?.subsec_nanos() as f32; let nanos = SystemTime::now().duration_since(UNIX_EPOCH)?.subsec_nanos() as f32;
let delay = ((nanos / 1_0000_0000 as f32).floor() as u64) + 1; let delay = ((nanos / 1_0000_0000 as f32).floor() as u64) + 1;
tokio::time::sleep(Duration::from_secs(delay)).await; tokio::time::sleep(Duration::from_secs(delay)).await;

View File

@ -209,14 +209,12 @@ async fn results(
aggregate( aggregate(
query, query,
page, page,
config.aggregator.random_delay, config,
config.debug,
&search_settings &search_settings
.engines .engines
.iter() .iter()
.filter_map(|engine| EngineHandler::new(engine).ok()) .filter_map(|engine| EngineHandler::new(engine).ok())
.collect::<Vec<EngineHandler>>(), .collect::<Vec<EngineHandler>>(),
config.request_timeout,
safe_search_level, safe_search_level,
) )
.await? .await?

View File

@ -14,6 +14,8 @@ rate_limiter = {
number_of_requests = 20, -- The number of request that are allowed within a provided time limit. number_of_requests = 20, -- The number of request that are allowed within a provided time limit.
time_limit = 3, -- The time limit in which the quantity of requests that should be accepted. time_limit = 3, -- The time limit in which the quantity of requests that should be accepted.
} }
-- Set whether the server will use an adaptive/dynamic HTTPS window size, see https://httpwg.org/specs/rfc9113.html#fc-principles
https_adaptive_window_size = false
-- ### Search ### -- ### Search ###
-- Filter results based on different levels. The levels provided are: -- Filter results based on different levels. The levels provided are: