From a798ac8051a48b4e050cd6d916110a56ae23aa30 Mon Sep 17 00:00:00 2001 From: Pranav Jerry Date: Mon, 9 Aug 2021 12:54:41 +0530 Subject: [PATCH] improved README.md And added a new argument (not implemented) in scripts.py --- README.md | 41 ++++++++++++++++++++++++++++------------- naxalnet/scripts.py | 16 ++++++++++++++-- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 0a7ce39..546f687 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ **naxalnet** is a program to create a wireless mesh network for communicating with each other. It can be useful during an -[internet shutdown][], or to join online classes with a group of laptops. +[internet shutdown](#internet-shutdown), or to join +[online classes](#online-class-in-remote-areas) with a group +of laptops. It uses [B.A.T.M.A.N. Advanced][batman-adv], an implementation of the B.A.T.M.A.N. routing protocol to communicate with peers. @@ -163,13 +165,27 @@ sudo systemctl start NetworkManager.service ## How it works -The program naxalnet copies some `systemd-networkd` configuration files -into networkd's runtime configuration directory. It uses iwd to start -an ad-hoc network named "HelloWorld". See the -[systemd-networkd](systemd-networkd) directory -to see how systemd-networkd configures the network. You can use -services like [IPFS][], [Jami][], [Secure Scuttlebutt][ssb] +naxalnet uses iwd to start an ad-hoc network and configures +systemd-networkd to setup a BATMAN Advanced network. +Read the code to learn the details. +See [systemd-networkd](systemd-networkd) to see how systemd-networkd +configures the network. + +## Use cases + +### Online class in remote areas + +naxalnet can be used to share connections in remote areas. +You need atleast one device with internet access. + +### Internet shutdown + +You can communicate with neighbouring devices running naxalnet, +using services like [IPFS][], [Jami][], [Secure Scuttlebutt][ssb] and others which can work on an intranet. +They need to be installed on your device _before_ your friendly +totalitarian administration orders an [internet shutdown][], since you +cannot download and install them during a shutdown. ## Uninstalling @@ -198,13 +214,12 @@ available, consider using them instead of naxalnet. ## License -This program is [free/libre/swatantra][free-sw] software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +naxalnet is [free/libre/swatantra][free-sw] software: you can +redistribute it and/or modify it under the terms of the GNU General +Public License as published by the Free Software Foundation, either +version 3 of the License, or (at your option) any later version. -See [LICENSE](LICENSE) for the complete version of the -license. +See [LICENSE](LICENSE) for the complete version of the license. [batman-adv]: https://www.open-mesh.org/projects/batman-adv/wiki [internet shutdown]: https://internetshutdowns.in diff --git a/naxalnet/scripts.py b/naxalnet/scripts.py index 7faaa62..244703f 100644 --- a/naxalnet/scripts.py +++ b/naxalnet/scripts.py @@ -23,8 +23,8 @@ with systemd-networkd and iwd import sys from pathlib import Path from shutil import copy -from dasbus.error import DBusError from argparse import ArgumentParser +from dasbus.error import DBusError from naxalnet.iwd import IWD, Device, Adapter NETWORKD_CONFIGS = "/usr/share/naxalnet/networkd" @@ -56,6 +56,11 @@ def copy_files(): def setup_devices(args): + """ + Setup wifi interfaces using iwd + This function should be called every time an interface + is connected or removed + """ iwd = IWD() devices = iwd.get_devices() adhoc_devices = [] @@ -148,7 +153,14 @@ def parse_args(): parser.add_argument( "--adhoc-name", "-a", type=str, default=ADHOC_NAME, help="name of adhoc network" ) - # TODO: implement verbose + # TODO: print info about wifi network from config and args + parser.add_argument( + "--print-wifi", + action="store_true", + default=False, + help="prints the ssid and password of the WiFi network and exit", + ) + # TODO: implement --verbose parser.add_argument( "-v", "--verbose",