Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da6aafaf1d | ||
|
|
363caf912a | ||
|
|
e84d42a10c | ||
|
|
8af7b2e628 |
No files matched your search
@@ -0,0 +1,160 @@
|
|||||||
|
name: Windows release
|
||||||
|
|
||||||
|
# The Windows port (windows/). On a tag windows-v<version> it builds the release zip and
|
||||||
|
# publishes it as a Gitea release, with the notes in windows/release-notes/<version>.md. Run
|
||||||
|
# by hand, it only builds: the zip is the run's artifact.
|
||||||
|
#
|
||||||
|
# Two jobs, as upstream's dependency updates: the one that runs fetched code (crates,
|
||||||
|
# components, wheels, the Nix closure) holds no token that can write. Only the publishing job
|
||||||
|
# sees RELEASE_TOKEN (write:repository), and it runs nothing it fetched: curl and jq on the
|
||||||
|
# first job's artifact. Gitea ignores `permissions:`; they are here to say what each job needs.
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ["windows-v*"]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
timeout-minutes: 150
|
||||||
|
env:
|
||||||
|
# Single-user Nix without a daemon: the job's container has no init to run one, nor
|
||||||
|
# the namespaces a build sandbox needs. Set for the job, so the installer has it too.
|
||||||
|
NIX_CONFIG: |
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
sandbox = false
|
||||||
|
build-users-group =
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
steps:
|
||||||
|
# Full history: the flake is windows/ inside this repository, fetched by Nix as git.
|
||||||
|
- name: Check out
|
||||||
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Check the version
|
||||||
|
working-directory: windows
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
|
||||||
|
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
|
||||||
|
[[ "$GITHUB_REF_NAME" == "windows-v$version" ]] ||
|
||||||
|
{ echo "::error::the tag is $GITHUB_REF_NAME, but windows/Cargo.toml says $version"; exit 1; }
|
||||||
|
[ -f "release-notes/$version.md" ] ||
|
||||||
|
{ echo "::error::no windows/release-notes/$version.md"; exit 1; }
|
||||||
|
fi
|
||||||
|
echo "Proxy Suite for Windows $version"
|
||||||
|
|
||||||
|
# Pinned: this installer checks the hash of the Nix it downloads, and is checked here.
|
||||||
|
- name: Install Nix
|
||||||
|
env:
|
||||||
|
NIX_VERSION: 2.34.9
|
||||||
|
NIX_INSTALL_SHA256: a03ce2e9eaf4ea1560260b9a93e311dbaf589d28fb5c9318f8d9e768ee6339d8
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
# The runner may run as root (no sudo in the image) or as a user with sudo.
|
||||||
|
as_root() { if [ "$(id -u)" -eq 0 ]; then "$@"; else sudo "$@"; fi; }
|
||||||
|
if ! command -v xz >/dev/null 2>&1; then
|
||||||
|
as_root apt-get update -qq
|
||||||
|
as_root apt-get install -y -qq xz-utils
|
||||||
|
fi
|
||||||
|
as_root install -d -m 0755 -o "$(id -u)" -g "$(id -g)" /nix
|
||||||
|
tmp=$(mktemp -d)
|
||||||
|
curl -sSfL -o "$tmp/install" "https://releases.nixos.org/nix/nix-$NIX_VERSION/install"
|
||||||
|
echo "$NIX_INSTALL_SHA256 $tmp/install" | sha256sum -c --quiet
|
||||||
|
USER=${USER:-$(id -un)} sh "$tmp/install" --no-daemon --no-modify-profile --no-channel-add
|
||||||
|
echo "$HOME/.nix-profile/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
- name: Dev shell and Rust toolchain
|
||||||
|
working-directory: windows
|
||||||
|
run: nix develop --command rustup toolchain install
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
working-directory: windows
|
||||||
|
run: nix develop --command cargo test --workspace --locked
|
||||||
|
|
||||||
|
- name: Package
|
||||||
|
working-directory: windows
|
||||||
|
run: nix develop --command tools/package.sh
|
||||||
|
|
||||||
|
- name: Collect
|
||||||
|
working-directory: windows
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
|
||||||
|
mkdir -p ../release
|
||||||
|
cp "dist/ProxySuite-$version-windows-x64.zip" "dist/ProxySuite-$version-windows-x64.zip.sha256" ../release/
|
||||||
|
if [ -f "release-notes/$version.md" ]; then cp "release-notes/$version.md" ../release/notes.md; fi
|
||||||
|
|
||||||
|
- name: Upload
|
||||||
|
uses: https://github.com/actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: windows-release
|
||||||
|
path: release/
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
publish:
|
||||||
|
needs: build
|
||||||
|
if: startsWith(github.ref, 'refs/tags/windows-v')
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
timeout-minutes: 20
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
steps:
|
||||||
|
- name: Download
|
||||||
|
uses: https://github.com/actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: windows-release
|
||||||
|
path: release
|
||||||
|
|
||||||
|
# The release for the tag, made if it is not there yet (a pre-release for a version with
|
||||||
|
# a "-"), and its assets, replacing any of the same name, so a rerun is harmless.
|
||||||
|
- name: Publish
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
||||||
|
TAG: ${{ github.ref_name }}
|
||||||
|
SHA: ${{ github.sha }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
as_root() { if [ "$(id -u)" -eq 0 ]; then "$@"; else sudo "$@"; fi; }
|
||||||
|
if ! command -v jq >/dev/null 2>&1; then
|
||||||
|
as_root apt-get update -qq
|
||||||
|
as_root apt-get install -y -qq jq
|
||||||
|
fi
|
||||||
|
[ -n "$TOKEN" ] || { echo "::error::the RELEASE_TOKEN secret is not set"; exit 1; }
|
||||||
|
api() { curl -sS --fail-with-body -H "Authorization: token $TOKEN" "$@"; }
|
||||||
|
version=${TAG#windows-v}
|
||||||
|
|
||||||
|
code=$(curl -sS -o found.json -w '%{http_code}' -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG")
|
||||||
|
case $code in
|
||||||
|
200) id=$(jq -r .id found.json) ;;
|
||||||
|
404)
|
||||||
|
pre=false
|
||||||
|
[[ "$version" == *-* ]] && pre=true
|
||||||
|
id=$(jq -n --arg tag "$TAG" --arg sha "$SHA" --arg name "Proxy Suite for Windows $version" \
|
||||||
|
--rawfile body release/notes.md --argjson pre "$pre" \
|
||||||
|
'{tag_name: $tag, target_commitish: $sha, name: $name, body: $body, prerelease: $pre, draft: false}' |
|
||||||
|
api -H 'Content-Type: application/json' --data-binary @- "$API/releases" | jq -r .id)
|
||||||
|
echo "made the release for $TAG" ;;
|
||||||
|
*) echo "::error::looking up the release for $TAG: HTTP $code: $(cat found.json)"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
for f in release/*.zip release/*.sha256; do
|
||||||
|
name=$(basename "$f")
|
||||||
|
for old in $(api "$API/releases/$id/assets" | jq -r --arg n "$name" '.[] | select(.name == $n) | .id'); do
|
||||||
|
api -X DELETE "$API/releases/$id/assets/$old" >/dev/null
|
||||||
|
done
|
||||||
|
api -F "attachment=@$f" "$API/releases/$id/assets?name=$name" >/dev/null
|
||||||
|
echo "uploaded $name"
|
||||||
|
done
|
||||||
|
echo "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/$TAG"
|
||||||
@@ -1 +1,2 @@
|
|||||||
target/
|
target/
|
||||||
|
dist/
|
||||||
Generated
+4
-4
@@ -879,7 +879,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ps-core"
|
name = "ps-core"
|
||||||
version = "0.1.0"
|
version = "0.1.0-pre.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
@@ -893,7 +893,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ps-ctl"
|
name = "ps-ctl"
|
||||||
version = "0.1.0"
|
version = "0.1.0-pre.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@@ -905,7 +905,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ps-ipc"
|
name = "ps-ipc"
|
||||||
version = "0.1.0"
|
version = "0.1.0-pre.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -916,7 +916,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ps-service"
|
name = "ps-service"
|
||||||
version = "0.1.0"
|
version = "0.1.0-pre.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
|
|||||||
+6
-1
@@ -3,7 +3,7 @@ resolver = "2"
|
|||||||
members = ["crates/ps-core", "crates/ps-ipc", "crates/ps-service", "crates/ps-ctl"]
|
members = ["crates/ps-core", "crates/ps-ipc", "crates/ps-service", "crates/ps-ctl"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.1.0"
|
version = "0.1.0-pre.2"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://git.faumaray.com/faumaray/proxy-suite-flake"
|
repository = "https://git.faumaray.com/faumaray/proxy-suite-flake"
|
||||||
@@ -31,3 +31,8 @@ sha2 = "0.10"
|
|||||||
zip = { version = "2", default-features = false, features = ["deflate"] }
|
zip = { version = "2", default-features = false, features = ["deflate"] }
|
||||||
ps-core = { path = "crates/ps-core" }
|
ps-core = { path = "crates/ps-core" }
|
||||||
ps-ipc = { path = "crates/ps-ipc" }
|
ps-ipc = { path = "crates/ps-ipc" }
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
lto = "thin"
|
||||||
|
strip = true
|
||||||
|
codegen-units = 4
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
# Proxy Suite for Windows
|
||||||
|
|
||||||
|
A native Windows port of [proxy-suite-flake](https://github.com/FUFSoB/proxy-suite-flake): the
|
||||||
|
same configuration (upstream's `services.proxy-suite` options, same names and defaults), run
|
||||||
|
by a Windows service instead of NixOS and systemd, controlled with `proxy-ctl` as upstream's is.
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> **Pre-release.** Built and tested on Linux and under Wine, **never yet run on real Windows.**
|
||||||
|
> Read [what has been verified](#what-has-been-verified) before relying on it, and please
|
||||||
|
> report what happens on yours.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> For study and research only, as upstream: learning how proxies, tunnels and traffic
|
||||||
|
> routing work. No warranty.
|
||||||
|
|
||||||
|
## What it does (this release)
|
||||||
|
|
||||||
|
| | |
|
||||||
|
|---|---|
|
||||||
|
| Local proxy | SOCKS5/HTTP on `127.0.0.1:1080` through sing-box (or the hybrid sing-box + XRay backend) |
|
||||||
|
| Outbounds | links (vless/REALITY/TLS, vmess, trojan, shadowsocks, hysteria2, tuic, anytls, naive, socks, http), raw JSON, subscriptions, groups (failover, urltest, selector), chains, pins, route modes, routing rules by site, address, geodata, rule set or **program** |
|
||||||
|
| zapret | Flowseal's [zapret-discord-youtube](https://github.com/Flowseal/zapret-discord-youtube) release: `winws.exe` with any of its `general*.bat` presets, your lists, the game filter |
|
||||||
|
| zapret2 | `winws2.exe` from bol-van's [zapret-win-bundle](https://github.com/bol-van/zapret-win-bundle) with [nfqws2-keenetic](https://github.com/nfqws/nfqws2-keenetic)'s strategies and nfqws2's own learning of blocked sites |
|
||||||
|
| tg-ws-proxy | Flowseal's [tg-ws-proxy](https://github.com/Flowseal/tg-ws-proxy), the headless proxy, on a bundled Python |
|
||||||
|
| TUN | sing-box's TUN (wintun), `proxy-ctl proxy tun on` — **see the caveats** |
|
||||||
|
|
||||||
|
Not in this release, still to come: the desktop app (GPUI, with a tray icon), AmneziaWG,
|
||||||
|
WARP, Tor, the SSH tunnel, whitelist-bypass, the kill switch, server inbounds, the XRay-only
|
||||||
|
backend, zapret2's extended detection and z2k strategies.
|
||||||
|
|
||||||
|
## What has been verified
|
||||||
|
|
||||||
|
| Part | How |
|
||||||
|
|---|---|
|
||||||
|
| Share-link and subscription parsing | upstream's tests, ported; ~750 links through upstream's Python and this, identical results |
|
||||||
|
| sing-box and XRay configs | rendered for many setups and accepted by `sing-box check` and `xray run -test` |
|
||||||
|
| Service, API, `proxy-ctl` | end to end on Linux: a real sing-box Shadowsocks server, the service, `proxy-ctl` adding the outbound, a page fetched through the local proxy |
|
||||||
|
| Windows build: service, named pipe, its ACL, caller identification, component hashes, supervisor | under Wine (`tools/wine-e2e.sh`) |
|
||||||
|
| zapret arguments | **every** preset of the release, both game filters, checked by the release's own `winws.exe --dry-run` under Wine (`tools/winws-dry-run.sh`) |
|
||||||
|
| zapret2 arguments | checked by `winws2.exe --dry-run` under Wine |
|
||||||
|
| tg-ws-proxy | runs and listens under Wine |
|
||||||
|
|
||||||
|
**Not verified: anything that needs real Windows.** Traffic through sing-box on Windows (Wine
|
||||||
|
lacks an API it needs), the TUN adapter, WinDivert actually rewriting packets, the Windows
|
||||||
|
service under the Service Control Manager, `install`/`uninstall`, the system PATH change.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
1. Unzip `ProxySuite-<version>-windows-x64.zip` anywhere.
|
||||||
|
2. Run `install.cmd` (it asks for administrator rights). It copies the program to
|
||||||
|
`C:\Program Files\ProxySuite`, registers the **ProxySuite** service (starts at boot), adds
|
||||||
|
`proxy-ctl` to PATH and starts it.
|
||||||
|
3. Open a **new** terminal: `proxy-ctl status`.
|
||||||
|
|
||||||
|
To upgrade, unzip the new release and run its `install.cmd`. To remove, run `uninstall.cmd`;
|
||||||
|
the configuration and state stay in `%ProgramData%\ProxySuite` until you delete it.
|
||||||
|
|
||||||
|
Windows Defender and other antivirus software may flag WinDivert (zapret's driver): it is a
|
||||||
|
packet-filtering driver, which is what it is for. Remove other DPI-bypass tools first:
|
||||||
|
Flowseal's own `zapret` service (its `service.bat` → Remove Services) or GoodbyeDPI — the
|
||||||
|
service refuses to start zapret while one runs, and says which.
|
||||||
|
|
||||||
|
## First run
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# A proxy:
|
||||||
|
proxy-ctl proxy outbounds add "vless://...#My Server"
|
||||||
|
proxy-ctl proxy on
|
||||||
|
proxy-ctl status
|
||||||
|
# Then point apps (or Windows: Settings → Network → Proxy) at 127.0.0.1:1080.
|
||||||
|
|
||||||
|
# Or a subscription:
|
||||||
|
proxy-ctl proxy subs add https://provider.example/sub/token
|
||||||
|
|
||||||
|
# zapret, Flowseal's presets:
|
||||||
|
proxy-ctl zapret on
|
||||||
|
proxy-ctl zapret preset "general (ALT9)"
|
||||||
|
proxy-ctl zapret game-filter all
|
||||||
|
|
||||||
|
# zapret2 instead:
|
||||||
|
proxy-ctl config get > config.json # set "zapret": { "enable": true, "engine": "zapret2" }
|
||||||
|
proxy-ctl config set config.json
|
||||||
|
|
||||||
|
# Telegram's WebSocket proxy:
|
||||||
|
proxy-ctl config get > config.json # set "tgWsProxy": { "enable": true }
|
||||||
|
proxy-ctl config set config.json
|
||||||
|
proxy-ctl logs proxy-suite-tg-ws-proxy # its tg:// link and secret
|
||||||
|
|
||||||
|
proxy-ctl logs -f # everything, following
|
||||||
|
proxy-ctl --help
|
||||||
|
```
|
||||||
|
|
||||||
|
## The configuration
|
||||||
|
|
||||||
|
`proxy-ctl config get` prints it, `proxy-ctl config set <file>` replaces it (checked first; a
|
||||||
|
bad one changes nothing), `proxy-ctl config validate <file>` only checks. It is upstream's
|
||||||
|
option tree as JSON, so [upstream's option reference](../docs/options/index.md) describes it:
|
||||||
|
`services.proxy-suite.proxy.listener.port` is `{"proxy": {"listener": {"port": …}}}`.
|
||||||
|
Options that only mean something on Linux (TProxy, fwmarks, routing tables, packages) are not
|
||||||
|
there; the Windows-only ones are documented in `crates/ps-core/src/config/`:
|
||||||
|
|
||||||
|
- `proxy.singBox.testPort`; `proxy.systemProxy` (applied by the desktop app, which is not in this release)
|
||||||
|
- `proxy.routing.rules.*.processNames` / `processPaths` (and `name`, `priority`, `disabled`)
|
||||||
|
- `perAppRouting.profiles.*`: programs held to an outbound, by name or path
|
||||||
|
- `zapret.tcpTimestamps`, `geodata` as download locations, `tor.controlPort`
|
||||||
|
- inline `config` text where upstream only takes a file (AmneziaWG, WARP)
|
||||||
|
|
||||||
|
## Who may change what
|
||||||
|
|
||||||
|
The service runs as LocalSystem. Its settings are meant to be edited by whoever uses the
|
||||||
|
machine, so — **unlike upstream, where changes need root** — `userControl` defaults to on
|
||||||
|
for the signed-in user, with every scope. On a shared computer, set
|
||||||
|
`userControl.scopes` (or turn `userControl.enable` off) as an administrator.
|
||||||
|
|
||||||
|
Whatever the scopes, these always need an administrator: anything that makes the service run
|
||||||
|
a program, pass arguments to one, or read or write a file of the caller's choosing — every
|
||||||
|
`*File` option, raw `singBoxJson`/`xrayJson`, `sshProxy.extraArgs`, `tor.extraConfig`,
|
||||||
|
`nfqwsArgs`, zapret2's `profiles` and `blobs`, `allowConfigHooks`, and `userControl` itself —
|
||||||
|
and installing components. Secrets (links, passwords) are hidden from callers without the
|
||||||
|
`secrets` scope, and survive a round trip through `config get`/`config set` unchanged.
|
||||||
|
|
||||||
|
## Caveats
|
||||||
|
|
||||||
|
- **TUN and zapret together**: upstream keeps zapret's packets off the TUN interface, which
|
||||||
|
this release does not do yet. Use one or the other.
|
||||||
|
- zapret2 learns with nfqws2's own detector, not upstream's extended one; z2k's strategies are
|
||||||
|
not there yet.
|
||||||
|
- The global TUN restarts the local proxy when it is turned on or off (one sing-box does both).
|
||||||
|
|
||||||
|
## Components
|
||||||
|
|
||||||
|
The release carries every program it runs, each pinned by version and hash
|
||||||
|
([`components.json`](components.json)), and the service checks each against the hashes
|
||||||
|
recorded at install before running it. `proxy-ctl components` lists them;
|
||||||
|
`proxy-ctl components install [name…]` fetches and verifies them again (administrator).
|
||||||
|
See [`THIRD-PARTY.md`](THIRD-PARTY.md) for their licenses and sources.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
On Linux with Nix: `nix develop` here (this directory has its own `flake.nix`), then
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cargo test --workspace # everything, sing-box and xray from the shell
|
||||||
|
python3 -I tools/parity/links.py # link parsing against upstream's Python
|
||||||
|
tools/package.sh # the release zip, in dist/
|
||||||
|
nix shell nixpkgs#wineWow64Packages.stable -c tools/winws-dry-run.sh dist/ProxySuite-*/components
|
||||||
|
```
|
||||||
|
|
||||||
|
The Windows programs are cross-compiled with `cargo xwin` (MSVC target), with the toolchain
|
||||||
|
in `rust-toolchain.toml`. Design notes: [`DESIGN.md`](DESIGN.md).
|
||||||
|
|
||||||
|
Releases are built by Gitea Actions (`.gitea/workflows/windows-release.yml`): bump `version`
|
||||||
|
in `Cargo.toml`, add `release-notes/<version>.md`, push a tag `windows-v<version>`. The
|
||||||
|
workflow tests, packages and publishes the zip and its `.sha256` with the `RELEASE_TOKEN`
|
||||||
|
secret (a token with `write:repository`). Run by hand, it only builds.
|
||||||
@@ -647,6 +647,11 @@ async fn proxy(ctl: &Ctl, verb: Option<ProxyVerb>) -> Result<()> {
|
|||||||
println!("{}", if s["proxy"]["tun"] == true { "on" } else { "off" });
|
println!("{}", if s["proxy"]["tun"] == true { "on" } else { "off" });
|
||||||
}
|
}
|
||||||
OnOff::On => {
|
OnOff::On => {
|
||||||
|
ctl.edit(|c| {
|
||||||
|
c["proxy"]["tun"]["enable"] = true.into();
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
|
.await?;
|
||||||
ctl.call(Request::Start { unit: "proxy-suite-tun".into() }).await?;
|
ctl.call(Request::Start { unit: "proxy-suite-tun".into() }).await?;
|
||||||
}
|
}
|
||||||
OnOff::Off => {
|
OnOff::Off => {
|
||||||
|
|||||||
@@ -174,6 +174,17 @@ async fn connection(mut conn: Conn, shared: Shared) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
let peer = conn.peer();
|
let peer = conn.peer();
|
||||||
|
// Every request, streamed or not, is authorized here before anything is done for it.
|
||||||
|
let denied = {
|
||||||
|
let s = shared.lock().await;
|
||||||
|
allowed(s.cfg(), &peer, scope_of(&req)).err()
|
||||||
|
};
|
||||||
|
if let Some(e) = denied {
|
||||||
|
if conn.write_json(&Response::err(e)).await.is_err() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if let Request::Logs { unit, lines, follow: true } = &req {
|
if let Request::Logs { unit, lines, follow: true } = &req {
|
||||||
follow_logs(&mut conn, &shared, unit.clone(), *lines).await;
|
follow_logs(&mut conn, &shared, unit.clone(), *lines).await;
|
||||||
return;
|
return;
|
||||||
@@ -208,13 +219,8 @@ async fn follow_logs(conn: &mut Conn, shared: &Shared, unit: Option<String>, lin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Does what `req` asks; the caller has authorized it (`connection`).
|
||||||
pub async fn handle(req: Request, peer: &Peer, shared: &Shared) -> Response {
|
pub async fn handle(req: Request, peer: &Peer, shared: &Shared) -> Response {
|
||||||
{
|
|
||||||
let s = shared.lock().await;
|
|
||||||
if let Err(e) = allowed(s.cfg(), peer, scope_of(&req)) {
|
|
||||||
return Response::err(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
match req {
|
match req {
|
||||||
Request::Status => Response::ok(shared.lock().await.status()),
|
Request::Status => Response::ok(shared.lock().await.status()),
|
||||||
|
|
||||||
@@ -525,6 +531,12 @@ mod tests {
|
|||||||
assert_eq!(back.proxy.listener.auth.password.as_deref(), Some("pw"));
|
assert_eq!(back.proxy.listener.auth.password.as_deref(), Some("pw"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn following_logs_needs_the_secrets_scope_too() {
|
||||||
|
assert_eq!(scope_of(&Request::Logs { unit: None, lines: 10, follow: true }), Some(Scope::Secrets));
|
||||||
|
assert_eq!(scope_of(&Request::Logs { unit: None, lines: 10, follow: false }), Some(Scope::Secrets));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn scopes_follow_user_control() {
|
fn scopes_follow_user_control() {
|
||||||
let mut cfg = Config::default();
|
let mut cfg = Config::default();
|
||||||
|
|||||||
@@ -71,10 +71,20 @@ impl Paths {
|
|||||||
/// lets anyone else in is moved aside, never adopted: ProgramData lets any user make
|
/// lets anyone else in is moved aside, never adopted: ProgramData lets any user make
|
||||||
/// folders, and the service runs what is under `bin\` as SYSTEM.
|
/// folders, and the service runs what is under `bin\` as SYSTEM.
|
||||||
pub fn create_all(&self) -> std::io::Result<()> {
|
pub fn create_all(&self) -> std::io::Result<()> {
|
||||||
|
// Once per process: a second check of a root this process made (and may be writing
|
||||||
|
// its log into) has nothing to learn, and moving it aside then would lose the log.
|
||||||
|
// Only a check that passed counts: a failed one is made again, and fails again.
|
||||||
|
static CHECKED: std::sync::Mutex<Vec<PathBuf>> = std::sync::Mutex::new(Vec::new());
|
||||||
|
{
|
||||||
|
let mut checked = CHECKED.lock().unwrap_or_else(|e| e.into_inner());
|
||||||
|
if !checked.contains(&self.root) {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
secure::ensure_root(&self.root)?;
|
secure::ensure_root(&self.root)?;
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
std::fs::create_dir_all(&self.root)?;
|
std::fs::create_dir_all(&self.root)?;
|
||||||
|
checked.push(self.root.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
for dir in [self.subscriptions(), self.rule_sets(), self.cache(), self.run(), self.logs(), self.bin()] {
|
for dir in [self.subscriptions(), self.rule_sets(), self.cache(), self.run(), self.logs(), self.bin()] {
|
||||||
std::fs::create_dir_all(dir)?;
|
std::fs::create_dir_all(dir)?;
|
||||||
}
|
}
|
||||||
@@ -344,3 +354,24 @@ mod secure {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_failed_check_is_made_again() {
|
||||||
|
let dir = std::env::temp_dir().join(format!("ps-paths-test-{}", std::process::id()));
|
||||||
|
std::fs::create_dir_all(&dir).unwrap();
|
||||||
|
// A root that cannot be made: the first call fails, and so must every later one.
|
||||||
|
let root = dir.join("root");
|
||||||
|
std::fs::write(&root, b"").unwrap();
|
||||||
|
let paths = Paths::new(&root);
|
||||||
|
assert!(paths.create_all().is_err());
|
||||||
|
assert!(paths.create_all().is_err());
|
||||||
|
std::fs::remove_file(&root).unwrap();
|
||||||
|
paths.create_all().unwrap();
|
||||||
|
assert!(paths.bin().is_dir());
|
||||||
|
std::fs::remove_dir_all(&dir).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,7 +25,7 @@ pub fn install_dir() -> PathBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The files of a release that `install` copies.
|
/// The files of a release that `install` copies.
|
||||||
const RELEASE_FILES: [&str; 5] = ["proxy-suite-service.exe", "proxy-ctl.exe", "README.md", "THIRD-PARTY.md", "LICENSE"];
|
const RELEASE_FILES: [&str; 7] = ["proxy-suite-service.exe", "proxy-ctl.exe", "README.md", "THIRD-PARTY.md", "LICENSE", "install.cmd", "uninstall.cmd"];
|
||||||
|
|
||||||
fn copy_release(from: &Path, to: &Path) -> Result<()> {
|
fn copy_release(from: &Path, to: &Path) -> Result<()> {
|
||||||
std::fs::create_dir_all(to)?;
|
std::fs::create_dir_all(to)?;
|
||||||
@@ -124,8 +124,16 @@ pub fn install() -> Result<()> {
|
|||||||
if let Err(e) = path::add(&to) {
|
if let Err(e) = path::add(&to) {
|
||||||
println!("warning: could not add {} to PATH: {e:#}", to.display());
|
println!("warning: could not add {} to PATH: {e:#}", to.display());
|
||||||
}
|
}
|
||||||
service.start::<&str>(&[]).context("starting the service")?;
|
// A moment for the manager to settle the change just made (Wine's otherwise answers
|
||||||
println!("{DISPLAY} is installed in {} and started.", to.display());
|
// ERROR_SERVICE_DATABASE_LOCKED); a start that still fails leaves a working install.
|
||||||
|
std::thread::sleep(Duration::from_secs(1));
|
||||||
|
match service.start::<&str>(&[]) {
|
||||||
|
Ok(()) => println!("{DISPLAY} is installed in {} and started.", to.display()),
|
||||||
|
Err(e) => {
|
||||||
|
println!("{DISPLAY} is installed in {}, but did not start: {e}", to.display());
|
||||||
|
println!("Start it with: sc start {NAME} (its log: %ProgramData%\\ProxySuite\\logs\\service.log)");
|
||||||
|
}
|
||||||
|
}
|
||||||
println!("Open a new terminal and try: proxy-ctl status");
|
println!("Open a new terminal and try: proxy-ctl status");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -148,10 +156,17 @@ pub fn uninstall() -> Result<()> {
|
|||||||
let dir = install_dir();
|
let dir = install_dir();
|
||||||
let _ = path::remove(&dir);
|
let _ = path::remove(&dir);
|
||||||
if dir.exists() {
|
if dir.exists() {
|
||||||
// This program may be one of the files: they go a moment after it exits.
|
// This program may be one of the files: they go a moment after it exits. Raw, as cmd
|
||||||
|
// does its own quote parsing; from outside the folder, which a working directory holds.
|
||||||
|
use std::os::windows::process::CommandExt;
|
||||||
|
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
|
||||||
let _ = std::process::Command::new("cmd")
|
let _ = std::process::Command::new("cmd")
|
||||||
.args(["/c", "ping -n 3 127.0.0.1 >nul & rmdir /s /q"])
|
.raw_arg(format!("/c ping -n 3 127.0.0.1 >nul & rmdir /s /q \"{}\"", dir.display()))
|
||||||
.arg(&dir)
|
.current_dir(std::env::var_os("SystemRoot").unwrap_or_else(|| "C:\\Windows".into()))
|
||||||
|
.creation_flags(CREATE_NO_WINDOW)
|
||||||
|
.stdin(std::process::Stdio::null())
|
||||||
|
.stdout(std::process::Stdio::null())
|
||||||
|
.stderr(std::process::Stdio::null())
|
||||||
.spawn();
|
.spawn();
|
||||||
println!("Removing {}.", dir.display());
|
println!("Removing {}.", dir.display());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,11 @@
|
|||||||
xray
|
xray
|
||||||
python3
|
python3
|
||||||
jq
|
jq
|
||||||
|
zip
|
||||||
|
unzip
|
||||||
|
curl
|
||||||
|
git
|
||||||
|
python3Packages.pip
|
||||||
];
|
];
|
||||||
buildInputs = guiLibs;
|
buildInputs = guiLibs;
|
||||||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath guiLibs;
|
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath guiLibs;
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
First pre-release of the native Windows port of proxy-suite-flake: a Windows service with `proxy-ctl`, no GUI yet. It replaces 0.1.0-pre.1, which never had a build, and fixes a local privilege escalation found in it: the service could go on with a state folder it had failed to secure.
|
||||||
|
|
||||||
|
**This build has never run on real Windows.** It was built and tested on Linux and under Wine. See "What has been verified" in the README, and please report what happens on yours.
|
||||||
|
|
||||||
|
### In this release
|
||||||
|
- **Local proxy:** SOCKS5/HTTP on `127.0.0.1:1080` through sing-box 1.14.4, or the hybrid sing-box + XRay 26.10.21 backend.
|
||||||
|
- **Outbounds:**
|
||||||
|
- Links of every kind upstream parses, plus raw JSON and subscriptions.
|
||||||
|
- Groups (failover, urltest, selector), chains, pins and route modes.
|
||||||
|
- Routing rules by site, address, geodata, rule set or **program**.
|
||||||
|
- **zapret:** Flowseal's zapret-discord-youtube 1.10.4 (`winws.exe` with WinDivert), with any `general*.bat` preset, your lists and the game filter.
|
||||||
|
- **zapret2:** `winws2.exe` from bol-van's zapret-win-bundle, with nfqws2-keenetic's strategies and nfqws2's own learning of blocked sites.
|
||||||
|
- **tg-ws-proxy:** Flowseal's tg-ws-proxy 1.11.2 on a bundled Python 3.12.
|
||||||
|
- **TUN:** sing-box's TUN (wintun). Don't use it together with zapret yet.
|
||||||
|
|
||||||
|
Every bundled program is pinned by version and hash, and checked before it runs.
|
||||||
|
|
||||||
|
### Install
|
||||||
|
Download `ProxySuite-0.1.0-pre.2-windows-x64.zip`; its SHA-256 is in the `.sha256` file next to it.
|
||||||
|
|
||||||
|
1. Unzip.
|
||||||
|
2. Run `install.cmd` as administrator. It copies to `C:\Program Files\ProxySuite`, registers the **ProxySuite** service and adds `proxy-ctl` to PATH.
|
||||||
|
3. In a new terminal, run `proxy-ctl status`.
|
||||||
|
|
||||||
|
### Not yet
|
||||||
|
The desktop app (GPUI, tray), AmneziaWG, WARP, Tor, the SSH tunnel, whitelist-bypass, the kill switch, server inbounds, the XRay-only backend, zapret2's extended detection and the z2k strategies.
|
||||||
|
|
||||||
|
### Note
|
||||||
|
Unlike upstream, the signed-in user may change every setting by default (`userControl`), except the ones that could run programs or read files as SYSTEM: those always need an administrator. On a shared computer, restrict `userControl.scopes`.
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# The toolchain the releases are built with, here and in .gitea/workflows/windows-release.yml.
|
||||||
|
[toolchain]
|
||||||
|
channel = "1.99.1"
|
||||||
|
profile = "minimal"
|
||||||
|
components = ["clippy", "rustfmt"]
|
||||||
|
targets = ["x86_64-pc-windows-msvc"]
|
||||||
@@ -5,8 +5,8 @@
|
|||||||
#
|
#
|
||||||
# tools/build-tg-ws-proxy.sh OUT_DIR (needs curl, git, unzip, pip)
|
# tools/build-tg-ws-proxy.sh OUT_DIR (needs curl, git, unzip, pip)
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
OUT=$(realpath -m "${1:?output directory}")
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
OUT=${1:?output directory}
|
|
||||||
PY_VERSION=3.12.10
|
PY_VERSION=3.12.10
|
||||||
PY_URL=https://www.python.org/ftp/python/$PY_VERSION/python-$PY_VERSION-embed-amd64.zip
|
PY_URL=https://www.python.org/ftp/python/$PY_VERSION/python-$PY_VERSION-embed-amd64.zip
|
||||||
PY_SHA256=4acbed6dd1c744b0376e3b1cf57ce906f9dc9e95e68824584c8099a63025a3c3
|
PY_SHA256=4acbed6dd1c744b0376e3b1cf57ce906f9dc9e95e68824584c8099a63025a3c3
|
||||||
@@ -25,7 +25,7 @@ pip download -q --require-hashes --no-deps --only-binary=:all: --platform win_am
|
|||||||
mkdir -p "$OUT/python/Lib/site-packages"
|
mkdir -p "$OUT/python/Lib/site-packages"
|
||||||
for w in "$WORK"/wheels/*.whl; do unzip -q -o "$w" -d "$OUT/python/Lib/site-packages"; done
|
for w in "$WORK"/wheels/*.whl; do unzip -q -o "$w" -d "$OUT/python/Lib/site-packages"; done
|
||||||
|
|
||||||
git clone -q --depth 1 --branch "$TG_TAG" https://github.com/Flowseal/tg-ws-proxy "$WORK/src"
|
git -c advice.detachedHead=false clone -q --depth 1 --branch "$TG_TAG" https://github.com/Flowseal/tg-ws-proxy "$WORK/src"
|
||||||
[ "$(git -C "$WORK/src" rev-parse HEAD)" = "$TG_COMMIT" ] || { echo "tag $TG_TAG moved off $TG_COMMIT"; exit 1; }
|
[ "$(git -C "$WORK/src" rev-parse HEAD)" = "$TG_COMMIT" ] || { echo "tag $TG_TAG moved off $TG_COMMIT"; exit 1; }
|
||||||
cp -r "$WORK/src/proxy" "$WORK/src/utils" "$WORK/src/LICENSE" "$OUT/app/"
|
cp -r "$WORK/src/proxy" "$WORK/src/utils" "$WORK/src/LICENSE" "$OUT/app/"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@echo off
|
||||||
|
:: Proxy Suite: install, or upgrade, as an administrator. Copies the program into
|
||||||
|
:: %ProgramFiles%\ProxySuite, registers the service there and starts it.
|
||||||
|
net session >nul 2>&1 || (
|
||||||
|
powershell -NoProfile -Command "Start-Process -Verb RunAs -FilePath '%~f0'"
|
||||||
|
exit /b
|
||||||
|
)
|
||||||
|
"%~dp0proxy-suite-service.exe" install
|
||||||
|
pause
|
||||||
Executable
+58
@@ -0,0 +1,58 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# The release: ProxySuite-<version>-windows-x64.zip in dist/, with the programs, every
|
||||||
|
# component (fetched and verified), the install scripts, the README and the licenses.
|
||||||
|
#
|
||||||
|
# nix develop --command tools/package.sh (needs curl, git, unzip, zip, pip)
|
||||||
|
set -euo pipefail
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
|
||||||
|
NAME=ProxySuite-$VERSION-windows-x64
|
||||||
|
DIST=dist/$NAME
|
||||||
|
CACHE=${CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/proxy-suite-windows}
|
||||||
|
rm -rf "$DIST" "dist/$NAME.zip"
|
||||||
|
mkdir -p "$DIST/components"
|
||||||
|
|
||||||
|
echo "== components"
|
||||||
|
tools/build-tg-ws-proxy.sh "$DIST/components/tg-ws-proxy"
|
||||||
|
cargo build -q --release -p ps-service
|
||||||
|
target/release/proxy-suite-service stage-components --to "$DIST/components" --cache "$CACHE"
|
||||||
|
rm -rf "$DIST"/components/*.old "$DIST"/components/*.staging
|
||||||
|
|
||||||
|
echo "== programs"
|
||||||
|
cargo xwin build -q --release -p ps-service -p ps-ctl --target x86_64-pc-windows-msvc
|
||||||
|
cp target/x86_64-pc-windows-msvc/release/proxy-suite-service.exe target/x86_64-pc-windows-msvc/release/proxy-ctl.exe "$DIST/"
|
||||||
|
cp ../LICENSE README.md "$DIST/"
|
||||||
|
cp tools/install.cmd tools/uninstall.cmd "$DIST/"
|
||||||
|
|
||||||
|
echo "== THIRD-PARTY.md"
|
||||||
|
{
|
||||||
|
echo "# Third-party components"
|
||||||
|
echo
|
||||||
|
echo "Proxy Suite for Windows ($VERSION) is MIT-licensed (LICENSE). It carries, unchanged, the"
|
||||||
|
echo "programs below, each from its project's own release, pinned by version and hash in"
|
||||||
|
echo "components.json. Their licenses are theirs; where a license asks for its source, it is at"
|
||||||
|
echo "the address given."
|
||||||
|
echo
|
||||||
|
echo "| Component | Version | License | Source |"
|
||||||
|
echo "|---|---|---|---|"
|
||||||
|
jq -r '.components | to_entries[] | "| \(.key) | \(.value.version) | \(.value.license) | \(.value.homepage) |"' components.json
|
||||||
|
echo
|
||||||
|
echo "Inside them:"
|
||||||
|
echo
|
||||||
|
echo "- **WinDivert** (zapret, zapret2): LGPL-3.0 or GPL-2.0, https://github.com/basil00/WinDivert"
|
||||||
|
echo "- **cygwin1.dll** (zapret, zapret2): LGPL-3.0, https://cygwin.com"
|
||||||
|
echo "- **zapret2** (winws2.exe, its Lua) and **nfqws2-keenetic** (its strategies, lists, blobs): MIT, https://github.com/bol-van/zapret2, https://github.com/nfqws/nfqws2-keenetic"
|
||||||
|
echo "- **wintun** (inside sing-box): WireGuard's prebuilt-binary license, https://www.wintun.net"
|
||||||
|
echo "- **CPython $( sed 's/.*+py//' "$DIST/components/tg-ws-proxy/.version" )** (tg-ws-proxy): PSF License, https://www.python.org"
|
||||||
|
echo "- **Python packages** (tg-ws-proxy):"
|
||||||
|
sed -n 's/^\([A-Za-z0-9_.-]*\)==\([^ ]*\) .*/ - \1 \2, https:\/\/pypi.org\/project\/\1\/\2\//p' tools/tg-ws-proxy-requirements.txt
|
||||||
|
echo
|
||||||
|
echo "License files that came with them:"
|
||||||
|
echo
|
||||||
|
(cd "$DIST" && find components -iname 'LICENSE*' -o -iname 'COPYING*' | sort | sed 's/^/- /')
|
||||||
|
} > "$DIST/THIRD-PARTY.md"
|
||||||
|
|
||||||
|
echo "== zip"
|
||||||
|
(cd dist && zip -qr "$NAME.zip" "$NAME")
|
||||||
|
(cd dist && sha256sum "$NAME.zip" | tee "$NAME.zip.sha256")
|
||||||
|
du -h "dist/$NAME.zip"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@echo off
|
||||||
|
:: Proxy Suite: remove the service and the program. The configuration and state stay in
|
||||||
|
:: %ProgramData%\ProxySuite.
|
||||||
|
net session >nul 2>&1 || (
|
||||||
|
powershell -NoProfile -Command "Start-Process -Verb RunAs -FilePath '%~f0'"
|
||||||
|
exit /b
|
||||||
|
)
|
||||||
|
:: One line: cmd reads a batch file line by line, and this one is deleted meanwhile.
|
||||||
|
"%~dp0proxy-suite-service.exe" uninstall & pause & exit /b
|
||||||
Executable
+38
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# The release's install and uninstall, under Wine's Service Control Manager: copied into
|
||||||
|
# Program Files, registered, started, reachable over its pipe, removed.
|
||||||
|
#
|
||||||
|
# nix shell nixpkgs#wineWow64Packages.stable -c tools/wine-install-test.sh dist/ProxySuite-<version>-windows-x64
|
||||||
|
set -euo pipefail
|
||||||
|
REL=$(realpath "${1:?the unpacked release directory}")
|
||||||
|
WORK=$(mktemp -d)
|
||||||
|
export WINEPREFIX=${WINEPREFIX:-$WORK/prefix} WINEDEBUG=-all
|
||||||
|
trap 'wineserver -k 2>/dev/null || true; rm -rf "$WORK"' EXIT
|
||||||
|
wineboot -i >/dev/null 2>&1 || true
|
||||||
|
for key in Tcpip Tcpip6; do
|
||||||
|
wine reg add "HKLM\\SYSTEM\\CurrentControlSet\\Services\\$key\\Parameters\\Interfaces" /f >/dev/null 2>&1
|
||||||
|
done
|
||||||
|
cd "$REL"
|
||||||
|
echo "== install"
|
||||||
|
wine ./proxy-suite-service.exe install
|
||||||
|
PF="$WINEPREFIX/drive_c/Program Files/ProxySuite"
|
||||||
|
ls "$PF" | sed 's/^/ /'
|
||||||
|
# Wine's manager often fails the first start right after a create (real Windows does not),
|
||||||
|
# holding the service in a start that times out after ~50 s: install says so; once that is
|
||||||
|
# over, a second start works.
|
||||||
|
for _ in $(seq 40); do
|
||||||
|
st=$(wine sc query ProxySuite 2>/dev/null || true)
|
||||||
|
st=${st//$'\r'/}
|
||||||
|
echo " $(grep STATE <<<"$st" | grep -o '[A-Z_]*$' || true)"
|
||||||
|
grep -q RUNNING <<<"$st" && break
|
||||||
|
grep -q STOPPED <<<"$st" && { wine sc start ProxySuite >/dev/null 2>&1 || true; }
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
echo "== status over the pipe"
|
||||||
|
for _ in $(seq 30); do wine "$PF/proxy-ctl.exe" status 2>/dev/null && break; sleep 1; done
|
||||||
|
wine "$PF/proxy-ctl.exe" components || {
|
||||||
|
echo "== service log"; tail -30 "$WINEPREFIX/drive_c/ProgramData/ProxySuite/logs/service.log"; exit 1; }
|
||||||
|
echo "== uninstall"
|
||||||
|
wine "$PF/proxy-suite-service.exe" uninstall
|
||||||
|
sleep 5
|
||||||
|
[ ! -e "$PF/proxy-suite-service.exe" ] && echo "program files removed" || echo "program files still there"
|
||||||
Reference in new issue
Block a user