From ebf8b712c96e01dcd334a0b08f0ed04b1a8ab3f1 Mon Sep 17 00:00:00 2001 From: Winlin Date: Sun, 22 Mar 2026 07:54:25 -0400 Subject: [PATCH] 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 Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> --- .gitignore | 5 ++++ .kiro/skills | 1 + .vscode/launch.json | 4 ++-- proxy/Makefile => Makefile | 10 ++++---- {proxy/cmd/proxy-go => cmd/proxy}/main.go | 2 +- docs/proxy/README.md | 23 +++++++++++++++++++ docs/proxy/ignore-worklog.md | 7 ++++++ {proxy/docs => docs/proxy}/proxy-design.md | 2 +- {proxy/docs => docs/proxy}/proxy-files.md | 2 +- .../proxy}/proxy-load-balancer.md | 3 +-- .../proxy}/proxy-origin-cluster.md | 0 {proxy/docs => docs/proxy}/proxy-protocol.md | 0 {proxy/docs => docs/proxy}/proxy-usage.md | 0 proxy/go.mod => go.mod | 10 ++++---- proxy/go.sum => go.sum | 9 ++++++++ .../bootstrap/bootstrap.go | 16 ++++++------- {proxy/internal => internal}/debug/pprof.go | 4 ++-- {proxy/internal => internal}/env/env.go | 6 ++--- {proxy/internal => internal}/errors/errors.go | 0 {proxy/internal => internal}/errors/stack.go | 0 {proxy/internal => internal}/lb/debug.go | 4 ++-- {proxy/internal => internal}/lb/lb.go | 0 {proxy/internal => internal}/lb/mem.go | 8 +++---- {proxy/internal => internal}/lb/redis.go | 6 ++--- .../internal => internal}/logger/context.go | 0 {proxy/internal => internal}/logger/log.go | 0 {proxy/internal => internal}/protocol/api.go | 12 +++++----- {proxy/internal => internal}/protocol/http.go | 12 +++++----- {proxy/internal => internal}/protocol/rtc.go | 12 +++++----- {proxy/internal => internal}/protocol/rtmp.go | 14 +++++------ {proxy/internal => internal}/protocol/srt.go | 12 +++++----- {proxy/internal => internal}/rtmp/amf0.go | 2 +- {proxy/internal => internal}/rtmp/rtmp.go | 2 +- {proxy/internal => internal}/signal/signal.go | 6 ++--- {proxy/internal => internal}/sync/map.go | 0 {proxy/internal => internal}/utils/utils.go | 6 ++--- .../internal => internal}/version/version.go | 0 openclaw/.gitignore | 3 ++- openclaw/AGENTS.md | 1 + openclaw/MEMORY.md | 19 ++++++++++++++- openclaw/TOOLS.md | 17 ++++++++++++++ proxy/.gitignore | 10 -------- proxy/LICENSE | 21 ----------------- proxy/README.md | 22 +----------------- trunk/doc/CHANGELOG.md | 1 + trunk/src/core/srs_core_version7.hpp | 2 +- 46 files changed, 164 insertions(+), 132 deletions(-) create mode 120000 .kiro/skills rename proxy/Makefile => Makefile (50%) rename {proxy/cmd/proxy-go => cmd/proxy}/main.go (89%) create mode 100644 docs/proxy/README.md create mode 100644 docs/proxy/ignore-worklog.md rename {proxy/docs => docs/proxy}/proxy-design.md (92%) rename {proxy/docs => docs/proxy}/proxy-files.md (99%) rename {proxy/docs => docs/proxy}/proxy-load-balancer.md (97%) rename {proxy/docs => docs/proxy}/proxy-origin-cluster.md (100%) rename {proxy/docs => docs/proxy}/proxy-protocol.md (100%) rename {proxy/docs => docs/proxy}/proxy-usage.md (100%) rename proxy/go.mod => go.mod (56%) rename proxy/go.sum => go.sum (64%) rename {proxy/internal => internal}/bootstrap/bootstrap.go (96%) rename {proxy/internal => internal}/debug/pprof.go (87%) rename {proxy/internal => internal}/env/env.go (98%) rename {proxy/internal => internal}/errors/errors.go (100%) rename {proxy/internal => internal}/errors/stack.go (100%) rename {proxy/internal => internal}/lb/debug.go (96%) rename {proxy/internal => internal}/lb/lb.go (100%) rename {proxy/internal => internal}/lb/mem.go (97%) rename {proxy/internal => internal}/lb/redis.go (99%) rename {proxy/internal => internal}/logger/context.go (100%) rename {proxy/internal => internal}/logger/log.go (100%) rename {proxy/internal => internal}/protocol/api.go (98%) rename {proxy/internal => internal}/protocol/http.go (98%) rename {proxy/internal => internal}/protocol/rtc.go (99%) rename {proxy/internal => internal}/protocol/rtmp.go (99%) rename {proxy/internal => internal}/protocol/srt.go (99%) rename {proxy/internal => internal}/rtmp/amf0.go (99%) rename {proxy/internal => internal}/rtmp/rtmp.go (99%) rename {proxy/internal => internal}/signal/signal.go (92%) rename {proxy/internal => internal}/sync/map.go (100%) rename {proxy/internal => internal}/utils/utils.go (99%) rename {proxy/internal => internal}/version/version.go (100%) delete mode 100644 proxy/.gitignore delete mode 100644 proxy/LICENSE diff --git a/.gitignore b/.gitignore index 1653198e9..d18904128 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,8 @@ cmake-build-debug /build /cmake/build /trunk/cmake/build + +# proxy (Go) +srs-proxy +.go-formarted +.env diff --git a/.kiro/skills b/.kiro/skills new file mode 120000 index 000000000..aa16b1bf4 --- /dev/null +++ b/.kiro/skills @@ -0,0 +1 @@ +../openclaw/skills \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 2c67c3871..45983d374 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -62,8 +62,8 @@ "type": "go", "request": "launch", "mode": "auto", - "cwd": "${workspaceFolder}/proxy", - "program": "${workspaceFolder}/proxy" + "cwd": "${workspaceFolder}/cmd/proxy", + "program": "${workspaceFolder}/cmd/proxy" }, { "name": "Debug SRS (macOS, CodeLLDB) console.conf", diff --git a/proxy/Makefile b/Makefile similarity index 50% rename from proxy/Makefile rename to Makefile index 07b2ac963..1c194e35e 100644 --- a/proxy/Makefile +++ b/Makefile @@ -4,20 +4,20 @@ all: build build: fmt ./srs-proxy -./srs-proxy: cmd/proxy-go/*.go internal/**/*.go - go build -o srs-proxy ./cmd/proxy-go +./srs-proxy: cmd/proxy/*.go internal/**/*.go + go build -o srs-proxy ./cmd/proxy test: go test ./... fmt: ./.go-formarted -./.go-formarted: cmd/proxy-go/*.go internal/**/*.go +./.go-formarted: cmd/proxy/*.go internal/**/*.go touch .go-formarted - go fmt ./... + go fmt ./cmd/... ./internal/... clean: rm -f srs-proxy .go-formarted run: fmt - go run ./cmd/proxy-go + go run ./cmd/proxy diff --git a/proxy/cmd/proxy-go/main.go b/cmd/proxy/main.go similarity index 89% rename from proxy/cmd/proxy-go/main.go rename to cmd/proxy/main.go index 25e6076e1..f15ee141c 100644 --- a/proxy/cmd/proxy-go/main.go +++ b/cmd/proxy/main.go @@ -7,7 +7,7 @@ import ( "context" "os" - "proxy/internal/bootstrap" + "srsx/internal/bootstrap" ) func main() { diff --git a/docs/proxy/README.md b/docs/proxy/README.md new file mode 100644 index 000000000..00544e2ed --- /dev/null +++ b/docs/proxy/README.md @@ -0,0 +1,23 @@ +# Proxy + +Proxy is a common proxy server (`cmd/proxy`) for any media servers with RTMP/SRT/HLS/HTTP-FLV and WebRTC/WHIP/WHEP protocols support. More programs like `cmd/origin` will be added in the future. + +## Usage + +This project is managed by AI. We recommend OpenClaw by default, but you can use any AI agent that supports skills, such as Claude Code, OpenAI Codex, Kiro CLI, or similar tools that can read code and docs as context. Setup your AI code tool and ask questions like: + +- How to use this project? +- How to run the proxy server? +- How to build an Origin Cluster for production? + +You can not only use AI to show you the usage of this project, but also use AI to guide you to learn the details of this project, to understand the design and protocols, to learn each documents in docs directory. + +## AI Guidelines + +- AI assistants should ignore [ignore-worklog.md](ignore-worklog.md) as it's a personal work log that may contain misleading information, hallucinations, or falsehoods. Never rely on this file as a reference. +- For usage of proxy server and end to end test it, you should load [proxy-usage.md](proxy-usage.md). This is the first step for new users to learn how to use this project. It provides a general and overall view of the proxy server, including practical usage examples and end-to-end testing procedures. +- For proxy full usage to build an Origin Cluster for SRS media server, please load [proxy-origin-cluster.md](proxy-origin-cluster.md). This is an advanced topic about how to use the proxy server to build the SRS Origin Cluster. Users should read this document to learn more details and architectures about proxy and Origin Cluster. +- For proxy server: To understand proxy system design, you should load the [proxy-design.md](proxy-design.md). To understand the proxy protocol details, you should load the [proxy-protocol.md](proxy-protocol.md). To understand how load balance works, you should load [proxy-load-balancer.md](proxy-load-balancer.md). To understand the code structure and packages, you should load [proxy-files.md](proxy-files.md). + +William Yang
+June 23, 2025 diff --git a/docs/proxy/ignore-worklog.md b/docs/proxy/ignore-worklog.md new file mode 100644 index 000000000..98a5d59ac --- /dev/null +++ b/docs/proxy/ignore-worklog.md @@ -0,0 +1,7 @@ +# Work Log + +> Important notes for AI assistants: This file might includes misleading information, hallucinations, or even falsehoods, since it's just a personal work log. So AI should never rely on this file as a reference. + +SRSX is not only the next generation of SRS (Simple Realtime Server), and it's also an approach to leverage AI to manage the project as a whole. So it's not just a useful open source project, but also a demostration of how AI can help develop, manage, and maintain a complex project. + +Since AI is relatively a new tool for open source project development, I use this work log to record my thoughts, ideas, experiments, and even failures along the way, while integrating AI into this open source project. diff --git a/proxy/docs/proxy-design.md b/docs/proxy/proxy-design.md similarity index 92% rename from proxy/docs/proxy-design.md rename to docs/proxy/proxy-design.md index 9dddaba9e..98d70f9df 100644 --- a/proxy/docs/proxy-design.md +++ b/docs/proxy/proxy-design.md @@ -2,7 +2,7 @@ ## Overview -**proxy-go** is a stateless media streaming proxy with built-in load balancing that enables building scalable origin clusters. The proxy itself acts as the load balancer, routing streams from clients to backend origin servers. +**proxy** is a stateless media streaming proxy with built-in load balancing that enables building scalable origin clusters. The proxy itself acts as the load balancer, routing streams from clients to backend origin servers. ``` Client → Proxy (with Load Balancer) → Backend Origin Servers diff --git a/proxy/docs/proxy-files.md b/docs/proxy/proxy-files.md similarity index 99% rename from proxy/docs/proxy-files.md rename to docs/proxy/proxy-files.md index 03e5cafc0..8d79ee79b 100644 --- a/proxy/docs/proxy-files.md +++ b/docs/proxy/proxy-files.md @@ -6,7 +6,7 @@ This document provides an overview of the Go codebase organization. ``` / -├── cmd/proxy-go/ +├── cmd/proxy/ │ └── main.go # Application entry point └── internal/ ├── debug/ # Go profiling support diff --git a/proxy/docs/proxy-load-balancer.md b/docs/proxy/proxy-load-balancer.md similarity index 97% rename from proxy/docs/proxy-load-balancer.md rename to docs/proxy/proxy-load-balancer.md index 00b1ad38d..4ec3c9d66 100644 --- a/proxy/docs/proxy-load-balancer.md +++ b/docs/proxy/proxy-load-balancer.md @@ -2,7 +2,7 @@ ## Overview -The proxy-go load balancer distributes client streams across multiple backend origin servers. It provides a pluggable interface with two implementations: +The proxy load balancer distributes client streams across multiple backend origin servers. It provides a pluggable interface with two implementations: 1. **Memory Load Balancer** - For single proxy deployments 2. **Redis Load Balancer** - For multi-proxy deployments with shared state @@ -159,4 +159,3 @@ PROXY_REDIS_DB=0 | **Complexity** | Simple | Moderate | | **Fault Tolerance** | Single point of failure | Multiple proxies | | **Best For** | Moderate traffic | High traffic, high availability | - diff --git a/proxy/docs/proxy-origin-cluster.md b/docs/proxy/proxy-origin-cluster.md similarity index 100% rename from proxy/docs/proxy-origin-cluster.md rename to docs/proxy/proxy-origin-cluster.md diff --git a/proxy/docs/proxy-protocol.md b/docs/proxy/proxy-protocol.md similarity index 100% rename from proxy/docs/proxy-protocol.md rename to docs/proxy/proxy-protocol.md diff --git a/proxy/docs/proxy-usage.md b/docs/proxy/proxy-usage.md similarity index 100% rename from proxy/docs/proxy-usage.md rename to docs/proxy/proxy-usage.md diff --git a/proxy/go.mod b/go.mod similarity index 56% rename from proxy/go.mod rename to go.mod index fd00feec9..bf009f16c 100644 --- a/proxy/go.mod +++ b/go.mod @@ -1,11 +1,13 @@ -module proxy +module srsx -go 1.18 +go 1.24 -require github.com/go-redis/redis/v8 v8.11.5 +require ( + github.com/go-redis/redis/v8 v8.11.5 + github.com/joho/godotenv v1.5.1 +) require ( github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/joho/godotenv v1.5.1 // indirect ) diff --git a/proxy/go.sum b/go.sum similarity index 64% rename from proxy/go.sum rename to go.sum index 1efc5318e..ee3c64abd 100644 --- a/proxy/go.sum +++ b/go.sum @@ -3,15 +3,24 @@ github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= +github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/proxy/internal/bootstrap/bootstrap.go b/internal/bootstrap/bootstrap.go similarity index 96% rename from proxy/internal/bootstrap/bootstrap.go rename to internal/bootstrap/bootstrap.go index 082039ba8..a6b716e9c 100644 --- a/proxy/internal/bootstrap/bootstrap.go +++ b/internal/bootstrap/bootstrap.go @@ -7,14 +7,14 @@ import ( "context" "time" - "proxy/internal/debug" - "proxy/internal/env" - "proxy/internal/errors" - "proxy/internal/lb" - "proxy/internal/logger" - "proxy/internal/protocol" - "proxy/internal/signal" - "proxy/internal/version" + "srsx/internal/debug" + "srsx/internal/env" + "srsx/internal/errors" + "srsx/internal/lb" + "srsx/internal/logger" + "srsx/internal/protocol" + "srsx/internal/signal" + "srsx/internal/version" ) // Bootstrap defines the interface for application bootstrap operations. diff --git a/proxy/internal/debug/pprof.go b/internal/debug/pprof.go similarity index 87% rename from proxy/internal/debug/pprof.go rename to internal/debug/pprof.go index 3e40c8c92..769debdee 100644 --- a/proxy/internal/debug/pprof.go +++ b/internal/debug/pprof.go @@ -7,8 +7,8 @@ import ( "context" "net/http" - "proxy/internal/env" - "proxy/internal/logger" + "srsx/internal/env" + "srsx/internal/logger" ) func HandleGoPprof(ctx context.Context, environment env.Environment) { diff --git a/proxy/internal/env/env.go b/internal/env/env.go similarity index 98% rename from proxy/internal/env/env.go rename to internal/env/env.go index c18edbd7a..791580705 100644 --- a/proxy/internal/env/env.go +++ b/internal/env/env.go @@ -9,8 +9,8 @@ import ( "github.com/joho/godotenv" - "proxy/internal/errors" - "proxy/internal/logger" + "srsx/internal/errors" + "srsx/internal/logger" ) // Environment provides access to environment variables. @@ -196,7 +196,7 @@ func buildDefaultEnvironmentVariables(ctx context.Context) { // The API server of proxy itself. setEnvDefault("PROXY_SYSTEM_API", "12025") // The static directory for web server, optional. - setEnvDefault("PROXY_STATIC_FILES", "../trunk/research") + setEnvDefault("PROXY_STATIC_FILES", "./trunk/research") // The load balancer, use redis or memory. setEnvDefault("PROXY_LOAD_BALANCER_TYPE", "memory") diff --git a/proxy/internal/errors/errors.go b/internal/errors/errors.go similarity index 100% rename from proxy/internal/errors/errors.go rename to internal/errors/errors.go diff --git a/proxy/internal/errors/stack.go b/internal/errors/stack.go similarity index 100% rename from proxy/internal/errors/stack.go rename to internal/errors/stack.go diff --git a/proxy/internal/lb/debug.go b/internal/lb/debug.go similarity index 96% rename from proxy/internal/lb/debug.go rename to internal/lb/debug.go index c6ecf0eb1..118566ba1 100644 --- a/proxy/internal/lb/debug.go +++ b/internal/lb/debug.go @@ -8,8 +8,8 @@ import ( "os" "time" - "proxy/internal/env" - "proxy/internal/logger" + "srsx/internal/env" + "srsx/internal/logger" ) // NewDefaultSRSForDebugging initialize the default SRS media server, for debugging only. diff --git a/proxy/internal/lb/lb.go b/internal/lb/lb.go similarity index 100% rename from proxy/internal/lb/lb.go rename to internal/lb/lb.go diff --git a/proxy/internal/lb/mem.go b/internal/lb/mem.go similarity index 97% rename from proxy/internal/lb/mem.go rename to internal/lb/mem.go index f3b9fe3ce..ccc1861a5 100644 --- a/proxy/internal/lb/mem.go +++ b/internal/lb/mem.go @@ -9,10 +9,10 @@ import ( "math/rand" "time" - "proxy/internal/env" - "proxy/internal/errors" - "proxy/internal/logger" - "proxy/internal/sync" + "srsx/internal/env" + "srsx/internal/errors" + "srsx/internal/logger" + "srsx/internal/sync" ) // MemoryLoadBalancer stores state in memory. diff --git a/proxy/internal/lb/redis.go b/internal/lb/redis.go similarity index 99% rename from proxy/internal/lb/redis.go rename to internal/lb/redis.go index 936e6fc84..93dbeb025 100644 --- a/proxy/internal/lb/redis.go +++ b/internal/lb/redis.go @@ -14,9 +14,9 @@ import ( // Use v8 because we use Go 1.16+, while v9 requires Go 1.18+ "github.com/go-redis/redis/v8" - "proxy/internal/env" - "proxy/internal/errors" - "proxy/internal/logger" + "srsx/internal/env" + "srsx/internal/errors" + "srsx/internal/logger" ) // RedisLoadBalancer stores state in Redis. diff --git a/proxy/internal/logger/context.go b/internal/logger/context.go similarity index 100% rename from proxy/internal/logger/context.go rename to internal/logger/context.go diff --git a/proxy/internal/logger/log.go b/internal/logger/log.go similarity index 100% rename from proxy/internal/logger/log.go rename to internal/logger/log.go diff --git a/proxy/internal/protocol/api.go b/internal/protocol/api.go similarity index 98% rename from proxy/internal/protocol/api.go rename to internal/protocol/api.go index 7674f0513..32444b6ad 100644 --- a/proxy/internal/protocol/api.go +++ b/internal/protocol/api.go @@ -12,12 +12,12 @@ import ( "sync" "time" - "proxy/internal/env" - "proxy/internal/errors" - "proxy/internal/lb" - "proxy/internal/logger" - "proxy/internal/utils" - "proxy/internal/version" + "srsx/internal/env" + "srsx/internal/errors" + "srsx/internal/lb" + "srsx/internal/logger" + "srsx/internal/utils" + "srsx/internal/version" ) // srsHTTPAPIServer is the proxy for SRS HTTP API, to proxy the WebRTC HTTP API like WHIP and WHEP, diff --git a/proxy/internal/protocol/http.go b/internal/protocol/http.go similarity index 98% rename from proxy/internal/protocol/http.go rename to internal/protocol/http.go index dfd88a88d..730dd4abd 100644 --- a/proxy/internal/protocol/http.go +++ b/internal/protocol/http.go @@ -15,12 +15,12 @@ import ( stdSync "sync" "time" - "proxy/internal/env" - "proxy/internal/errors" - "proxy/internal/lb" - "proxy/internal/logger" - "proxy/internal/utils" - "proxy/internal/version" + "srsx/internal/env" + "srsx/internal/errors" + "srsx/internal/lb" + "srsx/internal/logger" + "srsx/internal/utils" + "srsx/internal/version" ) // srsHTTPStreamServer is the proxy server for SRS HTTP stream server, for HTTP-FLV, HTTP-TS, diff --git a/proxy/internal/protocol/rtc.go b/internal/protocol/rtc.go similarity index 99% rename from proxy/internal/protocol/rtc.go rename to internal/protocol/rtc.go index 7d9b55d3e..b906b2d36 100644 --- a/proxy/internal/protocol/rtc.go +++ b/internal/protocol/rtc.go @@ -15,12 +15,12 @@ import ( stdSync "sync" "time" - "proxy/internal/env" - "proxy/internal/errors" - "proxy/internal/lb" - "proxy/internal/logger" - "proxy/internal/sync" - "proxy/internal/utils" + "srsx/internal/env" + "srsx/internal/errors" + "srsx/internal/lb" + "srsx/internal/logger" + "srsx/internal/sync" + "srsx/internal/utils" ) // srsWebRTCServer is the proxy for SRS WebRTC server via WHIP or WHEP protocol. It will figure out diff --git a/proxy/internal/protocol/rtmp.go b/internal/protocol/rtmp.go similarity index 99% rename from proxy/internal/protocol/rtmp.go rename to internal/protocol/rtmp.go index 5f0895bd4..f0b11d0e4 100644 --- a/proxy/internal/protocol/rtmp.go +++ b/internal/protocol/rtmp.go @@ -11,13 +11,13 @@ import ( "strings" "sync" - "proxy/internal/env" - "proxy/internal/errors" - "proxy/internal/lb" - "proxy/internal/logger" - "proxy/internal/rtmp" - "proxy/internal/utils" - "proxy/internal/version" + "srsx/internal/env" + "srsx/internal/errors" + "srsx/internal/lb" + "srsx/internal/logger" + "srsx/internal/rtmp" + "srsx/internal/utils" + "srsx/internal/version" ) // srsRTMPServer is the proxy for SRS RTMP server, to proxy the RTMP stream to backend SRS diff --git a/proxy/internal/protocol/srt.go b/internal/protocol/srt.go similarity index 99% rename from proxy/internal/protocol/srt.go rename to internal/protocol/srt.go index 22e68d4f7..4b48f587f 100644 --- a/proxy/internal/protocol/srt.go +++ b/internal/protocol/srt.go @@ -13,12 +13,12 @@ import ( stdSync "sync" "time" - "proxy/internal/env" - "proxy/internal/errors" - "proxy/internal/lb" - "proxy/internal/logger" - "proxy/internal/sync" - "proxy/internal/utils" + "srsx/internal/env" + "srsx/internal/errors" + "srsx/internal/lb" + "srsx/internal/logger" + "srsx/internal/sync" + "srsx/internal/utils" ) // srsSRTServer is the proxy for SRS server via SRT. It will figure out which backend server to diff --git a/proxy/internal/rtmp/amf0.go b/internal/rtmp/amf0.go similarity index 99% rename from proxy/internal/rtmp/amf0.go rename to internal/rtmp/amf0.go index 9f15d7232..f1e8abae1 100644 --- a/proxy/internal/rtmp/amf0.go +++ b/internal/rtmp/amf0.go @@ -11,7 +11,7 @@ import ( "math" "sync" - "proxy/internal/errors" + "srsx/internal/errors" ) // Please read @doc amf0_spec_121207.pdf, @page 4, @section 2.1 Types Overview diff --git a/proxy/internal/rtmp/rtmp.go b/internal/rtmp/rtmp.go similarity index 99% rename from proxy/internal/rtmp/rtmp.go rename to internal/rtmp/rtmp.go index fe129f629..58c2afc37 100644 --- a/proxy/internal/rtmp/rtmp.go +++ b/internal/rtmp/rtmp.go @@ -14,7 +14,7 @@ import ( "io" "sync" - "proxy/internal/errors" + "srsx/internal/errors" ) // The handshake implements the RTMP handshake protocol. diff --git a/proxy/internal/signal/signal.go b/internal/signal/signal.go similarity index 92% rename from proxy/internal/signal/signal.go rename to internal/signal/signal.go index 267879cde..9999429ef 100644 --- a/proxy/internal/signal/signal.go +++ b/internal/signal/signal.go @@ -10,9 +10,9 @@ import ( "syscall" "time" - "proxy/internal/env" - "proxy/internal/errors" - "proxy/internal/logger" + "srsx/internal/env" + "srsx/internal/errors" + "srsx/internal/logger" ) func InstallSignals(ctx context.Context, cancel context.CancelFunc) { diff --git a/proxy/internal/sync/map.go b/internal/sync/map.go similarity index 100% rename from proxy/internal/sync/map.go rename to internal/sync/map.go diff --git a/proxy/internal/utils/utils.go b/internal/utils/utils.go similarity index 99% rename from proxy/internal/utils/utils.go rename to internal/utils/utils.go index 9a5fbf706..02fc35177 100644 --- a/proxy/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -22,9 +22,9 @@ import ( "strings" "syscall" - "proxy/internal/errors" - "proxy/internal/logger" - "proxy/internal/version" + "srsx/internal/errors" + "srsx/internal/logger" + "srsx/internal/version" ) func ApiResponse(ctx context.Context, w http.ResponseWriter, r *http.Request, data any) { diff --git a/proxy/internal/version/version.go b/internal/version/version.go similarity index 100% rename from proxy/internal/version/version.go rename to internal/version/version.go diff --git a/openclaw/.gitignore b/openclaw/.gitignore index 0eab36e7a..854253dc5 100644 --- a/openclaw/.gitignore +++ b/openclaw/.gitignore @@ -1,3 +1,4 @@ /.openclaw/workspace-state.json /.clawhub -/skills/llm-switcher \ No newline at end of file +/skills/llm-switcher +/personal \ No newline at end of file diff --git a/openclaw/AGENTS.md b/openclaw/AGENTS.md index 887a5a8f5..502cd4601 100644 --- a/openclaw/AGENTS.md +++ b/openclaw/AGENTS.md @@ -77,6 +77,7 @@ In group chats where you receive every message, be **smart about when to contrib **Respond when:** - Directly mentioned or asked a question +- In SRS support groups, if someone mentions you with a technical SRS question, answer directly — do not wait, paraphrase, or hold back unless you're missing critical facts - You can add genuine value (info, insight, help) - Something witty/funny fits naturally - Correcting important misinformation diff --git a/openclaw/MEMORY.md b/openclaw/MEMORY.md index 2bdb99a89..a87773ffc 100644 --- a/openclaw/MEMORY.md +++ b/openclaw/MEMORY.md @@ -1,7 +1,6 @@ # MEMORY.md - SRSBot's Long-Term Memory ## Workspace Conventions -- Git commit titles start with: `OpenClaw:` - **No auto-commit** — Never automatically git commit. Only commit when William explicitly tells me to. - **No guessing** — William will teach me everything about SRS. Don't speculate or fill in gaps. Wait for him to explain. @@ -24,6 +23,14 @@ - Goal: a very active, well-supported community where every developer has an AI assistant trained with William's knowledge - This is not just project maintenance — it's a new model for open source sustainability +## SRS Community Bot (OpenClaw) +- William set up an OpenClaw robot for the SRS community (2026-03-20) +- **Telegram group:** https://t.me/+RiynvKOxpQ42MGJl +- **Discord server:** https://discord.gg/yZ4BnPmHAd +- Users join the group and **@ the SRS Robot** to interact +- Purpose: scale William's expertise to the community without him answering every question +- **Recommended: Telegram over Discord** — Telegram lets users create small focused groups and invite the bot in. Each small group = clean context window. Big groups mix unrelated messages and confuse the bot's context. Small groups → better answers, better support. + ## What Matters to William - SRS project health, development, and community - Open source sustainability and contributor experience @@ -61,6 +68,16 @@ The three layers are what William controls; the external conditions are what the - `docs/ideas.md` is the scratch pad for early-stage thinking that doesn't belong anywhere else yet - Ideas may grow into major features or directions over time +## Changelog & Version +- **Changelog:** `trunk/doc/CHANGELOG.md` +- **Version file:** `trunk/src/core/srs_core_version7.hpp` — bump `VERSION_REVISION` to match the new changelog entry +- **When to update:** When a PR is merged — not per commit +- **Workflow:** Feature branch → multiple commits → create PR → merge PR → update changelog + version +- Individual commits on a branch do NOT get changelog entries +- The changelog entry is for the PR merge, not the individual commits within it +- **Both files must be updated together** — changelog entry version must match `VERSION_REVISION` +- Format follows existing pattern: `* v7.0, YYYY-MM-DD, Merge [#NNNN](url): Description. vX.Y.Z (#NNNN)` + ## SRS Knowledge Base Detailed SRS knowledge in `memory/srs-*.md` files: - `srs-overview.md` — What SRS is, protocols, ecosystem tools, and **Features section** with all SRS features, versions, and dates diff --git a/openclaw/TOOLS.md b/openclaw/TOOLS.md index 969131910..2e631aed4 100644 --- a/openclaw/TOOLS.md +++ b/openclaw/TOOLS.md @@ -40,6 +40,23 @@ Skills are shared. Your setup is yours. Keeping them apart means you can update - Channel: `telegram`, accountId: `srs` (SRS bot) - When sending to William's Telegram: `channel: "telegram"`, `accountId: "srs"` +### Git Commit Workflow + +- **Never `git add`** — William stages files himself +- **Never `git push`** — William pushes himself +- **Commit workflow:** `git diff --cached` → understand the changes → write title/description → `git commit -m "OpenClaw: ..."` +- Title prefix: `OpenClaw:` +- **Co-author for ACP Claude Code:** If Claude Code (ACP) was used to make the changes, add: + `Co-authored-by: Claude Opus 4.6 ` +- **Co-author for ACP Codex:** If Codex (ACP) was used to make the changes, add: + `Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>` + +### Go (GVM) + +- Go is managed via **GVM** (Go Version Manager), NOT Homebrew +- Before running any `go` command: `source ~/.gvm/scripts/gvm` +- **Never** use `brew install go` — always use GVM + --- Add whatever helps you do your job. This is your cheat sheet. diff --git a/proxy/.gitignore b/proxy/.gitignore deleted file mode 100644 index 4481dbd4d..000000000 --- a/proxy/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -.idea -.claude -.vscode - -srs-proxy -.go-formarted - -# For AI to ignore these files. -.env -docs/ignore-worklog.md diff --git a/proxy/LICENSE b/proxy/LICENSE deleted file mode 100644 index 31d13ab3e..000000000 --- a/proxy/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2025 ossrs - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/proxy/README.md b/proxy/README.md index e13f4ed96..e628c64b9 100644 --- a/proxy/README.md +++ b/proxy/README.md @@ -1,23 +1,3 @@ # Proxy -Proxy is a common proxy server (`cmd/proxy-go`) for any media servers with RTMP/SRT/HLS/HTTP-FLV and WebRTC/WHIP/WHEP protocols support. More programs like `cmd/origin-go` will be added in the future. - -## Usage - -This project is managed by AI. By default we use Kiro (Amazon Q) CLI, but you can use any other AI tools that read code and docs as context. Setup your AI code tool and ask questions like: - -- How to use this project? -- How to run the proxy server? -- How to build an Origin Cluster for production? - -You can not only use AI to show you the usage of this project, but also use AI to guide you to learn the details of this project, to understand the design and protocols, to learn each documents in docs directory. - -## AI Guidelines - -- AI assistants should ignore [docs/ignore-worklog.md](docs/ignore-worklog.md) as it's a personal work log that may contain misleading information, hallucinations, or falsehoods. Never rely on this file as a reference. -- For usage of proxy server and end to end test it, you should load [docs/proxy-usage.md](docs/proxy-usage.md). This is the first step for new users to learn how to use this project. It provides a general and overall view of the proxy server, including practical usage examples and end-to-end testing procedures. -- For proxy full usage to build an Origin Cluster for SRS media server, please load [docs/proxy-origin-cluster.md](docs/proxy-origin-cluster.md). This is an advanced topic about how to use the proxy server to build the SRS Origin Cluster. Users should read this document to learn more details and architectures about proxy and Origin Cluster. -- For proxy server: To understand proxy system design, you should load the [docs/proxy-design.md](docs/proxy-design.md). To understand the proxy protocol details, you should load the [docs/proxy-protocol.md](docs/proxy-protocol.md). To understand how load balance works, you should load [docs/proxy-load-balancer.md](docs/proxy-load-balancer.md). To understand the code structure and packages, you should load [docs/proxy-files.md](docs/proxy-files.md). - -William Yang
-June 23, 2025 +Moved to [code](../cmd/proxy/main.go) and [doc](../docs/proxy/README.md). diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 236e74f4c..f67b2a21a 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -7,6 +7,7 @@ The changelog for SRS. ## SRS 7.0 Changelog +* v7.0, 2026-03-22, Merge [#4652](https://github.com/ossrs/srs/pull/4652): Proxy: restructure repo as Go project with proxy as first module. v7.0.139 (#4652) * v7.0, 2026-03-05, Merge [#4643](https://github.com/ossrs/srs/pull/4643): OpenClaw: add and refine ST knowledge-base and learning/review skills. v7.0.138 (#4643) * v7.0, 2025-12-31, Merge [#4618](https://github.com/ossrs/srs/pull/4618): HLS/DASH: Fix dispose() to cleanup files even after on_unpublish() sets enabled_ to false. v7.0.137 (#4618) * v7.0, 2025-12-07, Merge [#4602](https://github.com/ossrs/srs/pull/4602): HLS: Fix audio-only fMP4 playback skipping. v7.0.136 (#4602) diff --git a/trunk/src/core/srs_core_version7.hpp b/trunk/src/core/srs_core_version7.hpp index 8d59de426..6fa083e5f 100644 --- a/trunk/src/core/srs_core_version7.hpp +++ b/trunk/src/core/srs_core_version7.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 7 #define VERSION_MINOR 0 -#define VERSION_REVISION 137 +#define VERSION_REVISION 139 #endif