mirror of
https://git.disroot.org/pranav/pybatmesh.git
synced 2025-01-08 16:04:05 +05:30
improved README, more logging
This commit is contained in:
parent
4ea53e5a35
commit
4db6d9457f
49
README.md
49
README.md
@ -17,7 +17,7 @@ network.
|
||||
|
||||
<!-- NOTE TO ACTIVISTS
|
||||
|
||||
Running this program in the world's largest partly-free democracy
|
||||
Running this program in the world's largest (partly-free) democracy
|
||||
may result in you getting arrested under the UAPA, and not
|
||||
getting bail because of false evidence planted in your phone by
|
||||
Pegasus, or by a forensic lab in Gujarat.
|
||||
@ -221,10 +221,10 @@ naxalnet --help
|
||||
|
||||
## How it works
|
||||
|
||||
There are three modes commonly supported by WiFi adapters -
|
||||
`ap` (WiFi hotspot), `station` (for joining WiFi networks) and `ad-hoc`
|
||||
(for decentralised networks). There are some other modes too,
|
||||
like `p2p` (WiFi direct), but we won't go into the details.
|
||||
There are three modes commonly supported by WiFi adapters - `ap` (WiFi
|
||||
hotspot), `station` (for joining WiFi networks) and `ad-hoc` (for
|
||||
decentralised networks). There are other modes supported by some WiFi
|
||||
adapters too, like `p2p` (WiFi direct), but this program doesn't use them.
|
||||
|
||||
naxalnet uses two modes - `ad-hoc` and `ap`, for connecting to the
|
||||
mesh. naxalnet uses iwd to start an `ad-hoc` network and configures
|
||||
@ -234,8 +234,8 @@ naxalnet starts an ad-hoc on one of them and an ap on the other.
|
||||
You can use the ap for connecting mobile phones and other devices
|
||||
to the mesh network.
|
||||
|
||||
Read the code to learn the details.
|
||||
See [systemd-networkd](systemd-networkd) to see how
|
||||
Read the code and the documentation to learn the details.
|
||||
See the directory [systemd-networkd](systemd-networkd) to see how
|
||||
systemd-networkd configures the network.
|
||||
|
||||
## Use cases
|
||||
@ -245,15 +245,22 @@ systemd-networkd configures the network.
|
||||
naxalnet can be used to share connections in remote areas.
|
||||
You need at least one device with internet access.
|
||||
|
||||
<!--
|
||||
|
||||
### Malign democracies and well-established institutions
|
||||
|
||||
Withheld due to national security reasons.
|
||||
|
||||
-->
|
||||
|
||||
### 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 should be installed on your machine _before_ your friendly
|
||||
democratic government announces an [internet shutdown][], since you
|
||||
cannot download and install them during a shutdown.
|
||||
When a shutdown occurs, [enable naxalnet][enablenx]
|
||||
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 should be installed on your
|
||||
machine _before_ your friendly democratic government announces an
|
||||
[internet shutdown][], since you cannot download and install them
|
||||
during a shutdown. When a shutdown occurs, [enable naxalnet][enablenx].
|
||||
|
||||
## Uninstalling
|
||||
|
||||
@ -273,10 +280,16 @@ See [HACKING.md](HACKING.md)
|
||||
|
||||
## Similar projects
|
||||
|
||||
The following projects are similar to naxalnet, but are not designed
|
||||
to be used in a machine with WiFi adapter. If you live in
|
||||
an area where the materials required for any of them are easily
|
||||
available, consider using them instead of naxalnet.
|
||||
Many projects make setting up B.A.T.M.A.N. Advanced mesh networks with
|
||||
WiFi routers easier. They are easier to setup and are more
|
||||
configurable. But naxalnet is different from them. It simplifies
|
||||
setting up mesh networks with _laptops or computers_, and is not
|
||||
designed to work with routers.
|
||||
|
||||
The following projects does something similar to naxalnet, but
|
||||
requires special devices or routers to work. If you live in an area
|
||||
where the materials required for any of them are easily available,
|
||||
consider using them instead of naxalnet.
|
||||
|
||||
- [LibreMesh][]: framework for OpenWrt-based firmwares
|
||||
- [disaster.radio][]: solar-powered communications network
|
||||
|
@ -46,6 +46,7 @@ from pathlib import Path
|
||||
from configparser import ConfigParser
|
||||
from argparse import ArgumentParser, Namespace
|
||||
from naxalnet.default import CONFIG, CONFIG_FILES, CONFIG_DIRS
|
||||
from naxalnet.log import logger
|
||||
|
||||
|
||||
def get_config_files():
|
||||
@ -54,6 +55,7 @@ def get_config_files():
|
||||
of files that exists as pathlib.Path objects
|
||||
"""
|
||||
config_files = []
|
||||
|
||||
for directory in CONFIG_DIRS:
|
||||
path = Path(directory)
|
||||
if path.exists():
|
||||
@ -68,12 +70,14 @@ def parse_config():
|
||||
Parse all configuration files, with the values in
|
||||
default.py as fallback
|
||||
"""
|
||||
logger.debug("Parsing config files")
|
||||
parser = ConfigParser()
|
||||
# encoded defaults
|
||||
parser.read_dict(CONFIG)
|
||||
# read config files
|
||||
files = get_config_files()
|
||||
for i in files:
|
||||
logger.debug("Reading config file %s", str(i))
|
||||
parser.read_file(i.open())
|
||||
return parser
|
||||
|
||||
@ -141,4 +145,5 @@ def parse_args() -> Namespace:
|
||||
help="prints the version and exit",
|
||||
)
|
||||
|
||||
logger.debug("Parsing arguments")
|
||||
return parser.parse_args()
|
||||
|
Loading…
Reference in New Issue
Block a user