{"id":13775837,"url":"https://github.com/tonyseek/rsocks","last_synced_at":"2025-04-30T16:20:32.711Z","repository":{"id":28354682,"uuid":"31868451","full_name":"tonyseek/rsocks","owner":"tonyseek","description":"A SOCKS 4/5 reverse proxy server","archived":false,"fork":false,"pushed_at":"2022-09-20T07:11:29.000Z","size":301,"stargazers_count":131,"open_issues_count":2,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-14T05:39:27.028Z","etag":null,"topics":["gmail","python","reverse-proxy","socks5"],"latest_commit_sha":null,"homepage":"","language":"Python","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/tonyseek.png","metadata":{"files":{"readme":"README.rst","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":"2015-03-08T22:31:31.000Z","updated_at":"2025-03-02T23:13:14.000Z","dependencies_parsed_at":"2022-09-10T22:31:20.677Z","dependency_job_id":null,"html_url":"https://github.com/tonyseek/rsocks","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonyseek%2Frsocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonyseek%2Frsocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonyseek%2Frsocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonyseek%2Frsocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tonyseek","download_url":"https://codeload.github.com/tonyseek/rsocks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251739911,"owners_count":21635946,"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":["gmail","python","reverse-proxy","socks5"],"created_at":"2024-08-03T17:01:52.101Z","updated_at":"2025-04-30T16:20:32.687Z","avatar_url":"https://github.com/tonyseek.png","language":"Python","funding_links":[],"categories":["\u003ca id=\"d03d494700077f6a65092985c06bf8e8\"\u003e\u003c/a\u003e工具","Python"],"sub_categories":["\u003ca id=\"57b8e953d394bbed52df2a6976d98dfa\"\u003e\u003c/a\u003eSocks"],"readme":"RSOCKS\n======\n\nRSOCKS is a reverse proxy server for transferring traffic of a specific host\nthrough a SOCKS 4/5 proxy. It is useful for using SOCKS 4/5 in applications\nthat don't have SOCKS proxy support.\n\n\nInstallation\n------------\n\n::\n\n    $ pip install rsocks\n\nOr\n\n::\n\n    $ easy_install rsocks\n\n\nTo upgrade to latest version, you could execute::\n\n    $ pip install -U rsocks\n\n\nResources\n---------\n\n- `OS Service Templates \u003chttps://github.com/tonyseek/rsocks/tree/master/misc/platforms\u003e`_\n- `Configuration Snippets \u003chttps://github.com/tonyseek/rsocks/tree/master/misc/snippets/configuration\u003e`_\n- `Software Integration Guides \u003chttps://github.com/tonyseek/rsocks/wiki\u003e`_\n\n\nUsage\n-----\n\nFirst, we need to create a config file with following format::\n\n    # /path/to/rsocks.toml\n    [servers.foo]\n    proxy = \"socks4://user:pass@192.168.1.10:1080\"\n    listen_host = \"0.0.0.0\"\n    listen_port = 5025\n    upstream_host = \"smtp.example.com\"\n    upstream_port = 25\n    upstream_ssl = false\n\nThere is an example for forwarding SMTP/IMAP of Gmail through a SOCKS5 proxy\nserver::\n\n    [servers.imap]\n    proxy = \"socks5://localhost:1080\"\n    listen_port = 5993\n    upstream_host = \"imap.gmail.com\"\n    upstream_port = 993\n    upstream_ssl = true\n\n    [servers.smtp]\n    proxy = \"socks5://localhost:1080\"\n    listen_port = 5465\n    upstream_host = \"smtp.gmail.com\"\n    upstream_port = 465\n    upstream_ssl = true\n\nNext, we start the rsocks server::\n\n    $ rsocks --config=/path/to/rsocks.toml\n    [14:24:44] rsocks.servers.smtp       Using proxy server socks5://localhost:1080\n    [14:24:44] rsocks.servers.smtp       Listening 127.0.0.1:5465\n    [14:24:44] rsocks.servers.imap       Using proxy server socks5://localhost:1080\n    [14:24:44] rsocks.servers.imap       Listening 127.0.0.1:5993\n    [14:24:44] rsocks.pool               Prepared \"smtp\"\n    [14:24:44] rsocks.pool               Prepared \"imap\"\n    [14:24:44] rsocks.servers.smtp       Starting server...\n    [14:24:44] rsocks.servers.imap       Starting server...\n\nDon't stop it now, open your application (such as Airmail in OS X) and set the\nserver option to local forwarding address::\n\n    SMTP: 127.0.0.1:5465 without SSL\n    IMAP: 127.0.0.1:5993 without SSL\n\nNow the application's traffic will be forwarded through the proxy server\n(``socks5://127.0.0.1:1080``).\n\nIf you wish to run the rsocks server in background, please check the\n`Platform Service Templates \u003chttps://github.com/tonyseek/rsocks/tree/master/misc/platforms\u003e`_.\nFor example, OS X users can create ``com.tonyseek.rsocks.plist`` file in\n``~/Library/LaunchAgents`` and load it as a service::\n\n    $ nano ~/.rsocks.toml  # create a config file\n    $ wget https://github.com/tonyseek/rsocks/blob/master/misc/platforms/osx-launchd/com.tonyseek.rsocks.plist \\\n          -O ~/Library/LaunchAgents/com.tonyseek.rsocks.plist\n    $ nano ~/Library/LaunchAgents/com.tonyseek.rsocks.plist  # edit the template\n    $ launchctl load -w ~/Library/LaunchAgents/com.tonyseek.rsocks.plist\n\n\nAPI Overview\n------------\n\nThere is an example for using API to build a server:\n\n.. code-block:: python\n\n    import os\n\n    from rsocks.pool import ServerPool\n    from rsocks.server import ReverseProxyServer\n\n    proxy = os.environ.get('SOCKS_PROXY', 'socks5://localhost:1080')\n    pool = ServerPool()\n\n    with pool.new_server(\n            name='IMAP',\n            server_class=ReverseProxyServer,\n            upstream=('imap.gmail.com', 993),\n            use_ssl=True) as server:\n        server.set_proxy(proxy)\n        server.listen(('127.0.0.1', 5993))\n\n    with pool.new_server(\n            name='SMTP',\n            server_class=ReverseProxyServer,\n            upstream=('smtp.gmail.com', 465),\n            use_ssl=True) as server:\n        server.set_proxy(proxy)\n        server.listen(('127.0.0.1', 5465))\n\n    if __name__ == '__main__':\n        pool.loop()\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonyseek%2Frsocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftonyseek%2Frsocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonyseek%2Frsocks/lists"}