1.0.4 • Published 3 years ago

hostapd-config v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

hostapd-config

Nodejs wrapper to configure and run hostapd

Usage

/*
 * The following creates a basic WPA WiFi network
 * on a raspberry pi 3B.
 */
const Hostapd = require('hostapd-config');

const options = {
  iface: 'wlan0',
  ssid: 'TellMyWiFiLoveHer',
  wpaPassphrase: 'supersecretpassword'
};

const hostapd = new Hostapd(options);

// Start independent daemon
hostapd.start().then(result => {
  console.log(`Hostapd started with code ${result.code}`);
}).catch(err => {
  console.log(`Hostapd failed to start: ${err.message}`);
});

// alternatively you can start it as a systemctl service
hostapd.restart().then(() => {
  console.log('Service started successfully');
});

Options

OptionTypeDescriptiondefaultrequired
ifaceStringNetwork Interface hostapd listens onwlan0default
ssidStringSSID (display name of your WiFi network)N/Ayes
wpaPassphraseStringYour WiFi passwordN/Ayes
driverStringWiFi driver to usenl80211 (raspberry pi wifi)default
hwModeStringhw_mode option in hostapdgdefault
channelIntegerchannel option in hostapd11default
wpaIntegerwpa option in hostapd1default
wpaKeyMgmtStringwpa_key_mgmt option in hostapdWPA-PSKdefault
wpaPairwiseStringwpa_pairwise option in hostapdTKIP CCMPdefault
wpaPtkRekeyIntegerwpa_ptk_rekey option in hostapd600default
pidFileStringPath to pid file/tmp/{uuidv4}.confdefault
configFilePathStringPath to hostapd config file/etc/hostapd/hostapd.confdefault

For more info on bolded options, see the hostapd man page.