9 Commits

5 changed files with 52 additions and 9 deletions

View File

@@ -2,6 +2,31 @@
All notable changes to this project will be documented in this file.
## [0.4.1] - 2026-02-28
### Bug Fixes
- [`eb46889`](https://gitea.pufereq.pl/judas/judas_client/commit/eb4688915747e2dcff3b331618c2b0185f1b611d) **connector.py**: fix `address already in use` error
## [0.4.0] - 2026-02-28
### Features
- [`ac55216`](https://gitea.pufereq.pl/judas/judas_client/commit/ac5521618ba89b25fd31f09357470ed96cd405cf) **client.py**: add custom ID support with `JUDAS_ID` env variable
- [`6486607`](https://gitea.pufereq.pl/judas/judas_client/commit/64866079d7e2087be7dd8588b22be73006605a91) **connector.py**: handle `CONTROL.CLOSE` msgs
### Miscellaneous Tasks
- [`448ffa4`](https://gitea.pufereq.pl/judas/judas_client/commit/448ffa443d0b7b464d3f70f81a0b1b3f17765484) **uv.lock**: update depedencies for Python 3.14
### Refactor
- [`11ae93e`](https://gitea.pufereq.pl/judas/judas_client/commit/11ae93ed3ceac148097f4246e53e2150a653fcf8) **client.py**: rename `Client.mac_address` -> `Client.id`
### Build
- [`2d8dc06`](https://gitea.pufereq.pl/judas/judas_client/commit/2d8dc06fa1087bb1ed968d798dc82cd0c6159e16) **uv.lock**: update judas_protocol to 0.6.0
## [0.3.0] - 2025-11-30
### Bug Fixes

View File

@@ -4,7 +4,7 @@ build-backend = "uv_build"
[project]
name = "judas_client"
version = "0.3.0"
version = "0.4.1"
description = "A client for judas, a remote PC fleet management system."
readme = "README.md"
authors = []

View File

@@ -4,6 +4,7 @@
from __future__ import annotations
import logging as lg
import os
import uuid
from judas_protocol import Message
@@ -29,11 +30,18 @@ class Client:
self.server_host: str = server_host
self.server_port: int = server_port
self.mac_address: str = self._get_mac_address()
self.logger.debug(f"MAC address: {self.mac_address}")
if "JUDAS_ID" in os.environ:
self.id: str = os.environ["JUDAS_ID"]
self.logger.debug(
f"Using ID from environment variable JUDAS_ID: {self.id}"
)
else:
self.id = self._get_mac_address()
self.logger.debug(f"ID: {self.id}")
self.connector: Connector = Connector(
mac_address=self.mac_address,
mac_address=self.id,
host=self.server_host,
port=self.server_port,
on_message=self.handle_message,
@@ -63,5 +71,5 @@ class Client:
def run(self) -> None:
"""Run the client."""
self.logger.info(f"Starting Client ({self.mac_address})...")
self.logger.info(f"Starting Client ({self.id})...")
self.connector.run()

View File

@@ -41,6 +41,7 @@ class Connector:
self.socket: socket.socket = socket.socket(
socket.AF_INET, socket.SOCK_STREAM
)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket.setblocking(False)
self.selector.register(
@@ -174,8 +175,17 @@ class Connector:
)
try:
message: Message = Message.from_bytes(message_bytes)
# handle incoming ACKs
if (
message.category == Category.CONTROL
and message.action == ControlAction.CLOSE
):
self.logger.warning(
"[!] Received CLOSE command from server, shutting down."
)
self.running = False
break
# handle incoming ACKs
elif (
message.category == Category.CONTROL
and message.action == ControlAction.ACK
):

6
uv.lock generated
View File

@@ -275,7 +275,7 @@ wheels = [
[[package]]
name = "judas-client"
version = "0.3.0"
version = "0.4.1"
source = { editable = "." }
dependencies = [
{ name = "judas-protocol" },
@@ -318,8 +318,8 @@ test = [
[[package]]
name = "judas-protocol"
version = "0.5.0"
source = { git = "https://gitea.pufereq.pl/judas/judas_protocol.git#c48b69ecee16f5824ffd8bce8921341d5fa326b7" }
version = "0.6.0"
source = { git = "https://gitea.pufereq.pl/judas/judas_protocol.git#d16c1914ba343aed300f1c5fae0201370c3274de" }
[[package]]
name = "markdown-it-py"