{"id":13775756,"url":"https://github.com/igrigorik/em-proxy","last_synced_at":"2025-05-15T06:04:29.764Z","repository":{"id":547527,"uuid":"177620","full_name":"igrigorik/em-proxy","owner":"igrigorik","description":"EventMachine Proxy DSL for writing high-performance transparent / intercepting proxies in Ruby","archived":false,"fork":false,"pushed_at":"2022-10-05T22:44:07.000Z","size":110,"stargazers_count":660,"open_issues_count":5,"forks_count":82,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-04-15T01:58:46.906Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.igvita.com/2009/04/20/ruby-proxies-for-scale-and-monitoring/","language":"Ruby","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/igrigorik.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2009-04-16T14:47:30.000Z","updated_at":"2025-01-10T15:00:13.000Z","dependencies_parsed_at":"2022-07-04T22:31:45.167Z","dependency_job_id":null,"html_url":"https://github.com/igrigorik/em-proxy","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrigorik%2Fem-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrigorik%2Fem-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrigorik%2Fem-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igrigorik%2Fem-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igrigorik","download_url":"https://codeload.github.com/igrigorik/em-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254283337,"owners_count":22045140,"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":[],"created_at":"2024-08-03T17:01:48.400Z","updated_at":"2025-05-15T06:04:29.737Z","avatar_url":"https://github.com/igrigorik.png","language":"Ruby","funding_links":[],"categories":["\u003ca id=\"d03d494700077f6a65092985c06bf8e8\"\u003e\u003c/a\u003e工具","Ruby"],"sub_categories":["\u003ca id=\"0ff94312f3ab4898f5996725133ea9d1\"\u003e\u003c/a\u003e未分类"],"readme":"# EM-Proxy\n\n[![Build Status](https://travis-ci.org/igrigorik/em-proxy.png?branch=master)](https://travis-ci.org/igrigorik/em-proxy)\n\nEventMachine Proxy DSL for writing high-performance transparent / intercepting proxies in Ruby.\n\n- EngineYard tutorial: [Load testing your environment using em-proxy](http://docs.engineyard.com/em-proxy.html)\n- [Slides from RailsConf 2009](http://bit.ly/D7oWB)\n- [GoGaRuCo notes \u0026 Slides](http://www.igvita.com/2009/04/20/ruby-proxies-for-scale-and-monitoring/)\n\n## Getting started\n\n    $\u003e gem install em-proxy\n    $\u003e em-proxy\n    Usage: em-proxy [options]\n      -l, --listen [PORT]              Port to listen on\n      -d, --duplex [host:port, ...]    List of backends to duplex data to\n      -r, --relay [hostname:port]      Relay endpoint: hostname:port\n      -s, --socket [filename]          Relay endpoint: unix filename\n      -v, --verbose                    Run in debug mode\n\n    $\u003e em-proxy -l 8080 -r localhost:8081 -d localhost:8082,localhost:8083 -v\n\nThe above will start em-proxy on port 8080, relay and respond with data from port 8081, and also (optional) duplicate all traffic to ports 8082 and 8083 (and discard their responses).\n\n\n## Simple port forwarding proxy\n\n```ruby\nProxy.start(:host =\u003e \"0.0.0.0\", :port =\u003e 80, :debug =\u003e true) do |conn|\n  conn.server :srv, :host =\u003e \"127.0.0.1\", :port =\u003e 81\n\n  # modify / process request stream\n  conn.on_data do |data|\n    p [:on_data, data]\n    data\n  end\n\n  # modify / process response stream\n  conn.on_response do |backend, resp|\n    p [:on_response, backend, resp]\n    resp\n  end\n\n  # termination logic\n  conn.on_finish do |backend, name|\n    p [:on_finish, name]\n\n    # terminate connection (in duplex mode, you can terminate when prod is done)\n    unbind if backend == :srv\n  end\nend\n```\n\nFor more examples see the /examples directory.\n\n- SMTP Spam Filtering\n- Duplicating traffic\n- Selective forwarding\n- Beanstalkd interceptor\n- etc.\n\nA schema-free MySQL proof of concept, via an EM-Proxy server:\n\n- http://www.igvita.com/2010/03/01/schema-free-mysql-vs-nosql/\n- Code in examples/schemaless-mysql\n\n## License\n\nThe MIT License - Copyright (c) 2010 Ilya Grigorik\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figrigorik%2Fem-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figrigorik%2Fem-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figrigorik%2Fem-proxy/lists"}