mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-10 18:38:22 +00:00
Make TCP/UDP Port Single/Range an Enum
This commit is contained in:
parent
94f580996c
commit
0d5505597d
1 changed files with 11 additions and 8 deletions
|
@ -34,16 +34,12 @@ pub struct Service {
|
|||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ServiceType {
|
||||
TCP {
|
||||
source_port: u64,
|
||||
source_port_end: Option<u64>,
|
||||
destination_port: u64,
|
||||
destination_port_end: Option<u64>,
|
||||
source: PortDefinition,
|
||||
destination: PortDefinition,
|
||||
},
|
||||
UDP {
|
||||
source_port: u64,
|
||||
source_port_end: Option<u64>,
|
||||
destination_port: u64,
|
||||
destination_port_end: Option<u64>,
|
||||
source: PortDefinition,
|
||||
destination: PortDefinition,
|
||||
},
|
||||
ICMP {
|
||||
code: u8,
|
||||
|
@ -52,3 +48,10 @@ pub enum ServiceType {
|
|||
children: Vec<String>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum PortDefinition {
|
||||
Single { port: u64 },
|
||||
Range { start_port: u64, end_port: u64 },
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue