{"id":15700831,"url":"https://github.com/leonklingele/sockstun","last_synced_at":"2025-07-14T15:36:50.367Z","repository":{"id":57480384,"uuid":"170317106","full_name":"leonklingele/sockstun","owner":"leonklingele","description":"SOCKSTun – Tunnel TCP sockets through a SOCKS proxy","archived":false,"fork":false,"pushed_at":"2025-06-06T21:44:12.000Z","size":121,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-06T22:29:03.799Z","etag":null,"topics":["anonymity","privacy","socks","socks-proxy","socks5","tor","torsocks"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leonklingele.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}},"created_at":"2019-02-12T12:50:14.000Z","updated_at":"2025-06-06T21:44:12.000Z","dependencies_parsed_at":"2025-03-12T03:31:53.108Z","dependency_job_id":"79fa2b0a-e8ed-4381-a26e-49f5d6ba3874","html_url":"https://github.com/leonklingele/sockstun","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/leonklingele/sockstun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonklingele%2Fsockstun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonklingele%2Fsockstun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonklingele%2Fsockstun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonklingele%2Fsockstun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leonklingele","download_url":"https://codeload.github.com/leonklingele/sockstun/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonklingele%2Fsockstun/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265313009,"owners_count":23745185,"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":["anonymity","privacy","socks","socks-proxy","socks5","tor","torsocks"],"created_at":"2024-10-03T19:54:45.882Z","updated_at":"2025-07-14T15:36:50.335Z","avatar_url":"https://github.com/leonklingele.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SOCKSTun – Tunnel TCP sockets through a SOCKS proxy\n\n![build](https://github.com/leonklingele/sockstun/actions/workflows/build.yml/badge.svg)\n\n`sockstun` allows to proxy TCP packets from one socket to another through a SOCKS proxy.\n\n## Why this is useful\n\nSome applications such as Apple's Mail app don't support running with `torsocks`.\nIf you prefer to connect to your mail server through Tor for privacy reasons, `sockstun` will help you.\n\n## Installation\n\n```sh\ngo install github.com/leonklingele/sockstun/cmd/sockstun@latest\nsockstun -help\n```\n\n## Setup\n\n### Overview\n\nIn this setup guide we want to proxy TCP traffic reaching the following local ports through a Tor SOCKS proxy running at `localhost:9125`:\n\n- `localhost:1587` to `mail.leonklingele.de:587` (SMTP submission)\n- `localhost:1993` to `mail.leonklingele.de:993` (IMAP)\n\n### Setup guide\n\nFirst, ensure the domain you want to connect to resolves to localhost, in our case:\n\n```sh\n$ echo \"127.0.0.1 mail.leonklingele.de\" | sudo tee -a /etc/hosts\n```\n\nThen, edit `sockstun`'s config file:\n\n```sh\n$ cat ~/.sockstun/config.toml\n# SOCKS proxy URI\nsocks_uri  = \"socks5://localhost:9125\"\n# Read and write timeout, \"0s\" for no timeout\nrw_timeout = \"0s\"\n\n# Rule set\n[rules]\n[rules.mail-leonklingele-imap]\nlocal  = \"localhost:1993\"\nremote = \"mail.leonklingele.de:993\"\n[rules.mail-leonklingele-submission]\nlocal  = \"localhost:1587\"\nremote = \"mail.leonklingele.de:587\"\n```\n\n__Note__: If using a Tor SOCKS proxy, remember to [not mix modes of anonymity](https://trac.torproject.org/projects/tor/wiki/doc/TorifyHOWTO#Remember:Modesofanonymitydonotmix) and always isolate streams on a per-client-protocol-, per-destination-address- and per-destination-port-basis!\nSee section [Setting up multiple Tor sessions](#setting-up-multiple-tor-sessions) on how to set up another Tor session.\n\nNow simply start `sockstun`:\n\n```sh\n$ sockstun\nenabling proxy rule mail-leonklingele-submission (localhost:1587-\u003email.leonklingele.de:587)\nenabling proxy rule mail-leonklingele-imap (localhost:1993-\u003email.leonklingele.de:993)\n```\n\nTo test the setup:\n\n```sh\n$ openssl s_client -connect mail.leonklingele.de:1993\n[..]\n* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.\nfucksy wucksie!!\nfucksy BAD Error in IMAP command received by server.\n```\n\nRequests to `mail.leonklingele.de:1993` are now being proxied through Tor.\n\nIn order for Apple Mail to actually use the new setup, simply open Mail's preferences, and edit your account as follows:\n\nUse Port `1993` instead of `993`:\n\n![mail-settings-imap](https://www.leonklingele.de/sockstun/mail-settings-imap.png?20190212)\n\nUse Port `1587` instead of `587`:\n\n![mail-settings-submission](https://www.leonklingele.de/sockstun/mail-settings-submission.png?20190212)\n\n#### Using Tor Hidden Services (.onion domains)\n\n`sockstun` works with Tor Hidden Services, too!\n\n```sh\n$ cat ~/.sockstun/config.toml\n# SOCKS proxy URI\nsocks_uri  = \"socks5://localhost:9125\"\n# Read and write timeout, \"0s\" for no timeout\nrw_timeout = \"0s\"\n\n# Rule set\n[rules]\n[rules.mail-leonklingele-imap]\nlocal  = \"localhost:1993\"\nremote = \"gdgd33bknbocpyno5fraft356hh6hc7xaejchjjh4cxnbhxzduq2fiqd.onion:993\"\n[rules.mail-leonklingele-submission]\nlocal  = \"localhost:1587\"\nremote = \"gdgd33bknbocpyno5fraft356hh6hc7xaejchjjh4cxnbhxzduq2fiqd.onion:587\"\n```\n\n### Setting up multiple Tor sessions\n\nIt is advised to not use the same Tor instance for traffic of two different anonymity classes. Please read https://trac.torproject.org/projects/tor/wiki/doc/TorifyHOWTO#Remember:Modesofanonymitydonotmix before continuing.\n\nFollow these steps to launch another instance of Tor with a SOCKS proxy listening at `localhost:9125`:\n\n```sh\n$ mkdir -p ~/.sockstun\n$ cat \u003c\u003cEOF \u003e ~/.sockstun/torrc\n\tDataDirectory ~/.sockstun/tor\n\tSocksPort 127.0.0.1:9125 IsolateClientProtocol IsolateDestAddr IsolateDestPort\nEOF\n$ tor -f ~/.sockstun/torrc\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonklingele%2Fsockstun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonklingele%2Fsockstun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonklingele%2Fsockstun/lists"}