Skip to content

Commit 6300d50

Browse files
[HOTFIX] Release Candidate v2.0.4-rc-2 (- PR #277 -)
Some changes to prepare for the next release. Additions with file docs/Environment_Configuration.md: - New documentation for the new `multicast/env.py` (- WIP #31 -) Changes in file docs/Makefile: - related changes to new Logo.svg file. Changes in file docs/conf.py: - Version bump to v2.0.4-rc-2 Changes in file docs/index.md: - related changes to adding more documentation. Changes in file docs/toc.md: - related changes to adding more documentation. Changes in file multicast/__init__.py: - Version bump to v2.0.4-rc-2 Changes in file setup.cfg: - Version bump to v2.0.4-rc-2
1 parent 195d929 commit 6300d50

File tree

7 files changed

+109
-3
lines changed

7 files changed

+109
-3
lines changed

docs/Environment_Configuration.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Environment Configuration Module
2+
3+
## Overview
4+
The `multicast.env` module provides environment-based configuration for the multicast package, allowing runtime customization of network settings through environment variables.
5+
6+
## Environment Variables
7+
8+
| Variable | Default | Description |
9+
|----------|---------|-------------|
10+
| `MULTICAST_PORT` | 59259 | Port number for multicast communication (49152-65535) |
11+
| `MULTICAST_GROUP` | "224.0.0.1" | Primary multicast group address (224.0.0.0/4) |
12+
| `MULTICAST_GROUPS` | - | Space-separated list of additional multicast addresses |
13+
| `MULTICAST_TTL` | 1 | Time-to-live value (1-126) |
14+
| `MULTICAST_BIND_ADDR` | "0.0.0.0" | Address to bind to |
15+
| `MULTICAST_BUFFER_SIZE` | 1024 | Receive buffer size in bytes |
16+
17+
## Usage
18+
19+
### Basic Configuration
20+
```python
21+
import os # used to set environment
22+
23+
# Set custom configuration
24+
os.environ['MULTICAST_PORT'] = '50000'
25+
os.environ['MULTICAST_GROUP'] = '224.0.0.2'
26+
27+
# see os.environ['MULTICAST_GROUPS'] for multi-group config
28+
29+
# Uncommonly there is need to increase TTL and BUFFER size,
30+
# however users probably want raw sockets in those cases.
31+
# os.environ['MULTICAST_TTL'] = '2' # May harm your own bandwidth when increasing
32+
# os.environ['MULTICAST_BUFFER_SIZE'] = '2048' # Expect increased data loss when increasing
33+
34+
# Load configuration Loads on Import
35+
import multicast
36+
```
37+
38+
### Multiple Group Configuration
39+
```python
40+
# Join multiple multicast groups
41+
os.environ['MULTICAST_GROUPS'] = '224.0.0.1 224.0.0.2 224.0.0.3'
42+
# Load configuration Loads on Import
43+
import multicast
44+
45+
# load config
46+
from multicast.env import load_config
47+
config = load_config()
48+
49+
# you can now access configuration
50+
# e.g.
51+
print(config['groups']) # ['224.0.0.1', '224.0.0.2', '224.0.0.3']
52+
```
53+
54+
_(changing the resulting config values only causes the setting to loose its special value,
55+
and does not actually update Multicast after import)_
56+
57+
## Configuration Details
58+
59+
### Port Configuration
60+
- Valid range: 49152-65535 (dynamic/private ports)
61+
- Invalid values trigger warning and fall back to default
62+
- Example:
63+
```python
64+
os.environ['MULTICAST_PORT'] = '50000'
65+
```
66+
67+
### Group Configuration
68+
- Must be valid multicast addresses (224.0.0.0/4)
69+
- Invalid addresses trigger warning and fall back to default
70+
- Example:
71+
```python
72+
os.environ['MULTICAST_GROUP'] = '224.0.0.2'
73+
```
74+
75+
### TTL Configuration
76+
- Valid range: 1-126 (as per RFC-1112)
77+
- Also sets socket default timeout
78+
- Example:
79+
```python
80+
os.environ['MULTICAST_TTL'] = '2'
81+
```
82+
83+
### Buffer Size Configuration
84+
- Must be positive integer
85+
- Invalid values trigger warning and fall back to default
86+
- Example:
87+
```python
88+
os.environ['MULTICAST_BUFFER_SIZE'] = '2048'
89+
```
90+
91+
## Caveat
92+
- Environment variables must be set before importing the module
93+
- Invalid values trigger warnings but won't cause failures
94+
- Changes to configuration affect all subsequent operations
95+
96+
## References
97+
- [RFC-1112: Host Extensions for IP Multicasting](https://datatracker.ietf.org/doc/html/rfc1112)
98+
- [RFC-6335: IANA Port Number Registry](https://datatracker.ietf.org/doc/html/rfc6335)

docs/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ init: ../docs/
6565
@ln -s -f ../"$(PROJECT_DOC_SRC_DIR)" $(SRCDIR)/"$(PROJECT_DOC_SRC_DIR)"
6666
@ln -s -f ../tests $(SRCDIR)/tests 2>/dev/null || true
6767
@ln -s -f ../README.md $(SRCDIR)/README.md
68+
@ln -s -f ../Logo.svg $(SRCDIR)/Logo.svg
6869
@ln -s -f ../LICENSE.md $(SRCDIR)/LICENSE.md
6970

7071
clean:
@@ -73,6 +74,7 @@ clean:
7374
@-rm -f -d $(SRCDIR)/$(BUILDDIR) 2>/dev/null || true
7475
@-rm -f -d $(SRCDIR)/apidocs 2>/dev/null || true
7576
@-unlink $(SRCDIR)/README.md 2>/dev/null || true
77+
@-unlink $(SRCDIR)/Logo.svg 2>/dev/null || true
7678
@-unlink $(SRCDIR)/tests 2>/dev/null || true
7779
@-unlink $(SRCDIR)/LICENSE.md 2>/dev/null || true
7880
@-unlink $(SRCDIR)/"$(PROJECT_DOC_SRC_DIR)" 2>/dev/null || true

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
# The short X.Y version.
117117
version = "v2.0"
118118
# The full version, including alpha/beta/rc tags.
119-
release = "v2.0.4-rc-1"
119+
release = "v2.0.4-rc-2"
120120

121121
# The language for content autogenerated by Sphinx. Refer to documentation
122122
# for a list of supported languages.

docs/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ Jump directly to the [Quickstart](./toc)
99
- [README](./README): Introduction and installation instructions.
1010
- [Usage Guide](./USAGE): Detailed usage examples and API documentation.
1111
- [FAQ](./FAQ): Frequently asked questions and troubleshooting tips.
12+
- [Release Notes](https://github.com/reactive-firewall/multicast/releases): Release information.
13+
- [Environment Configuration](./Environment_Configuration): Environment Configuration Guide.
1214
- [CI Processes](./CI): Information on continuous integration and testing strategies.
15+
- [Exceptions in `multicast`](./Exception_Guide): Information on exceptions and their handling in
16+
the `multicast` module.
1317
- [License](./LICENSE): Licensing information and acknowledgments.
1418

1519
---

docs/toc.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ enabling developers to implement efficient and robust multicast functionality wi
7777
* [Usage Guide](./USAGE): Detailed usage examples and API documentation.
7878
* [FAQ](./FAQ): Frequently asked questions and troubleshooting tips.
7979
* [Release Notes](https://github.com/reactive-firewall/multicast/releases): Release information.
80+
* [Environment Configuration](./Environment_Configuration): Environment Configuration Guide.
8081
* [CI Processes](./CI): Information on continuous integration and testing strategies.
8182
* [Exceptions in `multicast`](./Exception_Guide): Information on exceptions and their handling in
8283
the `multicast` module.
@@ -91,6 +92,7 @@ apidocs/index
9192
/README
9293
/USAGE
9394
/FAQ
95+
/Environment_Configuration
9496
/CI
9597
/Exception_Guide
9698
/LICENSE

multicast/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393

9494
global __version__ # skipcq: PYL-W0604
9595

96-
__version__ = """2.0.4-rc-1"""
96+
__version__ = """2.0.4-rc-2"""
9797
"""The version of this program.
9898
9999
Minimal Acceptance Testing:

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = multicast
3-
version = 2.0.4-rc-1
3+
version = 2.0.4-rc-2
44
author = Mr. Walls
55
author_email = [email protected]
66
description = Multicast Python Module for Send/Recv Stubs.

0 commit comments

Comments
 (0)