Files
shadowsocks-libev/tests/consumer/main.cpp
T
Max Lv 1b4c00f28d Add an embedding API: ss_local_start/stop/wait and a C++ wrapper (#3076)
<shadowsocks/control.h> starts ss-local on a library-owned thread,
stops it from any thread through a libuv async handle and waits for it;
<shadowsocks/shadowsocks.hpp> wraps that in a move-only, header-only
shadowsocks::LocalServer whose destructor stops and waits. The library
exports only C symbols, shadowsocks.h is unchanged, and the shared
library version becomes 2.1.0 (SOVERSION 2). test_local_api_cpp covers
the lifecycle; the installed-package consumer gains a C++ program.
2026-10-15 10:09:37 +08:00

11 lines
371 B
C++

// C++ consumer of the installed headers: the RAII wrapper over the C
// control API, without starting a server.
#include <shadowsocks/shadowsocks.hpp>
int main()
{
shadowsocks::LocalServer server;
static int (*volatile start)(const profile_t *, ss_local_callback, void *, ss_local_handle **) = ss_local_start;
return server.running() || start == nullptr;
}