aboutsummaryrefslogtreecommitdiffstats
path: root/util
Commit message (Collapse)AuthorAgeFilesLines
* util.hashes: Expose sha224 and sha384 HMAC functionsKim Alvefur2020-11-291-0/+2
| | | | For completeness and consistency with set of plain hash functions
* Merge 0.12->trunkKim Alvefur2022-06-141-1/+5
|\
| * util.startup: Fix async waiting for last shutdown stepsKim Alvefur2022-06-141-1/+5
| | | | | | | | | | | | | | | | | | | | | | Observed problem: When shutting down prosody would immediately exit after waiting for s2s connections to close, skipping the last cleanup events and reporting the exit reason and code. This happens because prosody.main_thread is in a waiting state and queuing startup.shutdown is dispatched trough the main loop via nexttick, but since the main loop was no longer running at that point it proceeded to the end of the prosody script and exited there.
* | util.watchdog: Allow passing a new timeout to :reset()Matthew Wild2022-06-111-1/+4
| |
* | util.watchdog: Allow :reset() to restart a cancelled watchdogMatthew Wild2022-06-111-5/+6
| |
* | util.watchdog: Update to use "new" util.timer APIMatthew Wild2022-06-111-13/+16
| | | | | | | | | | | | | | | | | | | | | | | | When this module was written, it wasn't possible to cancel or reschedule a timer. Times have changed, and we should take advantage of those new methods. This module becomes a very thin wrapper around util.timer now, but I'd argue it's still a very common and useful concept/abstraction to have around. Possible API change: this removes the 'last_reset' field of the watchdog. This was never really intended as a public thing, and I can't find any code that uses it, so I consider removal to be safe.
* | util.prosodyctl.shell: Print errors in red to highlight themKim Alvefur2022-06-011-1/+8
| |
* | util.openmetrics: Set __name field on metatables to improve error messagesKim Alvefur2022-05-301-0/+3
| | | | | | | | Don't think we cause any such errors right now, but you never know!
* | util.openmetrics: Set (previously unused, empty) metatableKim Alvefur2022-05-301-2/+2
| | | | | | | | Silences luacheck warning about the metatable being unused.
* | util.vcard: Delete since nothing uses itKim Alvefur2022-05-301-574/+0
| |
* | prosodyctl shell: Communicate width of terminal to mod_admin_shellKim Alvefur2022-05-301-1/+1
| | | | | | | | This lets it adjust the width of tables to the actual terminal width.
* | Merge 0.12->trunkKim Alvefur2022-05-261-4/+0
|\|
| * util.prosodyctl.check: Remove now redundant unbound config tweakKim Alvefur2022-05-261-4/+0
| | | | | | | | | | | | | | This is now done in net.unbound itself Turning it back on in the config may still cause the problem of entries there masking the DNS values.
* | Merge 0.12->trunkKim Alvefur2022-05-092-2/+9
|\|
| * util.jsonschema: Lua <5.3 compat here tooKim Alvefur2022-05-091-1/+4
| |
| * util.jsonpointer: Fix Lua <5.3 compatKim Alvefur2022-05-091-1/+5
| |
* | Merge 0.12->trunkKim Alvefur2022-05-081-1/+1
|\|
| * util.jsonpointer: Fix off-by-one in array resolutionKim Alvefur2022-05-081-1/+1
| | | | | | | | | | | | Fixes #1753 Not known to be used anywhere
* | Merge 0.12->trunkKim Alvefur2022-05-051-0/+1
|\|
| * util.prosodyctl.check: turn: Report lack of TURN services as a problem #1749Kim Alvefur2022-05-031-0/+1
| | | | | | | | | | Rationale: It seems unlikely that someone who has not configured any TURN service runs 'prosodyctl check turn' expecting this to be okay.
* | net: refactor sslconfig to not depend on LuaSecJonas Schäfer2022-04-021-16/+25
| | | | | | | | | | | | | | | | | | | | | | This now requires that the network backend exposes a tls_builder function, which essentially wraps the former util.sslconfig.new() function, passing a factory to create the eventual SSL context. That allows a net.server backend to pick whatever it likes as SSL context factory, as long as it understands the config table passed by the SSL config builder. Heck, a backend could even mock and replace the entire SSL config builder API.
* | net: isolate LuaSec-specificsJonas Schäfer2022-04-271-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For this, various accessor functions are now provided directly on the sockets, which reach down into the LuaSec implementation to obtain the information. While this may seem of little gain at first, it hides the implementation detail of the LuaSec+LuaSocket combination that the actual socket and the TLS layer are separate objects. The net gain here is that an alternative implementation does not have to emulate that specific implementation detail and "only" has to expose LuaSec-compatible data structures on the new functions.
* | Merge 0.12->trunkMatthew Wild2022-04-251-2/+5
|\|
| * util.argparse: Revise 553c6204fe5b with a different approachMatthew Wild2022-04-251-2/+5
| | | | | | | | | | | | The second return value is (not insensibly) assumed to be an error. Instead of returning a value there in the success case, copy the positional arguments into the existing opts table.
* | Merge 0.12->trunkMatthew Wild2022-04-251-2/+2
|\|
| * util.argparse: Return final 'arg' table with positional arguments for ↵Matthew Wild2022-04-251-2/+2
| | | | | | | | | | | | | | | | convenience This is the same as the input table (which is mutated during processing), but if that table was created on the fly, such as by packing `...` it's convenient if it also gets returned from the parse function.
* | Merge 0.12->trunkMatthew Wild2022-04-131-2/+2
|\|
| * util.prosodyctl: check turn: ensure a result is always returned from a check ↵Matthew Wild2022-04-131-2/+2
| | | | | | | | (thanks eTaurus)
* | Merge 0.12->trunkKim Alvefur2022-04-021-1/+1
|\|
| * util.random: Test whether util.crand works before using it (fix #1734)Kim Alvefur2022-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | util.crand can be configured at compile time to use the Linux getrandom() system call, available from Linux 3.17, but it is still possible to load it with an older kernel lacking that system call, where attempting to use it throws an ENOSYS error. By testing for this on load we can fall back to /dev/urandom in this case.
* | Merge 0.12->trunkMatthew Wild2022-03-281-0/+7
|\|
| * prosodyctl: check config: Report paths of loaded configuration files (fixed ↵Matthew Wild2022-03-281-0/+7
| | | | | | | | #1729)
* | Merge 0.12->trunkMatthew Wild2022-03-211-6/+13
|\|
| * util.startup: Show error for unrecognized arguments passed to 'prosody' ↵Matthew Wild2022-03-211-6/+13
| | | | | | | | (fixes #1722)
* | Merge 0.12->trunkMatthew Wild2022-03-191-0/+6
|\|
| * prosodyctl: check turn: Fail with error if our own address is supplied for ↵Matthew Wild2022-03-191-0/+6
| | | | | | | | the ping test
* | Merge 0.12->trunkMatthew Wild2022-03-192-6/+21
|\|
| * prosodyctl: check config: Skip bare JID components in orphan checkMatthew Wild2022-03-191-1/+1
| |
| * mod_admin_socket: Comment on LuaSocket UNIX compat codeKim Alvefur2022-03-161-0/+6
| | | | | | | | Ref #1717
| * mod_admin_socket: Compat for luasocket prior to unix datagram supportKim Alvefur2022-03-151-0/+3
| | | | | | | | | | | | | | | | | | | | The "socket.unix" module exported only a function before https://github.com/lunarmodules/luasocket/commit/aa1b8cc9bc35e56de15eeb153c899e4c51de82a8 when datagram support was added. Fixes #1717 Thanks rsc and lucas for reporting and testing
| * prosodyctl: check turn: warn about external port mismatches behind NATMatthew Wild2022-03-111-5/+11
| | | | | | | | | | | | | | Some NATs don't preserve port numbers, which can cause the TURN server's reported relay address to be incorrect (the TURN server has no way to predict what the external port is, so it can't be corrected in config like an IP mismatch can).
* | util.stanza: Create tables with correct size to avoid reallocationsKim Alvefur2022-03-181-2/+15
| | | | | | | | | | Potential performance gain since the tables don't need to be resized as they grow to the final size.
* | util.stanza: Use table.move in cloneKim Alvefur2022-03-181-9/+6
| | | | | | | | Code reduction, potentially a performance gain.
* | util.array: Take advantage of table.move()Matthew Wild2022-03-181-10/+6
| |
* | util.prosodyctl.shell: Support for receiving partial lines (no automatic \n)Matthew Wild2022-03-171-2/+6
| |
* | util.logger: Return sink_function from add_simple_sink()Matthew Wild2022-03-171-0/+1
| | | | | | | | This allows a simple sink to be later removed via remove_sink()
* | util.logger: Support for removing individual log sinks without a full resetMatthew Wild2022-03-171-0/+15
|/
* spelling: non-existing mistakes (thanks timeless)0.12.0Kim Alvefur2022-03-071-2/+2
|
* Spelling: Fix various spelling mistakes (thanks timeless)Kim Alvefur2022-03-076-8/+8
| | | | | | Words, sometimes I wonder how they even work Maybe I missed something.
* prosodyctl: check turn: compare correct addresses for relay mismatch ↵Matthew Wild2022-03-051-2/+5
| | | | detection (thanks Zash)