remove unnecessary loop/allocations on CIDR range init
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
27bfb67d75
commit
60605e9579
1 changed files with 9 additions and 6 deletions
|
@ -76,12 +76,15 @@ impl crate::Service for Service {
|
||||||
// Experimental, partially supported room versions
|
// Experimental, partially supported room versions
|
||||||
let unstable_room_versions = vec![RoomVersionId::V2, RoomVersionId::V3, RoomVersionId::V4, RoomVersionId::V5];
|
let unstable_room_versions = vec![RoomVersionId::V2, RoomVersionId::V3, RoomVersionId::V4, RoomVersionId::V5];
|
||||||
|
|
||||||
let mut cidr_range_denylist = Vec::new();
|
let cidr_range_denylist: Vec<_> = config
|
||||||
for cidr in config.ip_range_denylist.clone() {
|
.ip_range_denylist
|
||||||
|
.iter()
|
||||||
|
.map(|cidr| {
|
||||||
let cidr = IPAddress::parse(cidr).expect("valid cidr range");
|
let cidr = IPAddress::parse(cidr).expect("valid cidr range");
|
||||||
trace!("Denied CIDR range: {:?}", cidr);
|
trace!("Denied CIDR range: {:?}", cidr);
|
||||||
cidr_range_denylist.push(cidr);
|
cidr
|
||||||
}
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
let mut s = Self {
|
let mut s = Self {
|
||||||
db,
|
db,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue