{"id":17910135,"url":"https://github.com/austingebauer/go-tcp-proxy","last_synced_at":"2026-03-10T22:01:41.513Z","repository":{"id":117860700,"uuid":"198859753","full_name":"austingebauer/go-tcp-proxy","owner":"austingebauer","description":"A TCP proxy that exposes telemetry metrics via Prometheus instrumentation.","archived":false,"fork":false,"pushed_at":"2023-02-15T04:51:38.000Z","size":167,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-15T07:33:21.717Z","etag":null,"topics":["prometheus","proxy","tcp"],"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/austingebauer.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}},"created_at":"2019-07-25T15:45:25.000Z","updated_at":"2025-12-21T05:21:41.000Z","dependencies_parsed_at":"2023-07-07T21:32:25.003Z","dependency_job_id":null,"html_url":"https://github.com/austingebauer/go-tcp-proxy","commit_stats":null,"previous_names":["austingebauer/go-tcp-metrics-proxy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/austingebauer/go-tcp-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austingebauer%2Fgo-tcp-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austingebauer%2Fgo-tcp-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austingebauer%2Fgo-tcp-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austingebauer%2Fgo-tcp-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/austingebauer","download_url":"https://codeload.github.com/austingebauer/go-tcp-proxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austingebauer%2Fgo-tcp-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30357614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"ssl_error","status_checked_at":"2026-03-10T21:40:59.357Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["prometheus","proxy","tcp"],"created_at":"2024-10-28T19:29:20.044Z","updated_at":"2026-03-10T22:01:41.490Z","avatar_url":"https://github.com/austingebauer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-tcp-proxy\n\nA simple TCP proxy that exposes network telemetry metrics via Prometheus instrumentation.\n\nSee [exposed telemetry metrics](#telemetry-metrics-exposed) for a list of metrics exposed by the proxy.\n\n## Installation\n\n```bash\ngo get github.com/austingebauer/go-tcp-metrics-proxy\ncd go-tcp-metrics-proxy\nmake\n```\n\nAn executable named `proxy` will be placed into the bin \ndirectory after the make target completes.\n\n## Usage\n\ngo-tcp-metrics-proxy is configured using command line arguments.\n\nThe example below shows the usage of go-tcp-metrics-proxy using netcat as a client and server.\n\n### 1. Start listening for TCP connections\n\n```bash\nnc -k -l 127.0.0.1 3001\n```\n\n### 2. Start the TCP proxy\n\n```bash\n./bin/proxy -listen=\"127.0.0.1:3000\" -target=\"127.0.0.1:3001\" -metrics=\"127.0.0.1:3002\"\n```\n\n### 3. Connect to the TCP proxy\n\n```bash\nnc 127.0.0.1 3000\n```\n\n### 4. View Prometheus Telemetry Metrics\n\n```bash\ncurl http://localhost:3002/metrics\n```\n\n### 5. Send bytes from client to server\n\nIn the window running the netcat TCP client program, type the following followed by a carriage return:\n```bash\nHello, server!\n```\n\nObserve that the message has been arrived on the netcat TCP server as terminal output.\n\nSending bytes from server to client works the same way, so give that a try as well.\n\n### 6. View Prometheus Telemetry Metrics.. Again! \n\n ```bash\n curl http://localhost:3000/metrics\n ```\n\nObserve that metrics related to TCP connections handled by the proxy have been updated.\n \n### 7. Send SIGTERM to the proxy\n\nObserve that the proxy will gracefully terminate when a SIGTERM has been received by draining all \nexisting connections until they're finished.\n\n### 8. Send SIGTERM to TCP client or server\n\nObserve that the proxy will finally exit after either the client or server closes its end of the connection. \n\n## Telemetry Metrics Exposed\n\nThe following is a list of telemetry metrics exposed by the proxy in \n[prometheus text-based format](https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md#text-based-format)\n\nMetrics related to Go have been omitted from the `/metrics` results below in order to showcase \nthe TCP proxy related metrics.\n\n```\n# HELP active_inbound_connections The number of currently active inbound connections\n# TYPE active_inbound_connections gauge\nactive_inbound_connections{id=\"75fc83c4-2109-4757-8660-896c170303c3\"} 0\n# HELP active_outbound_connections The number of currently active outbound connections\n# TYPE active_outbound_connections gauge\nactive_outbound_connections{id=\"75fc83c4-2109-4757-8660-896c170303c3\"} 0\n# HELP inbound_bytes_count The total number of bytes sent and received on inbound connections\n# TYPE inbound_bytes_count counter\ninbound_bytes_count{id=\"75fc83c4-2109-4757-8660-896c170303c3\"} 15\n# HELP inbound_connection_count The total number of inbound connections established\n# TYPE inbound_connection_count counter\ninbound_connection_count{id=\"75fc83c4-2109-4757-8660-896c170303c3\"} 1\n# HELP outbound_bytes_count The total number of bytes sent and received on outbound connections\n# TYPE outbound_bytes_count counter\noutbound_bytes_count{id=\"75fc83c4-2109-4757-8660-896c170303c3\"} 15\n# HELP outbound_connection_count The total number of outbound connections established\n# TYPE outbound_connection_count counter\noutbound_connection_count{id=\"75fc83c4-2109-4757-8660-896c170303c3\"} 1\n# HELP promhttp_metric_handler_requests_in_flight Current number of scrapes being served.\n# TYPE promhttp_metric_handler_requests_in_flight gauge\npromhttp_metric_handler_requests_in_flight 1\n# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.\n# TYPE promhttp_metric_handler_requests_total counter\npromhttp_metric_handler_requests_total{code=\"200\"} 3\npromhttp_metric_handler_requests_total{code=\"500\"} 0\npromhttp_metric_handler_requests_total{code=\"503\"} 0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustingebauer%2Fgo-tcp-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faustingebauer%2Fgo-tcp-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustingebauer%2Fgo-tcp-proxy/lists"}