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

The device cannot be found when multiple IP addresses are configured for the network link #355

Closed
Martin-CF opened this issue Nov 5, 2022 · 2 comments · Fixed by #370
Closed
Assignees

Comments

@Martin-CF
Copy link

The device can be found normally by configuring a single IP for my network link. When multiple IP addresses are configured, the device cannot be found. How to solve this problem? Thank you for your help。

@JKRhb JKRhb self-assigned this Nov 5, 2022
@htool
Copy link
Contributor

htool commented Jun 4, 2023

I ran into the same problem.

the function allAddresses should not include network aliases. They can be identied by the mac address:

function allAddresses(type) {
var _a;
let family = 'IPv4';
if (type === 'udp6') {
family = 'IPv6';
}
var macs = []
const addresses = [];
const interfaces = os_1.default.networkInterfaces();
for (const ifname in interfaces) {
if (ifname in interfaces) {
(_a = interfaces[ifname]) === null || _a === void 0 ? void 0 : _a.forEach((a) => {
if (a.family === family && macs.includes(a.mac) == false) {
addresses.push(a.address);
macs.push(a.mac);
}
});
}
}
return addresses;
}

@htool
Copy link
Contributor

htool commented Jun 4, 2023

I've added: #370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants