Skip to content

Commit b22b899

Browse files
[STYLE] Style cleanup for Improvements to FAQ and related documentation (- WIP #425 -)
Changes in file docs/FAQ.md: * style fixes Changes in file docs/SECURITY.md: * style fixes for very long lines Changes in file docs/USAGE.md: * more white-space style fixes * related style fixes
1 parent c81a5d1 commit b22b899

File tree

3 files changed

+249
-102
lines changed

3 files changed

+249
-102
lines changed

docs/FAQ.md

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
### How do I get this running?
1414

1515
To configure your environment for developing with the multicast library, follow the steps in the
16-
[Install Guide](https://github.com/reactive-firewall/multicast/tree/HEAD/docs/INSTALL.md).
16+
[Install Guide](./INSTALL.md).
1717
Key steps include:
1818

1919
1. Ensuring you have a supported version of Python installed.
2020
2. use pip to install
2121
3.
22-
| _in `Python`_ | _in `bash`_ |
23-
|---------------|-------------|
24-
| `import multicast` | `python3 -m multicast --help` |
22+
23+
| _in `Python`_ | _in `bash`_ |
24+
|---------------|-------------|
25+
| `import multicast` | `python3 -m multicast --help` |
2526

2627
### How do I use this `multicast` to receive some UDP multicast?
2728

@@ -67,14 +68,32 @@ messages, no more than one message at a time.
6768
6869
#### _Develop in `Python`_
6970
70-
71+
While the command line interface is useful for prototyping, the Python API is better for
72+
the rest of the development process. So, once you are ready to proceed to implement a more advanced
73+
solution in Python, you can import the `multicast' library module with the usual `import multicast`
74+
logic.
7175
7276
### How do I use this to send UDP Multicast?
7377
7478
With `multicast` installed and set up, this guide will assume you want to send a message to
7579
multicast group `224.0.0.1` on the UDP port `59595`.
7680
77-
#### _Prototype in `bash`_
81+
#### _from the python module_
82+
83+
Sending is similar to listening, you create a sender and pass it the options, except that unlike
84+
listeners and receivers, senders are always synchronous (e.g., allowing only one message per call).
85+
86+
```python3
87+
from multicast import send
88+
89+
# Create a multicast sender
90+
sender = send.McastSAY()
91+
92+
# Send a message
93+
sender(group='224.0.0.1', port=59595, ttl=1, data='Hello, Multicast!')
94+
```
95+
96+
#### _from the CLI_
7897
7998
```bash
8099
python3 -m multicast SAY --group 224.0.0.1 --port 59595 --message "Hello World!"
@@ -88,7 +107,7 @@ python3 -m multicast SAY --group 224.0.0.1 --port 59595 --message "Hello World!"
88107
| `--message` | This specifies the rest of the input is to be the message to transmit. |
89108
| `"Hello World!"` | This specifies the multicast message content to _transmit_. In this case, it is the greeting "Hello World!" |
90109
91-
##### Steps to Run
110+
##### Step-by-step
92111
93112
1. Open your terminal.
94113
2. Ensure you have the multicast module installed and accessible.
@@ -105,6 +124,14 @@ functionality to ensure that messages are being transmitted and received correct
105124
> implementation (e.g., lacks useful input validation, lacks error handling, etc.)
106125
107126
```python3
127+
# Optional setup console logging
128+
import logging
129+
multicast_logging_sink = logging.getLogger()
130+
handler = logging.StreamHandler()
131+
multicast_logging_sink.setLevel(logging.INFO) # increase default logging from multicast module
132+
handler = logging.StreamHandler() # example trivial log handler
133+
multicast_logging_sink.addHandler(handler)
134+
108135
# imports
109136
from multiprocessing import Process as Process
110137
import multicast
@@ -114,17 +141,6 @@ import random # for random port
114141
MCAST_GRP = "224.0.0.1" # Replace with your multicast group address (use IPv4 dotted notation)
115142
MCAST_PORT = int(random.SystemRandom().randint(49152, 65535)) # Replace with your multicast port
116143
117-
# Other important settings (Non-Multicast)
118-
# Multicast does not care about the host IP, but the UDP protocol layer of the Python socket does
119-
# There are 3 logical choices for the vast majority of users:
120-
# 1. '0.0.0.0' for Promiscuous mode (Usually needs privileges to use on most Operating Systems)
121-
# 2. The actual interface IPv4 dot notation address for unprivileged mode
122-
# 3. MCAST_GRP value, Linux and MacOS implementations can let the system choose by passing the
123-
# MCAST_GRP to the Python socket.bind operation (handled by multicast.skt when missing Host IP)
124-
# Windows users must use option 1 or 2 for now.
125-
# This address is per socket (e.g., can be chosen per socket even if on a single interface)
126-
# HOST_BIND_IP = "0.0.0.0"
127-
128144
# Options for multicast listener
129145
listener_options = {
130146
"is_daemon": True, # bool: enable daemon mode
@@ -162,19 +178,18 @@ MCAST_PORT = int(random.SystemRandom().randint(49152, 65535)) # Replace with yo
162178
# There are 3 logical choices for the vast majority of users:
163179
# 1. '0.0.0.0' for Promiscuous mode (Usually needs privileges to use on most Operating Systems)
164180
# 2. The actual interface IPv4 dot notation address for unprivileged mode
165-
# 3. MCAST_GRP value, Linux and MacOS implementations can let the system choose by passing the
181+
# 3. None, Linux and MacOS implementations can let the system choose by passing the
166182
# MCAST_GRP to the Python socket.bind operation (handled by multicast.skt when missing Host IP)
167183
# Windows users must use option 1 or 2 for now.
168184
# This address is per socket (e.g., can be chosen per socket even if on a single interface)
169-
HOST_BIND_IP = MCAST_GRP
185+
170186
171187
# Options for multicast listener
172188
listener_options = {
173189
"is_daemon": False, # bool: enable/disable daemon mode
174190
"groups": [MCAST_GRP], # list[str]: multicast group addresses (use IPv4 dotted notation list)
175191
"port": MCAST_PORT, # int: UDP port for multicast
176192
"iface": None, # str: System specific interface name, or None to let system choose
177-
"bind": HOST_BIND_IP, # str: interface IP address (unnecessary; only included for completeness)
178193
"group": MCAST_GRP # str: primary multicast group address (use IPv4 dotted notation)
179194
}
180195
@@ -277,19 +292,17 @@ finally:
277292
> interprocess communication theory and the standard python `multiprocessing` module and its use.
278293
> Together these examples demonstrate a trivial message passing IPC using multicast python sockets.
279294
280-
Here is a
281-
[more CLI focused way to test](https://github.com/reactive-firewall/multicast/blob/389c93eb86e012a38edb88b3b81c7d4aa55e843a/tests/test_usage.py#L385C2-L432C43)
282-
as another trivial example of how to use the module.
295+
See also [USAGE Guide](./USAGE.md)
283296

284297
### How do I run and interpret the test suite for this project?
285298

286-
To run the test suite, follow the instructions in the [Testing Guide](https://github.com/reactive-firewall/multicast/tree/HEAD/docs/Testing.md).
299+
To run the test suite, follow the instructions in the [Testing Guide](./Testing.md).
287300

288301
The guide explains test organization, and how to run tests outside CI/CD.
289302

290303
### How is continuous integration (CI) set up for this repository?
291304

292-
CI is configured as described in the [CI Guide](https://github.com/reactive-firewall/multicast/tree/HEAD/docs/CI.md).
305+
CI is configured as described in the [CI Guide](./CI.md).
293306
Key points:
294307

295308
Automated builds and tests are run via GitHub Actions. Each pull request is tested for
@@ -304,7 +317,7 @@ and what to expect when contributing changes.
304317
> The **default** multicast group address is `224.0.0.1`.
305318
306319
From the
307-
[documentation](https://github.com/reactive-firewall/multicast/blob/v1.4/multicast/__init__.py#L185-L187):
320+
[API documentation](https://github.com/reactive-firewall/multicast/blob/v1.4/multicast/__init__.py#L185-L187):
308321
> The Value of "224.0.0.1" is chosen as a default multicast group as per RFC-5771
309322
> on the rational that this group address will be treated as a local-net multicast
310323
> (caveat: one should use link-local for ipv6).
@@ -326,7 +339,7 @@ From [RFC-1112 §6.1](https://www.rfc-editor.org/rfc/rfc1112#section-6.1)
326339
> choice is required to multicast beyond a single network.
327340
328341
From the
329-
[documentation](https://github.com/reactive-firewall/multicast/blob/v1.4/multicast/__init__.py#L214-L217):
342+
[API documentation](https://github.com/reactive-firewall/multicast/blob/v1.4/multicast/__init__.py#L214-L217):
330343
> A Value of 1 (one TTL) is chosen as per
331344
> [RFC-1112 §6.1](https://www.rfc-editor.org/rfc/rfc1112#section-6.1) on the rational that an
332345
> explicit value that could traverse beyond the local connected network should be
@@ -339,19 +352,19 @@ From the
339352
> The **default** UDP port used by `multicast` is `59595`.
340353
341354
From the
342-
[documentation](https://github.com/reactive-firewall/multicast/blob/v1.4/multicast/__init__.py#L155):
355+
[API documentation](https://github.com/reactive-firewall/multicast/blob/v1.4/multicast/__init__.py#L155):
343356
> Arbitrary port to use by default, though any dynamic and free port would work.
344357
345358
While developers and network administrators must consider other factors in real-world deployments,
346359
it is fair to say any free port in the dynamic or "ephemeral" port range of `49152`-`65535` should
347-
work as far as this Multicast module is concerned.
360+
work as far as the `multicast` module is concerned.
348361

349362
* For `SAY` the port refers to the destination port.
350363
* for `RECV` and `HEAR` the port refers to the port to listen on.
351364

352365
> [!CAUTION]
353-
> It is best to specify the port in use at this time as the default has yet to be properly
354-
> assigned ( see related reactive-firewall/multicast#62 )
366+
> It is best to specify the port in use at this time as the default will not be properly
367+
> assigned to `multicast` ( see related reactive-firewall/multicast#62 ) by any central authority.
355368
356369
### CLI exit code meanings
357370

docs/SECURITY.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Security
22

3-
If you find a significant vulnerability, or evidence of one,
4-
please report it privately.
3+
If you find a significant vulnerability, or evidence of one, please report it privately.
54

6-
We prefer that you use the [GitHub mechanism for privately reporting a vulnerability](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability). Under the
7-
[main repository's security tab](https://github.com/reactive-firewall/multicast/security), click "Report a vulnerability" to open the advisory form.
5+
We prefer that you use the
6+
[GitHub mechanism for privately reporting a vulnerability](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability).
7+
Under the
8+
[main repository's security tab](https://github.com/reactive-firewall/multicast/security), click
9+
"Report a vulnerability" to open the advisory form.

0 commit comments

Comments
 (0)