## Problem
Every macOS job in CI currently fails: `turnserver` segfaults on the
first TLS client in `examples/run_tests.sh` (e.g. run 37231739523 on
#2093, which only touches `dbd_sqlite.c`).
Cause: Homebrew's `openssl` formula now resolves to `openssl@4` (4.0.3),
but the libevent bottle's `libevent_openssl` still links `openssl@3`.
coturn builds against OpenSSL 4 and passes its `SSL*` to libevent
running on OpenSSL 3 via `bufferevent_openssl_socket_new`, which crashes
in `SSL_set_bio`. macOS two-level namespaces keep both copies loaded.
## Changes
- `.github/workflows/macos.yml`: install `openssl@3` and export
`OPENSSL_ROOT_DIR` / `PKG_CONFIG_PATH` for both the autotools and CMake
jobs.
- `cmake/CheckLibeventOpenSSL.cmake` (new), used from
`src/apps/common/CMakeLists.txt`: on macOS, fail configure when
`libevent_openssl` links a different OpenSSL major than the one found.
- `configure`: same check for the autotools build (Darwin only).
- `TURN_ALLOW_OPENSSL_MISMATCH` (CMake option / env var) overrides the
check.
## Testing
On macOS (both `openssl@3` 3.6.5 and `openssl@4` 4.0.3 installed):
- CMake configure with the default OpenSSL (`openssl@4`) fails with the
new error. With `-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3)` it
passes, and `-DTURN_ALLOW_OPENSSL_MISMATCH=ON` also passes.
- `./configure` with `openssl@4` first on `PKG_CONFIG_PATH` aborts; with
`openssl@3` first it passes, and the override also passes.
- With the `openssl@3` build: `ctest` 21/21, and `run_tests.sh`
(TCP/TLS/UDP/DTLS), `run_tests_conf`, `dtls_default`, `ipv6_relay`,
`mobility_quota`, `mobility_resume_flood`, `stateless_binding`,
`stateless_nonce` all pass with no FAIL or segfault.
On Linux (Docker): CMake configure, build and `ctest` (20/20) pass; the
check is a no-op there. I did not complete the Linux `run_tests*.sh`
pass.
The PR's own macOS CI jobs are the real end-to-end check.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
## Summary
The Prometheus exporter previously linked the
[digitalocean/prometheus-client-c](https://github.com/digitalocean/prometheus-client-c)
(`prom`) library, which is **no longer maintained**. This replaces it
with a minimal, self-contained Prometheus client under `src/prometheus/`
that is built straight from coturn's own sources and implements exactly
the slice of the API coturn uses: counters, gauges, a single default
registry, and the text-exposition serializer.
The vendored client is **drop-in API-compatible**, so `prom_server.c` is
unchanged. Histograms, summaries, custom registries and the upstream
`promhttp` handler are intentionally omitted (coturn serves `/metrics`
with its own libmicrohttpd handler).
The exporter is now **always compiled in**; the runtime `--prometheus`
flag still controls whether it starts. **libmicrohttpd** — actively
maintained — is the only remaining external dependency and is now
required by the build.
## Changes
- **`src/prometheus/{prom.h,prom.c}`** — vendored client. Thread-safe
(per-metric mutex on the increment path, read under lock in the bridge),
label-aware, with proper Prometheus value/label escaping and clean
integer formatting for counters. No deps beyond pthread/libc.
- **CMake** — replace `find_package(Prometheus)` with required
`find_package(MicroHTTPD)`; add `cmake/FindMicroHTTPD.cmake`; remove
dead `cmake/FindPrometheus.cmake` and the `WITH_PROMETHEUS` option.
- **`configure` / `Makefile.in`** — drop `-lprom`, compile the vendored
source.
- **Docker** (`debian`, `alpine`) and **CI** (`ubuntu-build-deps`,
`mingw`) — remove the `prometheus-client-c` build/install steps; keep
libmicrohttpd.
- **`docs/Prometheus.md`** rewritten.
- **`tests/test_prometheus.c`** — Unity tests for counter
accumulation/monotonicity, gauge inc/dec, and label-value escaping.
## Validation
- Full build green; all unit tests pass (incl. new `test_prometheus`);
`clang-format-15` clean.
- Live exporter scraped over HTTP — all `run_tests_prom.sh` scenarios
(default / custom address / port / path, plus the negative case) pass.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Implement a custom prometheus http handler in order to:
1. Support listening on a specified address as opposed to any
2. Remove the requirement on the unmaintained promhttp library
This feature comes with one limitation: if an IPv4 address is used, the
server will not listen on the IPv6-mapped address, even if IPv6 is
available. That is, dual-stacking does not work.
Solves: #1475
---------
Co-authored-by: Pavel Punsky <eakraly@users.noreply.github.com>
The following changes have been made:
1. Replace deprecated functions with new standard functions
2. Add corresponding MSVC functions for non-standard functions
3. Remove warnings about unsafe functions
4. CMAKE: modify find pack Libevent and openssl
5. Modify include files
6. Use pthread4W
7. Modify socket in windows
8. Add CI - github action
8.1. msvc
8.2. mingw
10. The database:
9.1. sqlite, pgsql, hiredis, mongo is test compiled.
9.2. mysql, isnot test compiled.
11. The applications、server can be compiled and run successfully!
12. Add vcpkg manifest mode in cmake.