forked from cloud/ovgate
A userspace VPN gateway: builds an OpenVPN tunnel to a VPNGate node with
the OpenVPN 3 core, terminates it in-process with lwIP, and serves SOCKS5
(RFC 1928/1929, CONNECT and UDP ASSOCIATE) over it. No root, no tun
device, no routing table changes.
Layout follows the module boundaries in docs/ARCHITECTURE.md:
vpngate/ directory fetch + CSV parse (lines run to ~13.5 KB, so the
parser streams rather than splitting on newlines)
selector/ two-phase pick: cheap prior over the whole list, then real
TCP handshake timing of the top K
ovpn/ openvpn3 driven through TunBuilder, packets over a socketpair
netstack/ lwIP: the TCP/IP stack that makes "no root" possible
egress/ the swappable way out, and make-before-break switching
socks5/ the front door
health/ per-window scoring, and the decision to move
app/ wiring, admin HTTP, signals
docs/FEASIBILITY.md is the analysis this was built from, including the
one requirement that is not physically possible -- carrying established
TCP connections across a node switch -- and what is done instead
(zero-progress redial, UDP re-homing, grace-period drain).
Tests: 155 without the tunnel egress, 172 with it. The seam is the egress
factory; selection, scoring, history and probing all run for real.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
30 lines
860 B
CMake
30 lines
860 B
CMake
set(OVG_TEST_SOURCES
|
|
harness.cpp
|
|
test_common.cpp
|
|
test_csv_parser.cpp
|
|
test_selector.cpp
|
|
test_http_get.cpp
|
|
test_ovpn.cpp
|
|
test_egress.cpp
|
|
test_socks5.cpp
|
|
test_health.cpp)
|
|
|
|
# The netstack only exists in a tunnel build (see src/CMakeLists.txt), so its
|
|
# tests come and go with it rather than being #ifdef'd to an empty file.
|
|
if(OVG_WITH_TUNNEL)
|
|
list(APPEND OVG_TEST_SOURCES test_netstack.cpp)
|
|
endif()
|
|
|
|
add_executable(ovg_tests ${OVG_TEST_SOURCES})
|
|
|
|
target_include_directories(ovg_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
target_compile_definitions(ovg_tests PRIVATE
|
|
OVG_TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data")
|
|
target_link_libraries(ovg_tests PRIVATE
|
|
ovg_selector ovg_ovpn ovg_egress ovg_socks5 ovg_health)
|
|
if(OVG_WITH_TUNNEL)
|
|
target_link_libraries(ovg_tests PRIVATE ovg_netstack)
|
|
endif()
|
|
|
|
add_test(NAME unit COMMAND ovg_tests)
|