-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add documentation for Expressions #76
base: main
Are you sure you want to change the base?
Conversation
36f2faa
to
a4fdf39
Compare
Adds impls of Default for several expr types. Adds doc comments throughout expr module. BREAKING CHANGE: Adds SocketAttr enum type for Socket key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from a few nits: LGTM! :)
Verdict(Verdict<'a>), | ||
} | ||
|
||
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] | ||
#[serde(rename_all = "lowercase")] | ||
/// Wrapper for non-immediate `Expression`s. | ||
/// Wrapper for non-immediate [Expressions](Expression). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this should be lowercase, for the sake of consistency?
/// Wrapper for non-immediate [Expressions](Expression). | |
/// Wrapper for non-immediate [expressions](Expression). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Also I noticed that rustdoc triggers a warning for redundant labels (e.g. [Flag](Flag)
)
Fib(Fib), | ||
/// Explicitly set element object, in case `timeout`, `expires` or `comment` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Explicitly set element object, in case `timeout`, `expires` or `comment` | |
/// Explicitly set element object, in case `timeout`, `expires`, or `comment` |
Elem(Elem<'a>), | ||
/// Construct a reference to packet’s socket. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Construct a reference to packet’s socket. | |
/// Construct a reference to a packet’s socket. |
pub addr: Box<Expression<'a>>, | ||
/// A prefix length. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// A prefix length. | |
/// The prefix length. |
Socket(Socket<'a>), | ||
/// Perform OS fingerprinting. | ||
/// This expression is typically used in the LHS of a [match](crate::stmt::Match) statement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the second sentence/explanation should be separated by an empty line.
/// This expression is typically used in the LHS of a [match](crate::stmt::Match) statement. | |
/// | |
/// This expression is typically used in the LHS of a [match](crate::stmt::Match) statement. |
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Serialize, Deserialize)] | ||
#[serde(rename_all = "lowercase")] | ||
/// Represents a `meta` key for packet meta data. | ||
/// | ||
/// See also: <https://wiki.nftables.org/wiki-nftables/index.php/Matching_packet_metainformation> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// See also: <https://wiki.nftables.org/wiki-nftables/index.php/Matching_packet_metainformation> | |
/// See [this page](https://wiki.nftables.org/wiki-nftables/index.php/Matching_packet_metainformation) | |
for more information. |
Oifkind, | ||
/// Output interface group. | ||
Oifgroup, | ||
/// Input bridge interface name. | ||
Ibridgename, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, should these rather be sorted alphabetically?
@@ -11,7 +11,7 @@ | |||
/// Contains Batch object to be used to prepare Nftables payloads. | |||
pub mod batch; | |||
|
|||
/// Contains Expressions. | |||
/// Contains [Expressions](crate::expr::Expression). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Contains [Expressions](crate::expr::Expression). | |
/// Contains [expressions](crate::expr::Expression). |
Transparent, | ||
/// Match on the socket mark (`SOL_SOCKET`, `SO_MARK`). | ||
Mark, | ||
/// Indicates whether the socket is wildcard-bound (e.g. 0.0.0.0 or ::0). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ::
does not need a 0 suffix, right?
/// Indicates whether the socket is wildcard-bound (e.g. 0.0.0.0 or ::0). | |
/// Indicates whether the socket is wildcard-bound (e.g. 0.0.0.0 or ::). |
/// Similar to jump, but the current position is not pushed to the call | ||
/// stack, meaning that after the new chain evaluation will continue at the | ||
/// last chain instead of the one containing the goto statement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Similar to jump, but the current position is not pushed to the call | |
/// stack, meaning that after the new chain evaluation will continue at the | |
/// last chain instead of the one containing the goto statement. | |
/// Similar to jump, but the current position is not pushed to the call | |
/// stack. | |
/// | |
/// That means that after the new chain evaluation will continue at the | |
/// last chain instead of the one containing the goto statement. |
This is a major improvement to the
expr
module:Default
impls for all structs inexpr
key
.