Skip to content

Commit

Permalink
fix: block system reserved ports
Browse files Browse the repository at this point in the history
  • Loading branch information
Roardom committed Jul 1, 2024
1 parent a75d759 commit a3e8e97
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/tracker/blacklisted_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub struct Set(IndexSet<u16>);
impl Default for Set {
#[rustfmt::skip]
fn default() -> Set {
Set(IndexSet::from([
let mut set = IndexSet::from([
// SSH Port
22,
// DNS queries
Expand All @@ -34,7 +34,14 @@ impl Default for Set {
6347,
// Port used by p2p software, such as WinMX, Napster.
6699,
]))
]);

// Block system-reserved ports since 99.9% of the time they're fake and thus not connectable
for system_reserved_port in 0..1024 {
set.insert(system_reserved_port);
}

Set(set)
}
}

Expand Down

0 comments on commit a3e8e97

Please sign in to comment.