-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
74 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,64 @@ | ||
//! [![github]](https://github.com/rusty-bolt/conntrack-rs) | ||
//! | ||
//! | ||
//! [github]: https://img.shields.io/badge/github-rusty--bolt/conntrack--rs-blueviolet?style=for-the-badge&labelColor=555555&logo=github | ||
//! | ||
//! | ||
//! --- | ||
//! | ||
//! This library provides access to the [`conntrack`](https://conntrack-tools.netfilter.org/conntrack.html) | ||
//! subsystem in the linux kernel leveraging netlink support via the [`neli`](https://docs.rs/neli/latest/neli/index.html) | ||
//! library. | ||
//! | ||
//! The current version only supplies `Dump()` functionality for the `Conntrack` table. Leveraging the | ||
//! [`conntrack-tools`](https://conntrack-tools.netfilter.org/) utility in linux, the `Dump()` behavior | ||
//! is equivalent to: `conntrack -L`. Most of the model and attribute parsing supported in this library | ||
//! This library provides access to the [`conntrack`](https://conntrack-tools.netfilter.org/conntrack.html) | ||
//! subsystem in the linux kernel leveraging netlink support via the [`neli`](https://docs.rs/neli/latest/neli/index.html) | ||
//! library. | ||
//! | ||
//! The current version only supplies `Dump()` functionality for the `Conntrack` table. Leveraging the | ||
//! [`conntrack-tools`](https://conntrack-tools.netfilter.org/) utility in linux, the `Dump()` behavior | ||
//! is equivalent to: `conntrack -L`. Most of the model and attribute parsing supported in this library | ||
//! extends beyond the `dump()` command, which allows this library to eventually cover the full feature set | ||
//! of the conntrack subsystem. | ||
//! | ||
//! of the conntrack subsystem. | ||
//! | ||
//! You can enable byte and packet counters using `sysctl -w net.netfilter.nf_conntrack_acct=1` | ||
//! | ||
//! | ||
//! # Privileges | ||
//! | ||
//! You need the `CAP_NET_ADMIN` capability in order to allow your application to receive events from and to send commands to kernel-space, | ||
//! | ||
//! You need the `CAP_NET_ADMIN` capability in order to allow your application to receive events from and to send commands to kernel-space, | ||
//! excepting the conntrack table dumping operation. | ||
//! | ||
//! | ||
//! ### WSL2 Conntrack | ||
//! | ||
//! | ||
//! Note that in order to enable connection tracking via `conntrack` on WSL2, you'll need to add the following iptable entry: | ||
//! ```bash | ||
//! iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT | ||
//! ``` | ||
//! | ||
//! | ||
//! # Example | ||
//! | ||
//! ```rust | ||
//! use conntrack::*; | ||
//! | ||
//! | ||
//! fn main() -> Result<()> { | ||
//! // Create the Conntrack table via netfilter socket syscall | ||
//! let mut ct = Conntrack::connect()?; | ||
//! | ||
//! | ||
//! // Dump conntrack table as a Vec<Flow> | ||
//! let flows = ct.dump()?; | ||
//! | ||
//! | ||
//! for flow in flows { | ||
//! log::info!("{flow:?}"); | ||
//! } | ||
//! | ||
//! | ||
//! Ok(()) | ||
//! } | ||
//! ``` | ||
//! | ||
//! <br> | ||
|
||
|
||
pub use crate::connection::*; | ||
pub use crate::result::*; | ||
pub use crate::error::*; | ||
pub use crate::result::*; | ||
|
||
pub mod attributes; | ||
pub mod decoders; | ||
pub mod message; | ||
pub mod model; | ||
pub mod decoders; | ||
|
||
mod result; | ||
mod connection; | ||
mod error; | ||
mod error; | ||
mod result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pub use crate::error::Error; | ||
|
||
/// Result is an alias for `core::result::Result<T, conntrack::error::Error>` | ||
pub type Result<T> = core::result::Result<T, Error>; | ||
pub type Result<T> = core::result::Result<T, Error>; |