feat(linux): add headless CLI client - #237
Open
mohs3n71 wants to merge 4 commits into
Open
Conversation
mohs3n71
marked this pull request as draft
July 29, 2026 03:28
mohs3n71
marked this pull request as ready for review
July 29, 2026 04:10
Author
Update: periodic runtime health monitoringFollow-up commit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Description
This PR adds an optional terminal-only Linux client for running DefyxVPN on
servers, SSH-only hosts, containers, and minimal installations.
defyxvpn-clireuses the existing Linux DXcore library without linking Flutter,GTK, Firebase, or display-server libraries. It runs in the foreground for shell
or systemd supervision. No Dart, GUI, or existing application code is changed.
Main changes
connect,status, anddisconnectcommands.matching the desktop client.
environment variables.
a Linux x86_64 artifact.
Networking and security
DXcore's
127.0.0.1:5000SOCKS5 endpoint remains the default. To listen on adifferent address or port, the CLI starts an in-process TCP relay:
The relay preserves TCP half-closes. An EOF from one direction is propagated
with
shutdown(SHUT_WR)while the reverse response remains readable.LAN exposure is opt-in and unauthenticated, so non-loopback binds produce a
warning. Addresses and ports are validated,
0.0.0.0:5000is rejected becauseit conflicts with DXcore's internal listener, and simultaneous relay
connections are limited to 256.
A LAN-facing port should be restricted to trusted clients with the host or
network firewall.
The CLI does not create a TUN interface, modify system routes, install
certificates, or change system proxy settings.
HTTPS health validation and failover
DXcore can report
VPN connectedeven when a selected route cannot transfer acomplete HTTPS response. Small connectivity checks may also pass while larger
TLS responses are truncated.
When
--health-checkis enabled, the CLI:checkingafter DXcore reports connected.data path.
count.
Example:
defyxvpn-cli connect \ --pattern "Hive,Xray,Outline,Masque" \ --listen-address 0.0.0.0 \ --listen-port 1080 \ --health-check \ --health-check-interval 60 \ --health-check-failures 2 \ --timeout 90The defaults are:
https://speed.cloudflare.com/__down?bytes=6553665536bytes20seconds60seconds2These settings are configurable through command-line arguments or environment
variables:
Setting
--health-check-interval 0keeps startup validation enabled butdisables the CLI's periodic probes.
The probe invokes
curldirectly withposix_spawnpand fixed arguments,without a shell. It disables user curl configuration, resolves DNS through the
SOCKS5 proxy, follows HTTPS redirects only, and uses the operating system's CA
certificate store.
DXcore's internal health monitor remains enabled independently.
Runtime failure behavior
A DXcore
failedor unexpectedstoppedevent immediately marks the currentmethod unhealthy without waiting for the next periodic probe.
During runtime failover, the CLI:
If no methods remain, the CLI exits with code
4. The provided systemd serviceuses
Restart=on-failure, waits five seconds, and starts again from the firstmethod.
Related Platforms
Verification Checklist
Automated verification
ReleaseandRelWithDebInfoconfigurations.checks, TCP relay half-closes, startup method failover, configurable periodic
checks, consecutive failure counting, and runtime failure exit code
4.consecutive periodic failures, and verifies the expected failover messages
and exit status.
The GUI and non-Ubuntu distributions were not exercised. The available
production DXcore library currently limits the artifact to Linux x86_64.