Commit Graph

54 Commits

Author SHA1 Message Date
ospab 794ea5251b refactor(ci): target_version + per-channel iteration in gha.ps1
Previous scheme conflated "which release is this" with "how many times has
it been rebuilt": every run bumped the patch version, so by the time a build
was ready to promote to master the version number had already crept forward
by however many alpha/beta iterations it took to get there.

Now a release cycle has one fixed target version (e.g. 0.4.1) that stays in
every manifest unchanged through all alpha/beta iterations; only a
per-channel counter increments, and that counter lives ONLY in the git tag,
never in Cargo.toml:

  v0.4.1-alpha.1 -> v0.4.1-alpha.2 -> ... -> v0.4.1-alpha.N
  v0.4.1-beta.1  -> v0.4.1-beta.2  -> ... -> v0.4.1-beta.N
  v0.4.1                                          <- master, iteration dropped

Deliberately "0.4.1-alpha.N" (dot AFTER the hyphen — a semver pre-release
identifier), not "0.4.1.N-alpha" (a 4th dot component before the hyphen):
the latter isn't valid semver and Cargo's version parser rejects it outright,
so it can never appear in Cargo.toml. That's also why the target version
itself never needs to change on a plain iteration — bumping every manifest +
refreshing both Cargo.locks is now skipped entirely unless -Switch actually
changes the target, making a routine alpha/beta push fast (just the state
file's counter + a tag).

Also fixes a real bug found while touching this: release.yml's push trigger
is tags-only ("v*") with no branch trigger, so the old `git push origin
$branch`-only path for alpha/pre-release never actually started a CI run —
only the master path (which already pushed a tag) worked. Every channel now
always pushes a real tag, which is what actually triggers the build.

release.yml's resolve-channel needed no changes: its tag-channel detection
already does substring matching (*-alpha*/*-beta*), so it classifies
"v0.4.1-alpha.37" correctly without modification.

-Prefix is gone — channel was always 1:1 with -Branch (alpha/pre-release/
master), so it was a redundant, independently-settable axis that could
silently drift from the branch (e.g. -Branch alpha -Prefix beta).
2026-07-09 23:42:27 +03:00
ospab 1568db3323 ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
ospab edb2d8e229 ci: fix powershell encoding error 2026-07-09 02:45:00 +03:00
ospab d609a3e883 ci: fix powershell parse error caused by utf-8 em-dash 2026-07-09 02:44:11 +03:00
ospab 43914055b3 ci: fix branch name in gha.ps1 2026-07-09 02:43:46 +03:00
ospab 3df5d5fccf ci: remove push branches to save GHA minutes, update script to beta 2026-07-09 02:43:07 +03:00
ospab 26665a826f feat(client): one authoritative config migrator, manual-only
- fix(cli): stop printing the startup banner ("ostp-cli vX.Y.Z | OS: ...")
  to stderr on every single command invocation. init_tracing() ran
  unconditionally before command dispatch, so `ostp -V`, `ostp gk`, etc. all
  showed it. It's still written to the log file (useful there), just no
  longer echoed via the stderr tracing layer for one-shot commands.

- feat(client): add ostp-client::migrate, the ONE place config migration
  runs. Previously there were three uncoordinated migration paths: a Python
  snippet embedded in scripts/install.sh (only touched server api.* fields,
  ran on every update), the old 0.3.x line's auto-migration on every hot
  reload (silent besides a log warning), and nothing at all for the current
  rebuild. Consolidated into one module covering every config shape that's
  actually existed:
    - v0.3.1-v0.3.21 modular (inbounds/outbounds/routing) -> current flat
      schema, including correctly resolving routing.default_outbound through
      a urltest/selector group to the real server, and reporting (not
      silently dropping) every additional server a multi-server config had.
    - pre-0.3.1 flat configs carrying now-dead fields (tun.wintun_path,
      tun.ipv4_address, transport.wss) -> dropped with an explicit reason,
      everything else passes through untouched.
    - server configs -> backfills api.* defaults and drops legacy api.token
      (ported straight from the install.sh Python, same behavior, correct
      place).
  6 unit tests cover all of the above against realistic fixtures. Wired up
  as `ostp migrate` (was missing from Commands entirely) — no other code
  path calls into this module, so a config's shape only ever changes when
  explicitly asked.

- feat(cli): `ostp import <url>` now asks the same TUN/mux/debug questions
  `ostp connect <url>` always did. Previously import just wrote flat
  defaults to disk with no way to turn any of that on short of hand-editing
  the resulting config.json afterward. Extracted the shared prompt into
  prompt_client_options() so both paths stay in sync.

- chore(install): remove the embedded Python config-migration snippet from
  install.sh; schema migration must never happen implicitly during an
  install/update. Points users at `ostp migrate` instead.
2026-07-08 18:45:04 +03:00
ospab 0ec09d1311 ci: add scripts/gha.ps1 — versioned release cutter with channel memory
Replaces ad-hoc manual tag pushes (which is how the confusing v0.4.1-beta /
v0.4.2-beta / bare "nightly" / "pre-release" release mess happened) with one
script that always goes through the same path: bump every version manifest,
commit, and push in the way release.yml's resolve-channel job actually
expects (branch push for nightly/pre-release, a real "vX.Y.Z" tag for
master — never a hand-pushed "vX.Y.Z-beta"-style tag).

Remembers the last {version, branch, prefix} used in .release-state.json, so
a bare run repeats last time's channel with the patch version bumped, and
-Switch starts a new version line (e.g. 0.3.x -> 0.4.0) without disturbing
which channel is currently being released to.
2026-07-08 18:05:01 +03:00
ospab b2ee9eb010 Port CLI subcommands + multi-channel release onto the 0.4.0 rebuild
Brings the useful work from the old master/pre-release lineage (5c2b5a0)
onto the clean rebuild, since that lineage never had the multi-server/WSS/
Reality removal or any of the 0.4.0 stability work. This is a manual port,
not a cherry-pick — this file's Args/ClientConfig shape had already
diverged too much for the patch to apply mechanically.

- ostp/src/main.rs: flat Args -> clap subcommands (setup, init, generate-key,
  links, check, connect, uninstall, update, import, proxy-env,
  proxy-env-clear), bridged onto the existing ~500 lines of flag-driven
  dispatch via a LegacyArgs struct so none of that logic had to change.
- Fixed a real bug found while porting: GenerateKey's `count` used
  short='c', colliding with the global `--config` short (also 'c'), which
  clap validates across the whole command tree on first parse() -- a
  duplicate short flag there could break every subcommand's parsing, not
  just generate-key's.
- `update` now takes `-b/--branch` and `-v/--version` explicitly (was a
  bare flag with no way to target a channel or exact version).
- Added the UAC elevation step for TUN mode that this lineage's CLI was
  completely missing (`run_client_directly` went straight to creating the
  TUN adapter unelevated). Also fixed the elevation check itself: it only
  tested `ret <= 32`, but ShellExecuteW returns ERROR_CANCELLED (1223) when
  the user clicks "No" on the UAC prompt -- > 32, so a denied prompt was
  read as success and the process exited silently without starting the
  tunnel. Now ret==1223 is reported explicitly, and a genuine failure logs
  GetLastError() so the real Win32 cause is visible next time.
- scripts/install.sh: added -b/--branch alongside the existing -v/--version,
  and channel-aware release resolution (nightly/pre-release use their own
  rolling tag; stable resolves via the GitHub API's "latest").
- release.yml: added nightly/pre-release branch-push triggers for rolling
  prereleases. Fixed the tag_name logic from 5c2b5a0, which mapped
  `master` pushes to a release tagged "nightly" -- backwards from master
  being the most stable channel. github.ref_name already equals the
  branch or tag name that triggered the run, so no per-branch remapping is
  needed at all; master is intentionally left off the branch-push list --
  it only ever gets real version tags.

Verified: `cargo build -p ostp` succeeds, and `ostp update --help` /
`ostp generate-key --help` / `ostp --help` show the expected flags with no
clap panic.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-08 01:38:44 +03:00
ospab acab38c551 0.4.1: per-key junk marker, GUI polish, pre-release pipeline
security / protocol:
- Derive a PER-KEY junk marker (obfuscation.rs, info byte 0x04) instead of the
  global constant [0x88,0x1A,0x93,0x5D]. A fixed marker was a universal DPI
  signature identifying ALL OSTP users at once — exactly what the HKDF version
  gate avoids for the handshake. Server drops junk via a new DispatchOutcome::Junk
  inside the existing key-trial loop (secrets already derived → zero extra cost);
  client stamps its own key's marker.
- §E: configurable junk/fragmentation params (junk_pc / junk_ps / frag_chunk / frag_sleep).

GUI (desktop):
- Light theme + toggle, GUI version footer in Settings.
- Fix mouse-wheel scroll on Settings (flex child needed min-height: 0).
- Drop the false "process exclusions unsupported in TUN mode" warning — they DO
  work (native_handler maps port->process via GetExtendedTcpTable).

release / infra:
- build.ps1: add -PreRelease (tag CURRENT version as v<ver>-beta.N, no bump, no
  master commit); guard the panel build when ostp-control ships no source; bump
  the real ostp-gui/package.json instead of the nonexistent ostp-control one.
- release.yml: mark hyphenated tags as GitHub pre-releases; don't hard-fail the
  web-panel step when there is no source (use committed dist/).
- Versions aligned to 0.4.1; README license badge BSL 1.1 -> AGPL v3.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 16:33:57 +03:00
ospab 7704e0bdb1 §A.3: remove dead tun2socks code (native OSTP TUN is the only path)
The "system" TUN stack that shelled out to a bundled tun2socks binary is
long-dead — Flutter already hardcodes the native OSTP stack — and only
bloats the build.

- ostp-jni: drop the tun2socks spawn branch and the tun_child handle;
  the native TUN (run_native_tunnel_from_fd) is now unconditional. The
  JNI signature is kept ABI-stable (t2sBinPath/localProxy retained but
  ignored) to avoid breaking the Kotlin linkage without an Android build.
- Delete the committed 10 MB tun2socks-arm64 asset; drop the tun2socks
  download steps from the Android build scripts.
- Remove the dead tun2socks.exe entry from the desktop build_dist.js
  (it required a file nothing downloads, breaking the GUI dist build).
- Reword stale tun2socks references in proxy.rs, the GUI config comment,
  install.ps1, the release workflow matrix, and CONTRIBUTING.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 16:29:55 +03:00
ospab a9e4511190 Fix CLI setup permissions, enforce global debug tracing, and fix GUI silent startup crash 2026-06-13 01:25:54 +03:00
ospab 04c31c7f53 feat: implement wintun dynamic downloading, add missing driver frontend modal, fix background logging and UAC helper issues 2026-06-09 01:01:36 +03:00
ospab 730eab8553 feat: implement built-in DNS server, adblock and dns leak prevention 2026-06-07 19:55:42 +03:00
ospab a82c664e5b Fix UDP IPv4-mapped IPv6 address matching bug and completely remove tun2socks 2026-05-30 21:14:29 +03:00
ospab 44bc2339d0 fix: detect real public IP for panel URL output 2026-05-26 22:08:51 +03:00
ospab def11a631c feat: prompt panel setup during update if not configured 2026-05-26 22:03:12 +03:00
ospab 49c3bce029 fix: config migration uses hardcoded field injection, no ostp --init; fix init template api fields 2026-05-26 21:59:41 +03:00
ospab 04dc133453 feat: auto-migrate config on update — add new fields, preserve existing data 2026-05-26 21:50:47 +03:00
ospab 7f499d6263 feat: embed web panel via rust-embed with login page and custom webpath 2026-05-26 21:30:49 +03:00
ospab f65fce3144 Add relay mode initialization option to Linux installer 2026-05-26 19:45:21 +03:00
ospab ec8aab22f7 feat: install script v2 — global PATH symlink, /etc/ostp config, legacy path migration
- Binary at /opt/ostp/ostp, symlink at /usr/local/bin/ostp
- Config moved to /etc/ostp/config.json (standard Linux layout)
- Auto-migration from legacy paths: ~/ostp, /root/ostp, old /opt/ostp/config.json
- Systemd service updated with RUST_LOG=info
- Test script updated to discover binary via PATH first
2026-05-17 21:22:01 +03:00
ospab 3e6baf5a06 fix: use portable-atomic for AtomicU64 on 32-bit targets (MIPS, ARM32) 2026-05-17 21:14:07 +03:00
ospab e36d743ad5 refactor: professionalize all scripts and CI workflow
build.ps1:
- Added mandatory cargo check pre-flight that blocks releases on errors
- Added --Check flag for check-only mode (no build, no release)
- Reverts version bump if check fails
- Professionalized all output (removed informal language)
- Cleaner output structure with consistent [ok], [warn], [error] tags

install.ps1 / install.sh:
- Professionalized all prompts and messages
- Removed informal phrasing
- Consistent formatting

test_linux.sh:
- Updated all log string matchers to match professionalized output:
  'Connection established' (was 'Bridge connection established')
  'Starting server' (was 'Starting in SERVER mode')
  'Starting client' (was 'Starting in CLIENT mode')
  RTT regex updated for new format

release.yml:
- Added cargo check pre-flight step before native compilation
2026-05-17 03:41:40 +03:00
ospab ec35769b9f fix: implement non-blocking unbounded channels and clean stream reset on reconnect 2026-05-16 23:41:04 +03:00
ospab 2819a14189 fix(installer): use rename trick to bypass file locks and ensure all bundled files (tun2socks, wintun) are copied 2026-05-15 20:24:01 +03:00
ospab 877d9035cc test: enhance test_linux.sh with remote live diagnostics 2026-05-15 18:56:43 +03:00
ospab d0146d027d Fix: Enforce local filesystem touch on ostp.exe to override inherited build server timestamps after zip expansions. 2026-05-15 01:02:18 +03:00
ospab a118e45cf1 Fix: Mitigate Invoke-WebRequest hangs via UseBasicParsing, and implement aggressive child/parent directory hierarchy scans for zero-friction binary discoveries. 2026-05-15 00:57:54 +03:00
ospab fb32ca29de DevOps: Overhaul Windows install.ps1 to support dynamic location preservation and smart permission-agnostic deployment mapping. 2026-05-15 00:55:51 +03:00
ospab 0642cbde06 Fix: Resolve PowerShell parser error in install.ps1 by wrapping interpolated arch variable in curly braces before colon delimiter. 2026-05-15 00:50:22 +03:00
ospab 32ce5de107 DevOps: Add scripts/install.ps1 native Windows installer and updater, and document Linux/Windows bootstrappers in README.md 2026-05-15 00:41:37 +03:00
ospab 3848083d52 DevOps: Localize quick-start install.sh shell script to English for global platform parity. 2026-05-15 00:38:03 +03:00
ospab 83cf831ebc DevOps: Transform quick-start shell installer into a smart auto-updater. Detects pre-existing configs, transparently hot-swaps binaries, restarts running services, and bypasses interactive setup loops. 2026-05-15 00:37:24 +03:00
ospab b0ce83c076 Install: Refactor install.sh script to support auto-architecture detection, correct .tar.gz archive downloads and seamless tar extraction 2026-05-14 23:52:33 +03:00
ospab 97c9e3045b CI/CD: Remove CI suppression [skip ci] to fully restore automatic release triggers 2026-05-14 23:34:05 +03:00
ospab c8c760c7d0 CI/CD: Add proactive git-pull rebase synchronization to start of build.ps1 2026-05-14 23:15:40 +03:00
ospab 882ef6f337 CI/CD: Fix GHA YAML negation syntax & Introduce -TriggerOnly parameter in build.ps1 2026-05-14 23:10:03 +03:00
ospab 799be180bc CI/CD: Focus local build.ps1 exclusively on Windows/Linux x64 for rapid daily developer iteration 2026-05-14 23:07:16 +03:00
ospab 31892ca2cf CI/CD: Decouple build.ps1 from gh CLI and fully migrate release publishing to GitHub Actions via automatic Git tagging 2026-05-14 23:04:30 +03:00
ospab c58ca91ed5 CI/CD: Introduce Enterprise GitHub Actions release matrix & enrich local build with FreeBSD 2026-05-14 23:02:39 +03:00
ospab f071e8309e CI/CD: Expand Matrix to include Windows ARM64 and Linux 32-bit targets 2026-05-14 22:59:07 +03:00
ospab bc656e2c52 CI/CD: Add -Flatten switch to build.ps1 to consolidate raw tagged binaries into dist/release/ 2026-05-14 22:49:17 +03:00
ospab 26a0953b5f CI/CD: Implement Universal Cross-Platform Release Matrix and Automated GitHub Deployment via gh CLI 2026-05-14 22:47:44 +03:00
ospab ef8bea242b Enhancement: Add Section 8 for concurrent multiplexed offline traffic routing verification 2026-05-14 22:42:32 +03:00
ospab 93bf3579fd Enhancement: Add automated DPI Active Probing (TSPU stealth) and Unauthorized client testing in test_linux.sh 2026-05-14 22:40:28 +03:00
ospab fadee756e3 Fix: Use robust universal hex regex for key injection in test_linux.sh to support pretty-printed arrays 2026-05-14 22:37:44 +03:00
ospab 8fc4bdef6a Enhancement: Implement Section 6 integrated connection & handshake testing in test_linux.sh 2026-05-14 22:35:45 +03:00
ospab bbe5a88f36 Fix: Persist WSL compilation artifacts in host target_linux to prevent WSL /tmp evaporation 2026-05-14 22:22:04 +03:00
ospab cbb4486514 Fix: Resolve WSL path escaping bug and enforce distribution cleanup in build.ps1 2026-05-14 22:13:18 +03:00