Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
common = require('../../common'),
status = require('./../../triggers/status'),
logger = common.logger.prefix('network'),
config = common.config,
needle = require('needle');
var ap_list_callbacks = [],
getting_ap_list = false;
/////////////////////////////////////////////////////////////////
// getters
/////////////////////////////////////////////////////////////////
exp.get_public_ip = network.get_public_ip;
exp.get_private_ip = network.get_private_ip;
exp.get_gateway_ip = network.get_gateway_ip;
exp.get_active_network_interface = network.get_active_interface;
/////////////////////////////////////////////////////////////////
// wifi getters
/////////////////////////////////////////////////////////////////
/**
* Callsback an array of wireless interface names
**/
exp.get_wireless_interfaces_list = os_functions.get_wireless_interfaces_list;
exp.get_active_access_point_mac = os_functions.get_active_access_point_mac;
}).on('getDefaultAddress', (event, arg) => {
network.get_private_ip((err, ip) => {
ipcClient.send('getDefaultAddress', ip);
});
}).on('getHostname', (event, arg) => {
ipcClient.send('getHostname', os.hostname());
self.start = function (cb) {
network.get_private_ip(function (err, ip) {
if (err) {
cb(err)
}
var multiaddrs = []
multiaddrs.push(new Multiaddr('/ip4/' + ip + '/tcp/' + 4001))
self.peer = new Peer(Id.create(), multiaddrs)
self.useRouterDHT()
self.useDiscoveryMDNS()
if (cb) {
cb()
}
})
}
}).on('getDefaultLocalAddress', (event, arg) => {
network.get_private_ip((err, ip) => {
event.sender.send('defaultLocalAddress', ip);
});
}).on('getHostname', (event, arg) => {
event.sender.send('hostname', os.hostname());