The NGINX project has published a toolkit for developing modules in the Rust language

The developers of the NGINX project presented the ngx-rust toolkit, which allows you to create modules for the NGINX http server and multi-protocol proxy in the Rust programming language. The ngx-rust code is distributed under the Apache 2.0 license and is currently in beta.

Initially, the toolkit was developed as a project to accelerate the development of an Istio-compatible Service mesh for the Kubernetes platform running on top of NGINX. The product never went beyond prototype and stagnated for several years, but the example bindings published during the prototype process were used by the community in third-party projects to extend the capabilities of NGINX in Rust.

After some time, the F5 company needed to write a specialized module for NGINX to protect its services, in which it wanted to use the Rust language to reduce the risk of errors when working with memory. To solve the problem, the author of ngx-rust was brought in, who was tasked with developing new and improved tools for creating modules for NGINX in the Rust language.

The toolkit includes two crate packages:

  • nginx-sys - Binding generator based on NGINX source code. The utility loads the NGINX code and all its associated dependencies, and then uses bindgen to create bindings over the original functions (FFI, foreign function interface).
  • ngx - a layer for accessing C functions from Rust code, an API and a system for re-exporting bindings created using nginx-sys.

Source: opennet.ru

Add a comment