Skip to content

feat(sys): import types from other -sys crates #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 92 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ lock_api = "0.4.13"
nginx-sys = { path = "nginx-sys", default-features=false, version = "0.5.0"}
pin-project-lite = { version = "0.2.16", optional = true }

[workspace.dependencies]
libc = { version = "0.2.174", default-features = false }

[features]
default = ["std"]
async = [
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ chrono = "0.4.23"
http = "1.1.0"
# use unicode-rs idna backend for lower MSRV and faster builds
idna_adapter = "=1.1.0"
libc = "0.2.140"
libc.workspace = true
tokio = { version = "1.33.0", features = ["full"] }

[[example]]
Expand Down
5 changes: 3 additions & 2 deletions examples/httporigdst.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
use std::ffi::{c_int, c_void};
use std::ptr::addr_of;

use libc::sockaddr_storage;
use ngx::core;
use ngx::ffi::{
in_port_t, ngx_conf_t, ngx_connection_local_sockaddr, ngx_http_add_variable, ngx_http_module_t,
ngx_http_variable_t, ngx_inet_get_port, ngx_int_t, ngx_module_t, ngx_sock_ntop, ngx_str_t,
ngx_variable_value_t, sockaddr, sockaddr_storage, INET_ADDRSTRLEN, NGX_HTTP_MODULE,
ngx_variable_value_t, sockaddr, NGX_HTTP_MODULE,
};
use ngx::http::{self, HttpModule};
use ngx::{http_variable_get, ngx_log_debug_http, ngx_string};

const IPV4_STRLEN: usize = INET_ADDRSTRLEN as usize;
const IPV4_STRLEN: usize = 16; // Not exported from `libc`

#[derive(Debug, Default)]
struct NgxHttpOrigDstCtx {
Expand Down
11 changes: 11 additions & 0 deletions nginx-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,27 @@ default-target = "x86_64-unknown-linux-gnu"
targets = []

[dependencies]
libc = { optional = true, workspace = true }
openssl-sys = { version = "0.9.109", optional = true }
pcre2-sys = { version = "0.2.9", optional = true }

[target.'cfg(not(windows))'.dependencies]
errno = { version = "0.3", default-features = false }

[build-dependencies]
bindgen = "0.71"
bitflags = "2.9.1"
cc = "1.2.0"
dunce = "1.0.5"
regex = "1.11.1"
nginx-src = { version = "~1.28.0", optional = true, path = "../nginx-src" }

[features]
# Reexport types from "libc" instead of generating our own bindings.
libc = ["dep:libc"]
# Reexport types from "openssl-sys" instead of generating our own bindings.
# Note that openssl-sys depends on "std".
openssl-sys = ["dep:openssl-sys"]
# Reexport types from "pcre2-sys" instead of generating our own bindings.
pcre2-sys = ["dep:pcre2-sys"]
vendored = ["dep:nginx-src"]
Loading
Loading