{"id":21009357,"url":"https://github.com/shockerli/gorc","last_synced_at":"2025-03-13T15:27:10.609Z","repository":{"id":57635794,"uuid":"426622354","full_name":"shockerli/gorc","owner":"shockerli","description":"HTTP API traffic recording and replay middleware based on GoReplay, can be used for migration and refactoring testing","archived":false,"fork":false,"pushed_at":"2021-11-15T10:31:28.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T11:09:57.962Z","etag":null,"topics":["go","golang","gor","goreplay","migration","refactoring","test"],"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/shockerli.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}},"created_at":"2021-11-10T12:56:40.000Z","updated_at":"2024-08-17T13:50:35.000Z","dependencies_parsed_at":"2022-09-26T20:21:29.996Z","dependency_job_id":null,"html_url":"https://github.com/shockerli/gorc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shockerli%2Fgorc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shockerli%2Fgorc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shockerli%2Fgorc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shockerli%2Fgorc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shockerli","download_url":"https://codeload.github.com/shockerli/gorc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243431049,"owners_count":20289824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["go","golang","gor","goreplay","migration","refactoring","test"],"created_at":"2024-11-19T09:16:28.810Z","updated_at":"2025-03-13T15:27:10.585Z","avatar_url":"https://github.com/shockerli.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gorc\n\nHTTP API traffic recording and replay middleware based on [GoReplay](https://github.com/buger/goreplay), can be used for migration and refactoring testing.\n\nEnglish | [中文](README_ZH.md)\n\n## Requirements\n\n`gorc` is a middleware of `GoReplay`, so you should install `GoReplay` first.\n\nDownload the latest binary from https://github.com/buger/goreplay/releases\nor [compile by yourself](https://github.com/buger/goreplay/wiki/Compilation)\nor `brew install gor` in macOS\n\n## Install `gorc`\n\n- download binary\n\n  https://github.com/shockerli/gorc/releases\n\n- go install\n\n```shell\ngo install github.com/shockerli/gorc@latest\n```\n\n- go build\n\n```shell\ngit clone https://github.com/shockerli/gorc\n\ncd gorc\n\ngo build .\n```\n\n## Usage\n\n\u003e `--input-raw=\":8001\"`: original service port, which be recorded\n\u003e\n\u003e `--output-http=\"http://127.0.0.1:8002\"`: replay request to another service\n\u003e\n\u003e `--middleware=\"${path-of-gorc} ${command-or-script}\"`: `gor` middleware command\n\n- PHP\n\n```shell\ngor \\\n    --input-raw-track-response \\\n    --output-http-track-response \\\n    --input-raw=\":8001\" \\\n    --output-http=\"http://127.0.0.1:8002\" \\\n    --middleware=\"go run gorc.go php examples/script.php\"\n\ngor \\\n    --input-raw-track-response \\\n    --output-http-track-response \\\n    --input-raw=\":8001\" \\\n    --output-http=\"http://127.0.0.1:8002\" \\\n    --middleware=\"go run gorc.go ./examples/script.php\"\n\ngor \\\n    --input-raw-track-response \\\n    --output-http-track-response \\\n    --input-raw=\":8001\" \\\n    --output-http=\"http://127.0.0.1:8002\" \\\n    --middleware=\"/path/to/bin/gorc ./examples/script.php\"\n```\n\n- NodeJS\n\n```shell\ngor \\\n    --input-raw-track-response \\\n    --output-http-track-response \\\n    --input-raw=\":8001\" \\\n    --output-http=\"http://127.0.0.1:8002\" \\\n    --middleware=\"go run gorc.go node examples/script.js\"\n\ngor \\\n    --input-raw-track-response \\\n    --output-http-track-response \\\n    --input-raw=\":8001\" \\\n    --output-http=\"http://127.0.0.1:8002\" \\\n    --middleware=\"go run gorc.go ./examples/script.js\"\n\ngor \\\n    --input-raw-track-response \\\n    --output-http-track-response \\\n    --input-raw=\":8001\" \\\n    --output-http=\"http://127.0.0.1:8002\" \\\n    --middleware=\"/path/to/bin/gorc ./examples/script.js\"\n```\n\n- Any other programming language your machine supports\n\n## Datatype\n\nYour custom script, read line from `STDIN` per request:\n\n```json5\n{\n  // uuid, GoReplay generate the request unique id\n  \"req_id\": \"f33e1bab7f0000013e9b304d\",\n  // whole time: ns\n  \"latency\": 1137963000,\n  \"request\": {\n    // unit: ns\n    \"time\": 1636958850332299000,\n    // unit: ns\n    \"latency\": 0,\n    \"header\": {\n      \"Accept\": [\n        \"*/*\"\n      ],\n      \"Accept-Encoding\": [\n        \"gzip, deflate, br\"\n      ],\n      \"Cache-Control\": [\n        \"no-cache\"\n      ],\n      \"Connection\": [\n        \"keep-alive\"\n      ],\n      \"Content-Length\": [\n        \"70\"\n      ],\n      \"Content-Type\": [\n        \"application/json\"\n      ],\n      \"User-Agent\": [\n        \"PostmanRuntime/7.28.4\"\n      ]\n    },\n    \"method\": \"POST\",\n    \"uri\": \"/es/getTaskList\",\n    \"proto\": \"HTTP/1.1\",\n    \"body\": {\n      \"key\": \"kkk\",\n      \"type\": 1\n    }\n  },\n  \"original_response\": {\n    \"time\": 1636958850404046000,\n    \"latency\": 76000,\n    \"header\": {\n      \"Connection\": [\n        \"keep-alive\"\n      ],\n      \"Content-Type\": [\n        \"application/json; charset=UTF-8\"\n      ],\n      \"Date\": [\n        \"Mon, 15 Nov 2021 06:47:30 GMT\"\n      ],\n      \"Server\": [\n        \"nginx/1.21.4\"\n      ],\n      \"X-Powered-By\": [\n        \"PHP/7.1.33\"\n      ]\n    },\n    \"status\": \"200 OK\",\n    \"status_code\": 200,\n    \"proto\": \"HTTP/1.1\",\n    \"body\": {\n      \"code\": 200,\n      \"data\": [],\n      \"msg\": \"success\"\n    }\n  },\n  \"replayed_response\": {\n    \"time\": 1636958851470262000,\n    \"latency\": 21424000,\n    \"header\": {\n      \"Content-Length\": [\n        \"107\"\n      ],\n      \"Content-Type\": [\n        \"application/json; charset=utf-8\"\n      ],\n      \"Date\": [\n        \"Mon, 15 Nov 2021 06:46:55 GMT\"\n      ]\n    },\n    \"status\": \"200 OK\",\n    \"status_code\": 200,\n    \"proto\": \"HTTP/1.1\",\n    \"body\": {\n      \"code\": 200,\n      \"data\": [],\n      \"msg\": \"success\"\n    }\n  }\n}\n```\n\n## License\n\nThis project is under the terms of the [MIT](LICENSE) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshockerli%2Fgorc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshockerli%2Fgorc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshockerli%2Fgorc/lists"}