{"id":13522055,"url":"https://github.com/iCepa/tun2tor","last_synced_at":"2025-03-31T22:30:31.012Z","repository":{"id":46102757,"uuid":"43363677","full_name":"iCepa/tun2tor","owner":"iCepa","description":"A rust library to provide a virtual utun interface to Tor","archived":false,"fork":false,"pushed_at":"2021-11-14T21:33:30.000Z","size":4066,"stargazers_count":104,"open_issues_count":7,"forks_count":16,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-28T13:01:37.533Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/iCepa.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":"2015-09-29T11:35:44.000Z","updated_at":"2024-10-23T05:45:40.000Z","dependencies_parsed_at":"2022-08-22T19:41:06.960Z","dependency_job_id":null,"html_url":"https://github.com/iCepa/tun2tor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iCepa%2Ftun2tor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iCepa%2Ftun2tor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iCepa%2Ftun2tor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iCepa%2Ftun2tor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iCepa","download_url":"https://codeload.github.com/iCepa/tun2tor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246552043,"owners_count":20795756,"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-01T06:00:41.647Z","updated_at":"2025-03-31T22:30:29.450Z","avatar_url":"https://github.com/iCepa.png","language":"Rust","funding_links":[],"categories":["Applications","Uncategorized"],"sub_categories":["Other applications","Uncategorized"],"readme":"# tun2tor\n\n**This project will most probably be discontinued.**\n\nHave a look at [leaf](http://github.com/eycorsican/leaf), for something similar,\nwhich is written in latest Rust and is way more flexible and stable.\n\n[![Build Status](https://travis-ci.org/iCepa/tun2tor.svg?branch=master)](https://travis-ci.org/iCepa/tun2tor)\n\n`tun2tor` is a Rust library that creates a `utun` (userspace tunnel) interface, \nand connects it to to a stream-based proxy like `tor`. \nIt is primarily intended to be embedded in the [iCepa](https://github.com/iCepa/iCepa) \nproject, but it can also be used as a standalone utility.\n\nCurrently, only macOS and iOS are supported, although Linux support is almost there.\n\n`tun2tor` uses [`tokio`](https://github.com/tokio-rs/tokio) for async IO and \n[`LwIP`](http://savannah.nongnu.org/projects/lwip/) for its TCP implementation (for now).\n\n[API Documentation](https://conradev.github.io/tun2tor)\n\n## Running\n\nRunning `tun2tor` as a standalone utility is primarily useful for debugging at the moment. \nHere is how to get it running:\n\n```bash\n$ git clone --recursive https://github.com/iCepa/tun2tor.git\n$ cd tun2tor\n$ cargo build\n$ sudo RUST_BACKTRACE=1 target/debug/tun2tor\n```\n\n```bash\n$ brew install tor\n$ tor --DNSPort 12345 --AutomapHostsOnResolve 1\n```\n\nRunning it requires root privileges in order to create a `utun` interface. \n`tun2tor` is currently hardcoded in [`main.rs`](https://github.com/iCepa/tun2tor/blob/master/src/main.rs) \nto create an interface with an IP address of `172.30.20.1`, look for a SOCKS proxy at `127.0.0.1:9050`, \nand look for a DNS server at `127.0.0.1:12345`.\n\nIn order to route traffic through the interface, you need to modify the route table:\n\n```bash\n// Test DNS:\n$ sudo route add 8.8.8.8 172.30.20.1\n$ dig @8.8.8.8 facebookcorewwwi.onion\n\n// Test data:\n$ sudo route add 116.202.120.181 172.30.20.1 // check.torproject.org\n$ wget check.torproject.org\n```\n\n\n## Compiling for iOS\n\n```bash\n# If you use Homebrew:\n$ brew install rustup\n# (Note: Rust via brew can't give you the iOS targets! So do use Rustup!)\n\n# If not: (See https://rustup.rs)\n$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n\n# Add cross-compile targets for iOS:\n$ rustup target add aarch64-apple-ios x86_64-apple-ios\n\n# Install cargo-lipo to create universal binaries:\n$ cargo install cargo-lipo\n\n# Compile:\n$ cargo lipo\n\n# The binary can be found in target/universal/\n```\n\n## Creating a header file\n\n(Noted here for reference, in case you extend `tun2tor`.)\n\n```bash\n# Install header generator tool.\n$ cargo install cbindgen\n\n# Generate:\n$ cbindgen --cpp-compat --crate tun2tor --lang C --output tun2tor.h\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FiCepa%2Ftun2tor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FiCepa%2Ftun2tor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FiCepa%2Ftun2tor/lists"}