-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fingerprint: config parameter for interface and native method for IP address #189
Conversation
…ing. Added a Golang-native method for determining the interface IP address.
// ipAddress returns the first IPv4 address on the configured default interface | ||
// Tries Golang native functions and falls back onto ifconfig | ||
func (f *NetworkFingerprint) ipAddress(device string) string { | ||
if ip, err := f.nativeIpAddress(device); err == nil { |
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.
shouldn't that be err != nil
?
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.
Well, no, that function should return the IP if there was no error, so if err == nil
. Look at the if body.
If err is different than nil
, its execution continues, and we would try the ifconfig method.
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.
ah, I see. Thanks.
@@ -31,6 +31,9 @@ type Config struct { | |||
// Region is the clients region | |||
Region string | |||
|
|||
// Network interface to be used in network fingerprinting | |||
Iface 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.
Lets change Iface to "NetworkInterface" for long term clarity both in code and docs. After that lets merge! Thanks
Fingerprint: config parameter for interface and native method for IP address
Added an in-mem snapshot store
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
This PR tries to respond to #170 and #158.
I added a configuration directive to the client conf file to set the network interface used for fingerprinting.
It also adds a second method for retrieving the IP address of this network card (before we try ifconfig) using net.Interfaces(). This is not perfect yet since I totally ignore IPv6 addresses, but it's a base to develop from.