-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add send_device_info #181
Add send_device_info #181
Conversation
src/main.rs
Outdated
Ok(None) => String::from("No MAC address found."), | ||
Err(_) => String::from("No MAC address found."), |
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.
nits
Ok(None) => String::from("No MAC address found."), | |
Err(_) => String::from("No MAC address found."), | |
_ => String::from("No MAC address found."), |
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.
Fixed, Thanks!
c0b716c
src/main.rs
Outdated
const OS: &str = env::consts::OS; | ||
let mac_address: String = match get_mac_address() { | ||
Ok(Some(ma)) => ma.to_string(), | ||
Ok(None) => String::from("No MAC address found."), |
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.
IMO
This code If no mac address registered, the above message is inserted into the Hub instead.
But, I think that if Agent has no mac address, Agent can't connect to Hub.
So I think if Agent can't find the MAC address, we should shutdown the Agent
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 think the mac address is additional information since it is used for the log display screen. It is not a required field, so it is better to be able to communicate even if it cannot be obtained.
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.
It is not a required field, so it is better to be able to communicate even if it cannot be obtained.
I think so too. But, I think that the device that has no MAC address can't connect to the Hub over IP.
Are there situations where the device can communicate via IP in the absence of a MAC address?
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 think there would be no communication with devices that do not have a MAC address.
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 think there would be no communication with devices that do not have a MAC address.
I think so too.
So, I think the message, "No MAC address found." can't be sent to Hub.
async fn send_device_info(did: String) { | ||
const VERSION: &str = env!("CARGO_PKG_VERSION"); | ||
const OS: &str = env::consts::OS; | ||
let mac_address: String = match get_mac_address() { |
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.
MUST
Following this code, get_mac_address()
returns the first MAC address.
https://github.com/repnop/mac_address/blob/master/src/lib.rs#L107C5-L107C5
So if the machine has multiple NICs, it may return a different address that doesn't connect to the Hub.
Is this the desired behavior?
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.
Certainly getting the first one with the OS command when there are multiple NICs is a problem, but is there any other better way?
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 have no simple solution, but, there may be some solutions like the following page.
https://qiita.com/saiton03/items/e23b308cc2b8e4ebd66d
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.
What happens if I have one domain and multiple IP addresses?
Maybe this time, the purpose is not to know which network interface was used to make the connection, but to get the mac address to identify the terminal, so I think it is OK as long as it is unique.
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.
What happens if I have one domain and multiple IP addresses?
DNS will return one IP address randomly. This occurs, for example, with DNS round robin.
If the device has multiple NICs, and the server uses DNS round-robin, the MAC address may switched randomly.
Maybe this time, the purpose is not to know which network interface was used to make the connection, but to get the mac address to identify the terminal, so I think it is OK as long as it is unique.
OK, I understood.
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 left some comments, but I think that it will be a major issue.
LGTM
Send device info to hub