Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ Unit tests with `busted` aim to give coverage without being tightly coupled to
the implementation. Integration tests run TLS clients (curl, Chromium, uTLS) to
connect to haproxy containers and provide end-to-end validation.

You will need to have `just` >=2.0.0 and `busted` installed.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm going crazy, I don't think just >= 2.0.0 exists?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I spotted I'm using a feature that was introduced in 1.46.0.


```console
$ just unit-test
$ just integration-test-http
Expand Down
21 changes: 12 additions & 9 deletions ja4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,18 @@ local function _ja4(txn)
-- One Lua gotcha is that 0 is truthy! HAProxy 3.1 or later can be told
-- to return bools by setting `tune.lua.bool-sample-conversion normal`.
-- We handle both cases.
local fingerprint_prefix = string.format(
"%s%s%s%02d%02d%s",
protocol,
version,
(has_sni == true or has_sni == 1) and "d" or "i",
math.min(#ciphers, 99),
math.min(extension_count, 99),
alpn
)
local sni_char = (has_sni == true or has_sni == 1) and "d" or "i"
local cipher_count = math.min(#ciphers, 99)
local ext_count = math.min(extension_count, 99)
-- String concatenation is faster than string.format in LuaJIT
local fingerprint_prefix = protocol
.. version
.. sni_char
.. (cipher_count < 10 and "0" or "")
.. cipher_count
.. (ext_count < 10 and "0" or "")
.. ext_count
.. alpn

----------------------------------------------------
-- Prepare JA4_b (truncated hash of cipher suites)
Expand Down