make port ranges inclusive

This commit is contained in:
soruh 2023-02-18 21:20:59 +01:00
parent 9b20920400
commit 39d8bac7df

View File

@ -4,7 +4,7 @@ use std::{
fmt::{Debug, Display}, fmt::{Debug, Display},
fs::File, fs::File,
io::{BufReader, BufWriter}, io::{BufReader, BufWriter},
ops::Range, ops::RangeInclusive,
path::Path, path::Path,
sync::Arc, sync::Arc,
time::{Duration, SystemTime, UNIX_EPOCH}, time::{Duration, SystemTime, UNIX_EPOCH},
@ -177,7 +177,7 @@ impl Default for PortStatus {
} }
#[derive(Default, Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] #[derive(Default, Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
pub struct AllowedPorts(Vec<Range<u16>>); pub struct AllowedPorts(Vec<RangeInclusive<u16>>);
impl AllowedPorts { impl AllowedPorts {
pub fn is_allowed(&self, port: Port) -> bool { pub fn is_allowed(&self, port: Port) -> bool {