-
Notifications
You must be signed in to change notification settings - Fork 9
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
Added "vendor" to host response #13
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I've left some quick comments.
tests/test.xml
Outdated
@@ -7,7 +7,7 @@ | |||
<verbose level="0"/> | |||
<debugging level="0"/> | |||
<host starttime="1588318812" endtime="1588318814"><status state="up" reason="echo-reply" reason_ttl="53"/> | |||
<address addr="45.33.32.156" addrtype="ipv4"/> | |||
<address addr="45.33.32.156" addrtype="ipv4" vendor="VMware"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very clearly wrong as addrtype="ipv4"
. tests/issue_1.xml
has a valid example of a addrtype="mac"
.
src/host.rs
Outdated
@@ -97,8 +97,15 @@ fn parse_address_node(node: Node) -> Result<Address, Error> { | |||
.attribute("addr") | |||
.ok_or_else(|| Error::from("expected `addr` attribute in `address` node"))?; | |||
|
|||
let vendor = node | |||
.attribute("vendor") | |||
.unwrap_or_default(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this approach. If the vendor
field is always present, we should just use .expect()
here with the expectation that it should never fail. If the vendor
field is option, it should be an Option<String>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, Option<String>
is the perfect type for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case,
Option<String>
is the perfect type for that.
Ok thanks, i'll try to fix it.. :)
Thanks for reply!!!!! :) |
Hi, I needed to read the network card vendor of the devices contacted, I saw that you didn't add it in your code, I did it.. it's my first PR, let me know..
Thank you!!
Riccardo