Skip to content

Commit

Permalink
2024-11-26 weekly sync
Browse files Browse the repository at this point in the history
  • Loading branch information
NxPKG committed Nov 25, 2024
1 parent 120283d commit 01599f8
Show file tree
Hide file tree
Showing 162 changed files with 5,440 additions and 2,219 deletions.
2 changes: 1 addition & 1 deletion .bleep
Original file line number Diff line number Diff line change
@@ -1 +1 @@
761f676b044dcf0d34205f96921e3385ffac7810
89319e9383d6f99066dfeace750a553d45e1c167
7 changes: 3 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@ module built on top of or for use with Bongonet and encourage you to pursue that

**You do not need to file an issue for small fixes.** What counts as a "small" or trivial fix is a
judgment call, so here's a few examples to clarify:

- fixing a typo
- refactoring a bit of code
- most documentation or comment edits

Still, *sometimes* we may review your PR and ask you to file an issue if we expect there are larger
Still, _sometimes_ we may review your PR and ask you to file an issue if we expect there are larger
design decisions to be made.

## Making a PR

After you've filed an issue, you can make your PR referencing that issue number. Once you open your
PR, it will be labelled *Needs Review*. A maintainer will review your PR as soon as they can. The
reviewer may ask for changes - they will mark the PR as *Changes Requested* and will give you
PR, it will be labelled _Needs Review_. A maintainer will review your PR as soon as they can. The
reviewer may ask for changes - they will mark the PR as _Changes Requested_ and will give you
details about the requested changes. Feel free to ask lots of questions! The maintainers are there
to help you.

Expand Down
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patreon: khulnasoft
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: Bug Report
about: Report an issue to help us improve
title: ""
labels: ""
assignees: ""
title: ''
labels: ''
assignees: ''
---

## Describe the bug
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Generate Cargo.lock
# https://github.com/rustsec/audit-check/issues/27
run: cargo generate-lockfile

- name: Audit Check
# https://github.com/rustsec/audit-check/issues/2
uses: rustsec/audit-check@master
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
bongonet:
strategy:
matrix:
toolchain: [nightly, 1.72, 1.80.0]
toolchain: [nightly, 1.72, 1.82.0]
runs-on: ubuntu-latest
# Only run on "pull_request" event for external PRs. This is to avoid
# duplicate builds for PRs created from internal branches.
Expand Down Expand Up @@ -46,8 +46,8 @@ jobs:

- name: Run cargo clippy
run: |
[[ ${{ matrix.toolchain }} != 1.80 ]] || cargo clippy --all-targets --all -- --allow=unknown-lints --deny=warnings
[[ ${{ matrix.toolchain }} != 1.82.0 ]] || cargo clippy --all-targets --all -- --allow=unknown-lints --deny=warnings
- name: Run cargo audit
run: |
[[ ${{ matrix.toolchain }} != 1.80.0 ]] || (cargo install cargo-audit && cargo audit)
[[ ${{ matrix.toolchain }} != 1.82.0 ]] || (cargo install cargo-audit && cargo audit)
4 changes: 2 additions & 2 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
on:
pull_request: {}
workflow_dispatch: {}
push:
push:
branches:
- main
- master
schedule:
- cron: "0 0 * * *"
- cron: '0 0 * * *'
name: Semgrep config
jobs:
semgrep:
Expand Down
46 changes: 34 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,42 @@

All notable changes to this project will be documented in this file.

## [0.3.0](https://github.com/khulnasoft/bongonet/compare/0.2.0...0.3.0) - 2024-07-12
## [0.4.0](https://github.com/khulnasoft/bongonet/compare/0.3.0...0.4.0) - 2024-11-01

### 🚀 Features
- [Add preliminary rustls support](https://github.com/khulnasoft/bongonet/commit/354a6ee1e99b82e23fc0f27a37d8bf41e62b2dc5)
- [Add experimental support for windows](https://github.com/khulnasoft/bongonet/commit/4aadba12727afe6178f3b9fc2a3cad2223ac7b2e)
- [Add the option to use no TLS implementation](https://github.com/khulnasoft/bongonet/commit/d8f3ffae77ddc1edd285ab1d517a1b6748ce3d58)
- [Add support for gRPC-web module to bridge gRPC-web client requests to gRPC server requests](https://github.com/khulnasoft/bongonet/commit/9917177c646a0ab58197f15ec57a3bcbe1e0a201)
- [Add the support for h2c and http1 to coexist](https://github.com/khulnasoft/bongonet/commit/792d5fd3c14c1cd588b155ddf09c09a4c125a26b)
- [Add the support for custom L4 connector](https://github.com/khulnasoft/bongonet/commit/7c122e7f36de5c946ac960a1691c5dd41f26e6e6)
- [Support opaque extension field in Backend](https://github.com/khulnasoft/bongonet/commit/999e379064d2c1266a267abdf9f4f41b14bffcf5)
- [Add the ability to ignore informational responses when proxying downstream](https://github.com/khulnasoft/bongonet/commit/be97e35031cf4f5a01191f1848bdf491bd9f0d62)
- [Add un-gzip support and allow decompress by algorithm](https://github.com/khulnasoft/bongonet/commit/e1c6e57db3e613991eda3160d15f81e0669ea066)
- [Add the ability to observe backend health status](https://github.com/khulnasoft/bongonet/commit/8a0c73f174a27a87c54426a748c4818b10de9425)
- [Add the support for passing sentry release](https://github.com/khulnasoft/bongonet/commit/07a970e413009ee62fc4c15e0820ae1aa036af22)
- [Add the support for binding to local port ranges](https://github.com/khulnasoft/bongonet/commit/d1d7a87b761eeb4f71fcaa3f7c4ae8e32f1d93c8)
- [Support retrieving rx timestamp for TcpStream](https://github.com/khulnasoft/bongonet/commit/d811795938cee5a6eb7cd46399cef17210a0d0c5)

### 🐛 Bug Fixes
- [Handle bare IPv6 address in raw connect Host](https://github.com/khulnasoft/bongonet/commit/9f50e6ccb09db2940eec6fc170a1e9e9b14a95d0)
- [Set proper response headers when compression is enabled](https://github.com/khulnasoft/bongonet/commit/55049c4e7983055551b34feee397c736ffc912bb)
- [Check the current advertised h2 max streams](https://github.com/khulnasoft/bongonet/commit/7419b1967e7686b00aefb7bcd2a4dfe59b31e639)
- Other bug fixes and improvements


### ⚙️ Changes and Miscellaneous Tasks
- [Make sentry an optional feature](https://github.com/khulnasoft/bongonet/commit/ab1b717bf587723c1c537d6549a8f8096f0900d4)
- [Make timeouts Sync](https://github.com/khulnasoft/bongonet/commit/18db42cd2cb892432fd7896f0da7e9d19221214b)
- [Retry all h2 connection when encountering graceful shutdown](https://github.com/khulnasoft/bongonet/commit/11b5882a422774cffbd14d9a9ea7dfc9dc98b02c)
- [Make l4 module pub to expose Connect](https://github.com/khulnasoft/bongonet/commit/91702bb0c0c5e1f2d5e2f40a19a3f340bb5a6d82)
- [Auto snake case set-cookie header when downgrade to from h2 to http1.1](https://github.com/khulnasoft/bongonet/commit/2c6190c634f2a5dd2f00e8597902f2b735a9d84f)
- [shutdown h2 connection gracefully with GOAWAYs](https://github.com/khulnasoft/bongonet/commit/04d7cfeef6205d2cf33ad5704a363ee107250771)
- Other API signature updates

## [0.3.0](https://github.com/khulnasoft/bongonet/compare/0.2.0...0.3.0) - 2024-07-12

### 🚀 Features
- Add support for HTTP modules. This feature allows users to import modules written by 3rd parties.
- Add `request_body_filter`. Now request body can be inspected and modified.
- Add H2c support.
Expand All @@ -19,7 +51,6 @@ All notable changes to this project will be documented in this file.
- Compression: allow setting level per algorithm.

### 🐛 Bug Fixes

- Fixed a panic when using multiple H2 streams in the same H2 connection to upstreams.
- Bongonet now respects the `Connection` header it sends to upstream.
- Accept-Ranges header is now removed when response is compressed.
Expand All @@ -28,7 +59,6 @@ All notable changes to this project will be documented in this file.
- Fix a FD mismatch error when 0.0.0.0 is used as the upstream IP

### ⚙️ Changes and Miscellaneous Tasks

- Dependency: replace `structopt` with `clap`
- Rework the API of HTTP modules
- Optimize remove_header() API call
Expand All @@ -38,7 +68,6 @@ All notable changes to this project will be documented in this file.
## [0.2.0](https://github.com/khulnasoft/bongonet/compare/0.1.1...0.2.0) - 2024-05-10

### 🚀 Features

- Add support for downstream h2 trailers and add an upstream h2 response trailer filter
- Add the ability to set TCP recv buf size
- Add a convenience function to retrieve Session digest
Expand All @@ -50,7 +79,6 @@ All notable changes to this project will be documented in this file.
- Make `pop_closed` pub, to simplify DIY drains

### 🐛 Bug Fixes

- Fixed gRPC trailer proxying
- Fixed `response_body_filter` `end_of_stream` always being false
- Fixed compile error in Rust <= 1.73
Expand All @@ -61,7 +89,6 @@ All notable changes to this project will be documented in this file.
- Fixed tinylfu test flake

### ⚙️ Changes and Miscellaneous Tasks

- API change: `Server::run_forever` now takes ownership and ensures exit semantics
- API change: `cleanup()` method of `ServerApp` trait is now async
- Behavior change: Always return `HttpTask::Body` on body done instead of `HttpTask::done`
Expand All @@ -74,8 +101,7 @@ All notable changes to this project will be documented in this file.
## [0.1.1](https://github.com/khulnasoft/bongonet/compare/0.1.0...0.1.1) - 2024-04-05

### 🚀 Features

- `Server::new` now accepts `Into<Option<T>>`
- `Server::new` now accepts `Into<Option<T>>`
- Implemented client `HttpSession::get_keepalive_values` for Keep-Alive parsing
- Expose `ListenFds` and `Fds` to fix a voldemort types issue
- Expose config options in `ServerConf`, provide new `Server` constructor
Expand All @@ -86,15 +112,13 @@ All notable changes to this project will be documented in this file.
- Added TinyUFO sharded skip list storage option

### 🐛 Bug Fixes

- Fixed build failures with the `boringssl` feature
- Fixed compile warnings with nightly Rust
- Fixed an issue where Upgrade request bodies might not be handled correctly
- Fix compilation to only include openssl or boringssl rather than both
- Fix OS read errors so they are reported as `ReadError` rather than `ReadTimeout` when reading http/1.1 response headers

### ⚙️ Miscellaneous Tasks

- Performance improvements in `bongonet-ketama`
- Added more TinyUFO benchmarks
- Added tests for `bongonet-cache` purge
Expand All @@ -103,7 +127,5 @@ All notable changes to this project will be documented in this file.
- Typo fixes and clarifications across comments and docs

## [0.1.0] - 2024-02-28

### Highlights

- First Public Release of Bongonet 🎉
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ members = [
"bongonet-openssl",
"bongonet-boringssl",
"bongonet-runtime",
"bongonet-rustls",
"bongonet-ketama",
"bongonet-load-balancing",
"bongonet-memory-cache",
Expand All @@ -28,7 +29,7 @@ httparse = "1"
bytes = "1.0"
http = "1.0.0"
log = "0.4"
h2 = ">=0.4.4"
h2 = ">=0.4.6"
once_cell = "1"
lru = "0"
ahash = ">=0.8.9"
Expand Down
66 changes: 28 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
# Bongonet

## What is Bongonet

Bongonet is a Rust framework to [build fast, reliable and programmable networked systems](https://blog.khulnasoft.com/bongonet-open-source).

Bongonet is battle tested as it has been serving more than 40 million Internet requests per second for [more than a few years](https://blog.khulnasoft.com/how-we-built-bongonet-the-proxy-that-connects-khulnasoft-to-the-internet).

## Feature highlights

- Async Rust: fast and reliable
- HTTP 1/2 end to end proxy
- TLS over OpenSSL or BoringSSL
- gRPC and websocket proxying
- Graceful reload
- Customizable load balancing and failover strategies
- Support for a variety of observability tools
* Async Rust: fast and reliable
* HTTP 1/2 end to end proxy
* TLS over OpenSSL, BoringSSL or rustls(experimental).
* gRPC and websocket proxying
* Graceful reload
* Customizable load balancing and failover strategies
* Support for a variety of observability tools

## Reasons to use Bongonet

- **Security** is your top priority: Bongonet is a more memory safe alternative for services that are written in C/C++
- Your service is **performance-sensitive**: Bongonet is fast and efficient
- Your service requires extensive **customization**: The APIs Bongonet proxy framework provides are highly programmable
* **Security** is your top priority: Bongonet is a more memory safe alternative for services that are written in C/C++
* Your service is **performance-sensitive**: Bongonet is fast and efficient
* Your service requires extensive **customization**: The APIs Bongonet proxy framework provides are highly programmable

# Getting started

Expand All @@ -31,28 +23,28 @@ Our [user guide](./docs/user_guide/index.md) covers more topics such as how to c
API docs are also available for all the crates.

# Notable crates in this workspace

- Bongonet: the "public facing" crate to build networked systems and proxies
- Bongonet-core: this crate defines the protocols, functionalities and basic traits
- Bongonet-proxy: the logic and APIs to build HTTP proxies
- Bongonet-error: the common error type used across Bongonet crates
- Bongonet-http: the HTTP header definitions and APIs
- Bongonet-openssl & bongonet-boringssl: SSL related extensions and APIs
- Bongonet-ketama: the [Ketama](https://github.com/RJ/ketama) consistent algorithm
- Bongonet-limits: efficient counting algorithms
- Bongonet-load-balancing: load balancing algorithm extensions for bongonet-proxy
- Bongonet-memory-cache: Async in-memory caching with cache lock to prevent cache stampede
- Bongonet-timeout: A more efficient async timer system
- TinyUfo: The caching algorithm behind bongonet-memory-cache
* Bongonet: the "public facing" crate to build networked systems and proxies
* Bongonet-core: this crate defines the protocols, functionalities and basic traits
* Bongonet-proxy: the logic and APIs to build HTTP proxies
* Bongonet-error: the common error type used across Bongonet crates
* Bongonet-http: the HTTP header definitions and APIs
* Bongonet-openssl & bongonet-boringssl: SSL related extensions and APIs
* Bongonet-ketama: the [Ketama](https://github.com/RJ/ketama) consistent algorithm
* Bongonet-limits: efficient counting algorithms
* Bongonet-load-balancing: load balancing algorithm extensions for bongonet-proxy
* Bongonet-memory-cache: Async in-memory caching with cache lock to prevent cache stampede
* Bongonet-timeout: A more efficient async timer system
* TinyUfo: The caching algorithm behind bongonet-memory-cache

# System requirements

## Systems

Linux is our tier 1 environment and main focus.

We will try our best for most code to compile for Unix environments. This is for developers and users to have an easier time developing with Bongonet in Unix-like environments like macOS (though some features might be missing)

Windows support is preliminary by community's best effort only.

Both x86_64 and aarch64 architectures will be supported.

## Rust version
Expand All @@ -66,16 +58,14 @@ Our current MSRV is 1.72.
Some of the crates in this repository have dependencies on additional tools and
libraries that must be satisfied in order to build them:

- Make sure that [Clang] is installed on your system (for boringssl)
- Make sure that [Perl 5] is installed on your system (for openssl)
* Make sure that [Clang] is installed on your system (for boringssl)
* Make sure that [Perl 5] is installed on your system (for openssl)

[Clang]: https://clang.llvm.org/
[Perl 5]: https://www.perl.org/
[Clang]:https://clang.llvm.org/
[Perl 5]:https://www.perl.org/

# Contributing

Please see our [contribution guidelines](./.github/CONTRIBUTING.md).

# License

This project is Licensed under [Apache License, Version 2.0](./LICENSE).
4 changes: 2 additions & 2 deletions bongonet-boringssl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bongonet-boringssl"
version = "0.3.0"
authors = ["Yuchen Wu <yuchen@khulnasoft.com>"]
version = "0.4.0"
authors = ["Md Sulaiman <dev.sulaiman@icloud.com>"]
license = "Apache-2.0"
edition = "2021"
repository = "https://github.com/khulnasoft/bongonet"
Expand Down
19 changes: 10 additions & 9 deletions bongonet-cache/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bongonet-cache"
version = "0.3.0"
authors = ["Yuchen Wu <yuchen@khulnasoft.com>"]
version = "0.4.0"
authors = ["Md Sulaiman <dev.sulaiman@icloud.com>"]
license = "Apache-2.0"
edition = "2021"
repository = "https://github.com/khulnasoft/bongonet"
Expand All @@ -17,12 +17,12 @@ name = "bongonet_cache"
path = "src/lib.rs"

[dependencies]
bongonet-core = { version = "0.3.0", path = "../bongonet-core", default-features = false }
bongonet-error = { version = "0.3.0", path = "../bongonet-error" }
bongonet-header-serde = { version = "0.3.0", path = "../bongonet-header-serde" }
bongonet-http = { version = "0.3.0", path = "../bongonet-http" }
bongonet-lru = { version = "0.3.0", path = "../bongonet-lru" }
bongonet-timeout = { version = "0.3.0", path = "../bongonet-timeout" }
bongonet-core = { version = "0.4.0", path = "../bongonet-core", default-features = false }
bongonet-error = { version = "0.4.0", path = "../bongonet-error" }
bongonet-header-serde = { version = "0.4.0", path = "../bongonet-header-serde" }
bongonet-http = { version = "0.4.0", path = "../bongonet-http" }
bongonet-lru = { version = "0.4.0", path = "../bongonet-lru" }
bongonet-timeout = { version = "0.4.0", path = "../bongonet-timeout" }
http = { workspace = true }
indexmap = "1"
once_cell = { workspace = true }
Expand Down Expand Up @@ -65,6 +65,7 @@ name = "lru_serde"
harness = false

[features]
default = ["openssl"]
default = []
openssl = ["bongonet-core/openssl"]
boringssl = ["bongonet-core/boringssl"]
rustls = ["bongonet-core/rustls"]
6 changes: 3 additions & 3 deletions bongonet-cache/src/cache_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
use super::*;

use bongonet_error::{Error, ErrorType};
use http::header::HeaderName;
use http::HeaderValue;
use indexmap::IndexMap;
use once_cell::sync::Lazy;
use bongonet_error::{Error, ErrorType};
use regex::bytes::Regex;
use std::num::IntErrorKind;
use std::slice;
Expand Down Expand Up @@ -51,8 +51,8 @@ impl DirectiveValue {
/// A [DirectiveValue] without quotes (`"`).
pub fn parse_as_bytes(&self) -> &[u8] {
self.0
.strip_prefix(&[b'"'])
.and_then(|bytes| bytes.strip_suffix(&[b'"']))
.strip_prefix(b"\"")
.and_then(|bytes| bytes.strip_suffix(b"\""))
.unwrap_or(&self.0[..])
}

Expand Down
Loading

0 comments on commit 01599f8

Please sign in to comment.