{"owner":"go-gost","repo":"gost","hasSkills":true,"hasMcp":false,"mcpConfig":null,"found":["CLAUDE.md"],"skills":{"CLAUDE.md":"# CLAUDE.md — gost/\n\nCLI binary entry point for GOST (GO Simple Tunnel). This module compiles the `gost` command.\n\n## Build & Run\n\n```bash\ncd gost && go build ./cmd/gost/...\n\n# Cross-compile\nCGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags=\"-s -w\" ./cmd/gost/...\n\n# Build all platforms\nmake all\n\n# Run\n./gost -L \"http://:8080\" -F \"socks5://:1080\"\n./gost -C gost.yml\n```\n\n## Structure\n\n| File | Purpose |\n|------|---------|\n| `cmd/gost/main.go` | CLI entry point: flag parsing, multi-worker mode (`--` separator), program launch via `svc.Run` |\n| `cmd/gost/program.go` | Service lifecycle (`Init`/`Start`/`Stop`), config loading, API/metrics/profiling servers, SIGHUP reload |\n| `cmd/gost/register.go` | Blank imports for all built-in handlers, listeners, dialers, connectors — triggers `init()` registration |\n| `cmd/gost/version.go` | Version string (`3.3.0`) |\n\n## CLI Flags\n\n| Flag | Usage |\n|------|-------|\n| `-L` | Inline service definition (repeatable) |\n| `-F` | Inline chain node definition (repeatable) |\n| `-C` | Path to config file (YAML/JSON) |\n| `-D` / `-DD` | Debug / trace logging |\n| `-api` | API service address (e.g. `:8080`) |\n| `-metrics` | Prometheus metrics address |\n| `-O` | Output merged config as yaml or json, then exit |\n| `-V` | Print version and exit |\n\n## Multi-Worker Mode\n\nArguments separated by ` -- ` spawn multiple worker processes via `exec.CommandContext`. Each worker runs as a child process with `_GOST_ID` set. Any worker's exit cancels all others. This is triggered in `init()` before flag parsing.\n\n## Service Lifecycle\n\n- `Init` → calls `parser.Init()` with all CLI/config inputs\n- `Start` → `parser.Parse()` → `loader.Load()` → `p.run()` (starts services, API, metrics, profiling)\n- `Stop` → cancels reload context, closes all services\n- SIGHUP → `reloadConfig()` re-parses and re-runs without restarting the process\n\n## Key Dependencies\n\n- `github.com/go-gost/core` — interface definitions\n- `github.com/go-gost/x` — all implementations, config, registry\n- `github.com/judwhite/go-svc` — OS service framework (handles daemon/SIGHUP/SIGTERM)\n\n## Registration Pattern\n\nAll components register via `init()` side-effects in their packages. `cmd/gost/register.go` triggers them with blank imports. When adding a new built-in handler/listener/dialer/connector, add a blank import here.\n\n## Tests\n\nTests are in `tests/e2e/` — integration tests using the built binary. No unit tests. Run with `go test ./tests/e2e/...`.\n"},"files":{"CLAUDE.md":"# CLAUDE.md — gost/\n\nCLI binary entry point for GOST (GO Simple Tunnel). This module compiles the `gost` command.\n\n## Build & Run\n\n```bash\ncd gost && go build ./cmd/gost/...\n\n# Cross-compile\nCGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags=\"-s -w\" ./cmd/gost/...\n\n# Build all platforms\nmake all\n\n# Run\n./gost -L \"http://:8080\" -F \"socks5://:1080\"\n./gost -C gost.yml\n```\n\n## Structure\n\n| File | Purpose |\n|------|---------|\n| `cmd/gost/main.go` | CLI entry point: flag parsing, multi-worker mode (`--` separator), program launch via `svc.Run` |\n| `cmd/gost/program.go` | Service lifecycle (`Init`/`Start`/`Stop`), config loading, API/metrics/profiling servers, SIGHUP reload |\n| `cmd/gost/register.go` | Blank imports for all built-in handlers, listeners, dialers, connectors — triggers `init()` registration |\n| `cmd/gost/version.go` | Version string (`3.3.0`) |\n\n## CLI Flags\n\n| Flag | Usage |\n|------|-------|\n| `-L` | Inline service definition (repeatable) |\n| `-F` | Inline chain node definition (repeatable) |\n| `-C` | Path to config file (YAML/JSON) |\n| `-D` / `-DD` | Debug / trace logging |\n| `-api` | API service address (e.g. `:8080`) |\n| `-metrics` | Prometheus metrics address |\n| `-O` | Output merged config as yaml or json, then exit |\n| `-V` | Print version and exit |\n\n## Multi-Worker Mode\n\nArguments separated by ` -- ` spawn multiple worker processes via `exec.CommandContext`. Each worker runs as a child process with `_GOST_ID` set. Any worker's exit cancels all others. This is triggered in `init()` before flag parsing.\n\n## Service Lifecycle\n\n- `Init` → calls `parser.Init()` with all CLI/config inputs\n- `Start` → `parser.Parse()` → `loader.Load()` → `p.run()` (starts services, API, metrics, profiling)\n- `Stop` → cancels reload context, closes all services\n- SIGHUP → `reloadConfig()` re-parses and re-runs without restarting the process\n\n## Key Dependencies\n\n- `github.com/go-gost/core` — interface definitions\n- `github.com/go-gost/x` — all implementations, config, registry\n- `github.com/judwhite/go-svc` — OS service framework (handles daemon/SIGHUP/SIGTERM)\n\n## Registration Pattern\n\nAll components register via `init()` side-effects in their packages. `cmd/gost/register.go` triggers them with blank imports. When adding a new built-in handler/listener/dialer/connector, add a blank import here.\n\n## Tests\n\nTests are in `tests/e2e/` — integration tests using the built binary. No unit tests. Run with `go test ./tests/e2e/...`.\n"},"items":[{"name":"CLAUDE.md","path":"CLAUDE.md","title":"CLAUDE.md","content":"# CLAUDE.md — gost/\n\nCLI binary entry point for GOST (GO Simple Tunnel). This module compiles the `gost` command.\n\n## Build & Run\n\n```bash\ncd gost && go build ./cmd/gost/...\n\n# Cross-compile\nCGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags=\"-s -w\" ./cmd/gost/...\n\n# Build all platforms\nmake all\n\n# Run\n./gost -L \"http://:8080\" -F \"socks5://:1080\"\n./gost -C gost.yml\n```\n\n## Structure\n\n| File | Purpose |\n|------|---------|\n| `cmd/gost/main.go` | CLI entry point: flag parsing, multi-worker mode (`--` separator), program launch via `svc.Run` |\n| `cmd/gost/program.go` | Service lifecycle (`Init`/`Start`/`Stop`), config loading, API/metrics/profiling servers, SIGHUP reload |\n| `cmd/gost/register.go` | Blank imports for all built-in handlers, listeners, dialers, connectors — triggers `init()` registration |\n| `cmd/gost/version.go` | Version string (`3.3.0`) |\n\n## CLI Flags\n\n| Flag | Usage |\n|------|-------|\n| `-L` | Inline service definition (repeatable) |\n| `-F` | Inline chain node definition (repeatable) |\n| `-C` | Path to config file (YAML/JSON) |\n| `-D` / `-DD` | Debug / trace logging |\n| `-api` | API service address (e.g. `:8080`) |\n| `-metrics` | Prometheus metrics address |\n| `-O` | Output merged config as yaml or json, then exit |\n| `-V` | Print version and exit |\n\n## Multi-Worker Mode\n\nArguments separated by ` -- ` spawn multiple worker processes via `exec.CommandContext`. Each worker runs as a child process with `_GOST_ID` set. Any worker's exit cancels all others. This is triggered in `init()` before flag parsing.\n\n## Service Lifecycle\n\n- `Init` → calls `parser.Init()` with all CLI/config inputs\n- `Start` → `parser.Parse()` → `loader.Load()` → `p.run()` (starts services, API, metrics, profiling)\n- `Stop` → cancels reload context, closes all services\n- SIGHUP → `reloadConfig()` re-parses and re-runs without restarting the process\n\n## Key Dependencies\n\n- `github.com/go-gost/core` — interface definitions\n- `github.com/go-gost/x` — all implementations, config, registry\n- `github.com/judwhite/go-svc` — OS service framework (handles daemon/SIGHUP/SIGTERM)\n\n## Registration Pattern\n\nAll components register via `init()` side-effects in their packages. `cmd/gost/register.go` triggers them with blank imports. When adding a new built-in handler/listener/dialer/connector, add a blank import here.\n\n## Tests\n\nTests are in `tests/e2e/` — integration tests using the built binary. No unit tests. Run with `go test ./tests/e2e/...`.\n","category":"root","tokens":617}]}