Skip to content

Commit 9e983f7

Browse files
committed
style: some style changes
1 parent d0fcb76 commit 9e983f7

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/database/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::net::Ipv4Addr;
12
use std::time::{SystemTime, UNIX_EPOCH};
23
use serde::{Deserialize, Serialize};
34
use url::Url;
@@ -100,15 +101,15 @@ pub fn parse_to_url(host: &str, port: u16, user: &str, password: Option<&str>, d
100101
Ok(url)
101102
}
102103

103-
pub fn parse_server(ip: String, port: u16, ping: Ping, query: Option<Query>, join: Option<Join>) -> (ServerInfo, ServerHistory) {
104+
pub fn parse_server(ip: Ipv4Addr, port: u16, ping: Ping, query: Option<Query>, join: Option<Join>) -> (ServerInfo, ServerHistory) {
104105
let now = SystemTime::now()
105106
.duration_since(UNIX_EPOCH)
106107
.unwrap_or_default()
107108
.as_secs() as i64;
108109

109110
let info = ServerInfo {
110111
server_id: None,
111-
server_ip: ip,
112+
server_ip: ip.to_string(),
112113
server_port: port,
113114
last_seen: now,
114115
discovered: now,

src/randomizer.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub enum IpType {
1111
PrivateOnly,
1212
}
1313

14+
#[derive(Clone, Copy)]
1415
pub struct IpGenerator {
1516
network_u32: u32,
1617
range_size: u32,
@@ -77,11 +78,11 @@ impl IpGenerator {
7778
}
7879
}
7980

80-
#[derive(Default)]
81+
#[derive(Default, Copy, Clone)]
8182
pub struct IpGeneratorBuilder {
8283
network: Option<Ipv4Addr>,
8384
prefix_len: Option<u8>,
84-
count: u32,
85+
amount: u32,
8586
ip_type: IpType,
8687
}
8788

@@ -92,8 +93,8 @@ impl IpGeneratorBuilder {
9293
self
9394
}
9495

95-
pub fn count(mut self, count: u32) -> Self {
96-
self.count = count;
96+
pub fn amount(mut self, amount: u32) -> Self {
97+
self.amount = amount;
9798
self
9899
}
99100

@@ -114,7 +115,7 @@ impl IpGeneratorBuilder {
114115
IpGenerator {
115116
network_u32,
116117
range_size,
117-
count: self.count,
118+
count: self.amount,
118119
ip_type: self.ip_type,
119120
use_cidr,
120121
}

src/scanning/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pub mod scanner;
22
pub mod file_scanner;
3-
pub mod utils;
3+
pub mod utils;
4+
pub mod crawler;

0 commit comments

Comments
 (0)