pub struct Rule {
pub direction: Direction,
pub destination: Destination,
pub protocols: Vec<Protocol>,
pub ports: Vec<PortRange>,
pub action: Action,
}Expand description
A single network rule.
The destination field is direction-dependent: in an egress-direction
rule, destination is what the guest is reaching; in an ingress-
direction rule, destination is the source (peer) of the incoming
connection. Both-direction rules apply in either path with the
destination interpreted appropriately for each.
Fields§
§direction: DirectionDirection this rule applies to: outbound, inbound, or either.
destination: DestinationDestination filter. Direction-dependent interpretation.
protocols: Vec<Protocol>Protocol set (empty = any protocol). The rule matches if the packet’s protocol is in this set.
ports: Vec<PortRange>Port-range set (empty = any port). Always the guest-side port: destination port for egress, listening port for ingress.
action: ActionAction to take.
Implementations§
Source§impl Rule
impl Rule
Sourcepub fn allow_egress(destination: Destination) -> Self
pub fn allow_egress(destination: Destination) -> Self
Convenience: allow rule for egress, any protocol, any port.
Sourcepub fn deny_egress(destination: Destination) -> Self
pub fn deny_egress(destination: Destination) -> Self
Convenience: deny rule for egress, any protocol, any port.
Sourcepub fn allow_ingress(destination: Destination) -> Self
pub fn allow_ingress(destination: Destination) -> Self
Convenience: allow rule for ingress, any protocol, any port.
Sourcepub fn deny_ingress(destination: Destination) -> Self
pub fn deny_ingress(destination: Destination) -> Self
Convenience: deny rule for ingress, any protocol, any port.
Sourcepub fn allow_any(destination: Destination) -> Self
pub fn allow_any(destination: Destination) -> Self
Convenience: allow rule for either direction, any protocol, any port.
Sourcepub fn deny_any(destination: Destination) -> Self
pub fn deny_any(destination: Destination) -> Self
Convenience: deny rule for either direction, any protocol, any port.