mirror of
https://github.com/MrTheory/os-xray.git
synced 2026-11-05 00:27:59 +00:00
[GH-ISSUE #19] tun2socks fails to start: wrong flag syntax -config instead of --config #13
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MrTheory/os-xray#13
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tqb333 on GitHub (Aug 1, 2026).
Original GitHub issue: https://github.com/MrTheory/os-xray/issues/19
tun2socks never starts —
xray-service-control.phpinvokes it with-config(single dash), which pflag/Cobra doesn't recognize as--configEnvironment: OPNsense 26.7.1 (FreeBSD 15.1 amd64), os-xray v3.0.0, tun2socks v2.7.0, xray-core v26.3.27
Description
After a clean install and a correctly configured instance (wizard fields all valid, confirmed working via manual SOCKS5 test),
xray-corestarts fine buttun2socksnever comes up.configctl xray statusall(and the GUI status page) shows:indefinitely, with no error surfaced to the user.
Root cause
scripts/Xray/xray-service-control.php, indo_start():tun2socksuses pflag/Cobra for CLI parsing (-c, --config stringper its own--help). pflag treats a single dash followed by a multi-character name as a cluster of shorthand flags, not as the long-form flag — so-configis not equivalent to--config. The process either fails to parse its config path correctly or exits immediately; either way it never comes up, and the failure isn't logged anywhere visible.Steps to reproduce
xray-coreshows running;tun2socksshows stopped; the TUN interface never comes up.Verification of the fix
Running the exact same binary/config manually with the corrected flag works immediately:
brings the TUN interface up right away, whereas the same invocation with
-configdoes not.Suggested fix
Change
'-config 'to'--config '(or'-c ') inxray-service-control.php.