windows: the service names zapret's presets and tg-ws-proxy's links

- zapret-presets: the presets of the installed zapret release and the one
  configured; proxy-ctl zapret presets.
- tg-links: tg-ws-proxy's tg:// links (dd, and ee with a fake-TLS
  domain), as it prints them; they carry its secret, so the secrets scope.
  proxy-ctl tg link. No more reading them out of its log.
- tools/dev-service.sh: the service on Linux with a demo outbound, for
  working on the app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 5.5 committed 2026-10-27 01:18:59 +03:00
1 parent 4ae30dac3c
commit 63aede0dc1
5 files changed
+136 -1

No files matched your search

+30
View File
@@ -49,6 +49,11 @@ enum Cmd {
#[command(subcommand)]
verb: Option<ZapretVerb>,
},
/// Telegram's WebSocket proxy (tg-ws-proxy).
Tg {
#[command(subcommand)]
verb: TgVerb,
},
/// The backend programs: what is installed, and installing them (administrator).
Components {
#[command(subcommand)]
@@ -56,11 +61,19 @@ enum Cmd {
},
}
#[derive(Subcommand)]
enum TgVerb {
/// Its tg:// links, to open in Telegram.
Link,
}
#[derive(Subcommand)]
enum ZapretVerb {
Status,
On,
Off,
/// The presets of the installed release; the one in use is marked.
Presets,
/// Use this preset (zapret-discord-youtube), e.g. "general (ALT9)".
Preset { name: String },
/// Which game traffic to handle: all, tcp, udp or null.
@@ -509,6 +522,17 @@ async fn zapret(ctl: &Ctl, verb: Option<ZapretVerb>) -> Result<()> {
})
.await?;
}
ZapretVerb::Presets => {
let r = ctl.call(Request::ZapretPresets).await?;
if ctl.json {
ctl.print(&r);
return Ok(());
}
let current = r["current"].as_str().unwrap_or("");
for p in r["presets"].as_array().into_iter().flatten().filter_map(Value::as_str) {
println!("{} {p}", if p == current { "*" } else { " " });
}
}
ZapretVerb::Preset { name } => {
ctl.edit(|c| {
edits::set_zapret_preset(c, &name);
@@ -577,6 +601,12 @@ async fn real_main() -> Result<()> {
Cmd::Proxy(p) => proxy(&ctl, p.verb).await?,
Cmd::Zapret { verb } => zapret(&ctl, verb).await?,
Cmd::Components { verb } => components(&ctl, verb).await?,
Cmd::Tg { verb: TgVerb::Link } => {
let r = ctl.call(Request::TgLinks).await?;
for l in r["links"].as_array().into_iter().flatten().filter_map(Value::as_str) {
println!("{l}");
}
}
Cmd::Config { verb } => match verb {
ConfigVerb::Get => {
let c = ctl.call(Request::ConfigGet).await?;