Commit Graph

11 Commits

Author SHA1 Message Date
winlin
d179ddac8f Proxy: Bump to v7.0.145 for #4667.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 07:04:39 -04:00
winlin
6406ad23b0 Proxy: Switch internal/logger to slog JSON output and add unit tests.
Replaces the stdlib log.Logger with log/slog JSON handlers (UTC timestamps,
semantic level labels via custom slog.Level values), hides withContextID
since it has no external callers, and adds unit tests reaching 100%
statement coverage for the package.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 20:45:38 -04:00
winlin
98d09138b8 Proxy: Add test seams and unit tests for internal/signal.
Introduce signalNotify and osExit indirections so InstallSignals and
InstallForceQuit can be exercised without real OS signal delivery or
process termination. Coverage is 100% in isolation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 20:11:36 -04:00
winlin
43576e6036 Proxy: Add unit tests for internal/version with 100% coverage.
Cover all five version helpers (VersionMajor, VersionMinor,
VersionRevision, Version, Signature). The revision assertion checks
that the value is positive rather than pinning an exact number so the
test survives future version bumps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 20:03:25 -04:00
winlin
aed4a6ffc3 Proxy: Modernize internal/utils imports and add unit tests.
Drop the deprecated io/ioutil and the stdlib errors alias — the internal
errors package already re-exports Is, As, Unwrap, and Join, so callers
can keep a single import. Add a utils_test.go covering every exported
helper (API response/error/CORS, ParseBody, BuildStreamURL, peer/closed
network classifiers, URL→stream conversion, RTC/SRT packet sniffers,
ICE/SRT parsers, and ParseListenEndpoint) for 96.3% statement coverage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 19:59:48 -04:00
winlin
a387fb6369 Proxy: Convert internal/sync.Map to an interface and add unit tests.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 19:48:54 -04:00
winlin
f7f0676c9e Proxy: Rewrite internal/errors on stdlib with a single withStack struct.
Replaces the pkg/errors fork with a thin wrapper over the standard
library's errors package. A single withStack struct captures stack
traces via runtime.Callers, while fmt.Errorf("%w", ...) handles all
message wrapping. This enables errors.Is/As/Unwrap chain traversal
(the fork silently broke them) and deletes ~190 lines of stack/frame
formatting code. Adds table-driven tests at 100% statement coverage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 18:36:59 -04:00
Winlin
cd11a6720f
Proxy: Harden internal/env tests and add counterfeiter fakes. v7.0.144 (#4665)
- **Refactor `internal/env` for testability.** Route every
`os`/filesystem
  call in `env.go` through swappable package-level function variables
(`getEnv`, `setEnv`, `lookupEnv`, `openFile`). Split `parseEnvFile` into
a
thin file-opening wrapper plus a pure `parseEnvReader(io.Reader)` so the
  parser can be tested directly without touching disk.
- **Hermetic tests, 96.9% coverage.** Rewrite `internal/env/env_test.go`
to
install in-memory fakes via `withFakeEnv` / `withFakeOpen` helpers that
  swap the package vars and restore them on `t.Cleanup`. Tests no longer
mutate real process env or write temp `.env` files, removing a source of
flakiness under parallel test execution. New cases cover
`NewEnvironment`,
`setEnvDefault`, `loadEnvFile` error paths, and edge cases in the
parser.
- **Counterfeiter-based fake generation.** Add `counterfeiter` as a Go
tool
dependency, a `//go:generate` directive for the `Environment` interface
  (`internal/env/gen.go`), and commit the generated
  `internal/env/envfakes/fake_environment.go` so downstream packages can
test against a spec-faithful fake instead of hand-rolling stubs. Expose
  the step as `make generate`.
- **Tooling.** `scripts/proxy-utest.sh` gains a `--coverage` / `-c` flag
  that runs `go test -coverprofile=...` across `./cmd/...` and
  `./internal/...` and prints per-function coverage via `go tool cover
  -func`. The `srs-develop` skill doc is updated to include the
  regenerate-fakes step and the new coverage flag.
- **Go version.** Bump `go.mod` to Go 1.25 (required for the `go tool`
  directive used to pin the counterfeiter CLI as a tool dep).

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 20:33:07 -04:00
Winlin
460412c4b5
Move build output to bin/, replace godotenv with custom .env parser, and update docs. v7.0.143 (#4661)
- Move build output from `./srs-proxy` to `bin/srs-proxy` following Go
project conventions, updating Makefile, .gitignore, and all
documentation references
- Replace third-party `godotenv` dependency with a custom `.env` parser
that supports comments, `export` prefix, quoted values, escape
sequences, and inline comments — with full unit tests
- Remove `ignore-worklog.md` and update `README.md` with skill-based AI
prompts
- Bump copyright year from 2025 to 2026 across all source files

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 14:26:33 -04:00
Winlin
7c17c93b70
Refactor bootstrap for multi-server support and add srs-develop skill. v7.0.142 (#4657)
Summary
- Extract proxy bootstrap implementation from bootstrap.go into
internal/bootstrap/proxy.go, keeping only the Bootstrap interface in the
shared file. This prepares for origin/edge servers
  to have their own bootstrap implementations.
- Rename NewBootstrap() → NewProxyBootstrap() to follow the explicit
factory naming convention.
- Rebrand signature from SRSProxy to SRSX and update logger context key
accordingly.
- Add srs-develop skill with task router, module routing workflow, proxy
unit test script, and RTMP E2E test script.
- Remove st-develop skill (superseded by srs-develop).
- Add srs-support eval #21 for HLS AnnexB decode error scenario.
Test plan
- go build ./cmd/proxy/... compiles successfully
  - go test ./cmd/... ./internal/... passes
- E2E RTMP proxy test (proxy-e2e-test.sh) passes
  - Verify proxy starts and logs SRSX-Proxy/<version> started

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 08:28:00 -04:00
Winlin
ebf8b712c9 Proxy: restructure repo as Go project with proxy as first module (#4652)
Reorganize the SRS (Simple Realtime Server) repository to
follow a conventional Go project structure, setting the stage for a
progressive transition from a C++ project to a Go project. The proxy,
which was once contained within its own `proxy/` subdirectory, will now
be converted into the initial Go module located at the root of the
repository, serving as a template for subsequent Go modules.

- **Go module at repo root:** `go.mod` moved to repo root, module
renamed from `proxy` to `srsx`. The repo is now a proper Go project with
`cmd/` and `internal/` at the top level.
- **Elevation of Proxy Code:** Move the proxy code from
`proxy/cmd/proxy-go/` to `cmd/proxy/`, and from `proxy/internal/` to
`internal/`. The proxy serves as the inaugural application; subsequent
modules (for instance, `cmd/origin`) will mimic this arrangement.
- **Documentation Restructured:** Transfer the documentation from
`proxy/docs/` to `docs/proxy/`, revise the main README to endorse
OpenClaw as the preferred AI tool, and update `proxy/README.md` to point
to the new documentation locations.
- **Build and config:** `Makefile` moved to root, `PROXY_STATIC_FILES`
default path corrected for the new layout, `.gitignore` consolidated.
- **Cleanup:** removed standalone `proxy/LICENSE` (repo-level license
applies), all internal imports updated to `srsx/internal/...`.
- **OpenClaw workspace:** added community bot info, git workflow
conventions, and support group behavior guidance.

This restructuring was performed by OpenClaw orchestrating Claude Code
and Codex via ACP.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
2026-03-22 08:11:28 -04:00