{"id":21667086,"url":"https://github.com/docker-client/echo-server","last_synced_at":"2026-04-18T13:37:19.418Z","repository":{"id":38301069,"uuid":"464664935","full_name":"docker-client/echo-server","owner":"docker-client","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-17T22:08:04.000Z","size":125,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-18T00:27:44.095Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/docker-client.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-02-28T22:29:57.000Z","updated_at":"2026-04-17T22:08:07.000Z","dependencies_parsed_at":"2024-02-07T21:38:18.778Z","dependency_job_id":"b6936f51-28bc-43f7-a0f8-7739b2d4f42b","html_url":"https://github.com/docker-client/echo-server","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/docker-client/echo-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docker-client%2Fecho-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docker-client%2Fecho-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docker-client%2Fecho-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docker-client%2Fecho-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/docker-client","download_url":"https://codeload.github.com/docker-client/echo-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docker-client%2Fecho-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31971488,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-11-25T11:33:16.766Z","updated_at":"2026-04-18T13:37:19.412Z","avatar_url":"https://github.com/docker-client.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# echo-server\n\nA cross-platform test server with support for **HTTP/1.1 connection upgrades** and **deterministic scripted responses**.\n\nMulti-platform Docker images are available at\n`gesellix/echo-server:\u003cversion\u003e`\nwith `\u003cversion\u003e` matching Git tags/releases on GitHub.\n\nSupported platforms:\n- `linux/amd64`\n- `linux/arm64/v8`\n- `windows-ltsc2022`\n\n---\n\n## 🚀 Features\n\n- **HTTP/1.1 Upgrade Handling** to raw TCP\n- **Scripted deterministic responses** via JSON body\n- **Interactive commands** in default mode (e.g. `reset`, `set 10`)\n- **Cross-platform \u0026 container-friendly**\n- **Useful for client protocol testing** and upgrade simulations\n\n---\n\n## 🔌 HTTP/1.1 Upgrade Endpoint\n\n```\nPOST /api/stream HTTP/1.1\nConnection: Upgrade\nUpgrade: testproto\n```\n\nThe server upgrades the connection and speaks raw TCP after switching protocols.\n\n---\n\n## 🧪 Default Behavior\n\nWhen no script is provided, the server enters a simple interactive loop:\n\n- Sends a counter every second:\n  ```\n  [0] scripted: counter: 0\n  [1] scripted: counter: 1\n  ...\n  ```\n\n- Accepts basic commands from the client:\n  - `reset` → resets counter\n  - `set \u003cn\u003e` → sets counter to `\u003cn\u003e`\n  - any other input → \"unknown command\"\n\nYou can connect using the built-in client or tools like `nc`:\n\n```bash\ngo run ./src/hijack_client.go\n# or\n{ echo -en \"GET /api/stream HTTP/1.1\\r\\nHost: localhost\\r\\nConnection: Upgrade\\r\\nUpgrade: testproto\\r\\n\\r\\n\"; cat; } | nc localhost 8080\n```\n\n---\n\n## 📜 Scripted Responses (JSON)\n\nSend a JSON payload with a `POST` request to `/api/stream`, along with Upgrade headers.\n\n### Example Request:\n\n```http\nPOST /api/stream HTTP/1.1\nHost: localhost:8080\nConnection: Upgrade\nUpgrade: testproto\nContent-Type: application/json\n\n{\n  \"actions\": [\n    { \"type\": \"response\", \"text\": \"first\" },\n    { \"type\": \"delay\",    \"ms\": 1000 },\n    { \"type\": \"response\", \"text\": \"second\" },\n    { \"type\": \"close\" }\n  ]\n}\n```\n\n### Supported Actions:\n\n| Type       | Description                             | Example           |\n|------------|-----------------------------------------|-------------------|\n| `response` | Sends a line of text                    | `\"text\": \"Hello\"` |\n| `delay`    | Waits before next action (milliseconds) | `\"ms\": 500`       |\n| `close`    | Closes the TCP connection               | *(no parameters)* |\n\n---\n\n## 📁 Example Client\n\nA simple Go client for interactive testing is available at:\n\n```\n./src/hijack_client.go\n```\n\nIt connects to the server, performs the upgrade handshake, and allows typing commands live.\n\n---\n\n## 🐳 Docker\n\nTo run via Docker:\n\n```bash\ndocker run --rm -it -p 8080:8080 gesellix/echo-server:\u003cversion\u003e\n```\n\n---\n\n## 📫 Feedback\n\nIssues and contributions welcome via GitHub.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocker-client%2Fecho-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdocker-client%2Fecho-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocker-client%2Fecho-server/lists"}