]> git.ipfire.org Git - thirdparty/knot-resolver.git/commit
manager: use proper JSON values for socket communication
authorOto Šťáva <oto.stava@nic.cz>
Fri, 9 Feb 2024 09:55:17 +0000 (10:55 +0100)
committerAleš Mrázek <ales.mrazek@nic.cz>
Thu, 15 Feb 2024 09:51:05 +0000 (10:51 +0100)
commitc375cf2cbc5931a70594373065aa18e5ec18f9d5
treeeea26099ad09e2f28e0c31f4dd34846065ed290e
parenta94d38a65f7560a91fb16941c6a503a9614e2f13
manager: use proper JSON values for socket communication

This commit adds a special JSON mode for control sockets.

The mode is activated by issuing a special `__json` command to the
socket, resulting in all Lua objects returned by all subsequent commands
to be serialized into JSONs, prepended by a 32-bit unsigned integer
byte-length value.

This JSON mode is now exclusively utilized by Manager, removing the need
to hackily strip single-quotes from the output and to read the output by
lines. Instead, it can always just read the 32-bit length value and
subsequently the whole JSON-formatted message, which is now
automatically deserialized into a Python object.
daemon/engine.c
daemon/engine.h
daemon/io.c
daemon/lua/sandbox.lua.in
manager/knot_resolver_manager/datamodel/cache_schema.py
manager/knot_resolver_manager/datamodel/templates/macros/common_macros.lua.j2
manager/knot_resolver_manager/datamodel/templates/monitoring.lua.j2
manager/knot_resolver_manager/kresd_controller/interface.py
manager/knot_resolver_manager/kresd_controller/registered_workers.py
manager/knot_resolver_manager/server.py
manager/knot_resolver_manager/statistics.py