Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dgw) : network scan ip v4 broadcasting #636

Closed
wants to merge 8 commits into from

Conversation

irvingoujAtDevolution
Copy link
Contributor

Supporting network scan ipv4 boardcasting, this is a draft, waiting for #635 to be merged first

@CBenoit CBenoit changed the base branch from master to Network-Scan-Refractor-1 January 11, 2024 08:13
Copy link
Member

@CBenoit CBenoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review. The diff also contains changes from the other PR so it’s a bit harder. I’ll wait for you to fix conflicts etc.
General comment: try to run typos

crates/network-scanner/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: This example does use any API of any of our crate so we can remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this was meant to keep as a draft, not really ready for review yet, I was waiting for the other PR to be merged so I can rebase and clean up the code on this branch. Still, thanks for your review, I will fix them.

crates/network-scanner-net/examples/send_all.rs Outdated Show resolved Hide resolved
crates/network-scanner-net/Cargo.toml Outdated Show resolved Hide resolved
Some(e) => match e.kind() {
std::io::ErrorKind::TimedOut => {
tracing::info!("Timed out");
exit(0);
Copy link
Member

@CBenoit CBenoit Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: exit(0) is not running any destructor and is generally not necessary.

Note that because this function never returns, and that it terminates the process, no destructors on the current stack or any other thread’s stack will be run. If a clean shutdown is needed it is recommended to only call this function at a known point where there are no more destructors left to run; or, preferably, simply return a type implementing Termination (such as ExitCode or Result) from the main function and avoid this function altogether

suggestion: Use return Ok(()) if you want to exit with a success status code. Alternatively, you used break at the other places, which have the same behavior. Yet another alternative is to just return the error instead of handling it this way. I don’t really see any special logic happening other than breaking out of the loop and return Ok(()) anyway. Maybe you didn’t mean to break the loop at the other places? (In order to continue processing of the remaining results.)

As an aside, a timeout can probably be considered as an error too. (Err instead of Ok.)

crates/network-scanner/examples/boardcast.rs Outdated Show resolved Hide resolved
tokio = { version = "1.35.1", features = ["io-util"] }
tokio-stream = "0.1.14"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: I don’t see any utility provided by this crate used in the new code. Am I missing something?

suggestion: Use futures-core instead.

@@ -8,9 +8,12 @@ publish = false

[dependencies]
anyhow = "1.0.79"
get_if_addrs = "0.5.3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: This crate is unmaintained since 2019 (the repository has been archived).

question: Did you consider this? https://lib.rs/crates/if-addrs
This is maintained fork.

Base automatically changed from Network-Scan-Refractor-1 to master January 12, 2024 05:37
@irvingoujAtDevolution
Copy link
Contributor Author

Not Ready for Review!

@irvingoujAtDevolution irvingoujAtDevolution changed the title feat(dgw) : network scan ip v4 boardcasting feat(dgw) : network scan ip v4 broaddcasting Jan 24, 2024
@irvingoujAtDevolution irvingoujAtDevolution changed the title feat(dgw) : network scan ip v4 broaddcasting feat(dgw) : network scan ip v4 broadcasting Jan 24, 2024
@irvingoujAtDevolution irvingoujAtDevolution marked this pull request as ready for review January 24, 2024 19:46
@irvingoujAtDevolution
Copy link
Contributor Author

Blocked By #665

@CBenoit CBenoit marked this pull request as draft January 30, 2024 07:47
@CBenoit
Copy link
Member

CBenoit commented Jan 30, 2024

Converted to draft until #665 is merged

@CBenoit CBenoit changed the base branch from master to Network-Scan-Refractor-3 January 30, 2024 07:48
Base automatically changed from Network-Scan-Refractor-3 to master February 1, 2024 14:03
@CBenoit
Copy link
Member

CBenoit commented Feb 2, 2024

@irvingoujAtDevolution Can you rebase on top of master? I recommend you to squash your commits before doing so, to avoid conflict hell.

@CBenoit CBenoit deleted the Network-Scan-Boardcast branch March 15, 2024 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants