Files
zapret-autotune/cmd/zapret-autotune/main.go
T
2026-10-09 20:59:51 +03:00

77 lines
2.7 KiB
Go

package main
import (
"fmt"
"io"
"os"
)
const usage = `Usage: zapret-autotune <command>
Commands:
status Show skeleton capabilities (not live service health)
discover youtube Refuse discovery until provider/config is agreed
check youtube Refuse checks until probe URLs/video IDs are configured and agreed
tune youtube Test youtube.com frontend only; print options without applying
render <json-file> Select normalized offline results and print NFQWS2_OPT
`
func main() {
os.Exit(run(os.Args[1:], os.Stdout, os.Stderr))
}
func run(args []string, stdout, stderr io.Writer) int {
if len(args) == 2 && args[0] == "tune" && args[1] == "youtube" {
return tuneYoutube(stdout, stderr, runBlockcheck)
}
if len(args) == 2 && args[0] == "render" {
file, err := os.Open(args[1])
if err != nil {
fmt.Fprintln(stderr, "error: cannot open results:", err)
return 1
}
defer file.Close()
output, err := renderResults(file)
if err != nil {
fmt.Fprintln(stderr, "error: cannot render results:", err)
return 1
}
if _, err := fmt.Fprintln(stdout, output); err != nil {
fmt.Fprintln(stderr, "error: cannot write results:", err)
return 1
}
return 0
}
if len(args) == 1 {
switch args[0] {
case "status":
_, err := fmt.Fprintln(stdout, `Status: no network requests, subprocesses, or production changes made by this command.
Tune: youtube.com frontend only via blockcheckw; apply: BLOCKED. Isolation, route/probe equivalence, version compatibility, and non-disruptive activation are unconfirmed.
Discovery: unavailable; YouTube provider/config is not implemented.
Production ss-zapret2 and Xray health: NOT CHECKED.`)
if err != nil {
fmt.Fprintln(stderr, "error: cannot write status:", err)
return 1
}
return 0
case "help", "--help", "-h":
if _, err := fmt.Fprint(stdout, usage); err != nil {
fmt.Fprintln(stderr, "error: cannot write usage:", err)
return 1
}
return 0
}
}
if len(args) == 2 && args[0] == "discover" && args[1] == "youtube" {
fmt.Fprintln(stderr, "error: discover youtube is unavailable: YouTube provider/config is not implemented; probe URLs/video IDs and API credentials/cookie requirements have not been configured or agreed. No network requests were made; no endpoints were generated.")
return 1
}
if len(args) == 2 && args[0] == "check" && args[1] == "youtube" {
fmt.Fprintln(stderr, "error: check youtube is unavailable: YouTube probe URLs/video IDs have not been configured or agreed. No network requests were made; production health was not checked.")
return 1
}
fmt.Fprintln(stderr, "error: missing, unknown, or unsupported command/arguments")
fmt.Fprint(stderr, usage)
return 2
}