{"id":13826890,"url":"https://github.com/uwnetworkslab/cordova-plugin-tun2socks","last_synced_at":"2025-12-27T19:34:35.849Z","repository":{"id":53188232,"uuid":"61642646","full_name":"UWNetworksLab/cordova-plugin-tun2socks","owner":"UWNetworksLab","description":"Cordova plugin to enable a system-wide VPN for Android devices.","archived":false,"fork":false,"pushed_at":"2021-04-19T19:23:11.000Z","size":4857,"stargazers_count":51,"open_issues_count":6,"forks_count":24,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-05T09:15:49.793Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UWNetworksLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-21T14:53:44.000Z","updated_at":"2024-05-02T17:34:42.000Z","dependencies_parsed_at":"2022-09-14T14:11:27.350Z","dependency_job_id":null,"html_url":"https://github.com/UWNetworksLab/cordova-plugin-tun2socks","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/UWNetworksLab%2Fcordova-plugin-tun2socks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UWNetworksLab%2Fcordova-plugin-tun2socks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UWNetworksLab%2Fcordova-plugin-tun2socks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UWNetworksLab%2Fcordova-plugin-tun2socks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UWNetworksLab","download_url":"https://codeload.github.com/UWNetworksLab/cordova-plugin-tun2socks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225481022,"owners_count":17481137,"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-04T09:01:46.014Z","updated_at":"2025-12-27T19:34:35.783Z","avatar_url":"https://github.com/UWNetworksLab.png","language":"C","funding_links":[],"categories":["\u003ca id=\"863839860fab4b8601905205cac9b54f\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"471c124b012dbde8ea3288f35667efc8\"\u003e\u003c/a\u003e流量检测"],"readme":"# cordova-plugin-tun2socks\n\nThis Cordova plugin provides the ability to start a system-wide VPN for Android devices.\n\nWe use [tun2socks](https://github.com/ambrop72/badvpn-googlecode-export/blob/master/tun2socks/badvpn-tun2socks.8) as an adapter; it receives all of the device’s traffic through the VPN network interface (TUN) and forwards it to a SOCKS server.\n\nTo handle DNS resoution, we have implemented a local DNS resolver that intercepts DNS queries over UDP and proxies them over TCP (to Google Public DNS) through the SOCKS server.\n\n## Re-building the .so\n\nndk-build -C android\n\n### Target Devices\n\nThis plugin targets Android devices running Lollipop (API 21), or higher. This requirement stems from calling `addDisallowedApplication`, a [VPNService.Builder API](https://developer.android.com/reference/android/net/VpnService.Builder.html#addDisallowedApplication(java.lang.String)) introduced in version 21, which allows the specified application's traffic to bypass the VPN.\n\n### Javascript API\n\n`start(socksServerAddress:string) : Promise\u003cstring\u003e;`\n\nStarts the VPN service, and tunnels all the traffic to the SOCKS5 server at `socksServerAddress`.\nRestarts tunneling while preserving the VPN connection if called when the plugin is already running.\n\n`stop(): Promise\u003cstring\u003e;`\n\nStops the VPN service.\n\n`onDisconnect(): Promise\u003cstring\u003e;`\n\nSets a success callback on the returned promise, to be called if the VPN service gets revoked or disconnected.\n\n`deviceSupportsPlugin(): Promise\u003cBoolean\u003e;`\n\nRetruns true if the device runs the minimum required version for the plugin to function properly.\n\n### Code Sources\n\nWe re-use and have used as a starting point open source code from [Psiphon](https://psiphon.ca/uz@Latn/open-source.html), specifically https://github.com/mei3am/ps.\n\n * `src/android`:\n  * starting point: https://github.com/mei3am/ps/tree/master/Android/app\n  * `Android/app/src/main/java/ca/psiphon/PsiphonTunnel.java` -\u003e `src/android/org/uproxy/tun2socks/Tunnel.java`\n  * `Android/app/src/main/java/com/psiphon3/psiphonlibrary/TunnelManager.java` -\u003e `src/android/org/uproxy/tun2socks/TunnelManager.java`\n  * `Android/app/src/main/java/com/psiphon3/psiphonlibrary/TunnelVpnService.java` -\u003e `src/android/org/uproxy/tun2socks/TunnelVpnService.java`\n * `src/badvpn`:\n  * built upon Psiphon's fork of [badvpn](https://github.com/ambrop72/badvpn).\n  * starting point: https://github.com/mei3am/ps/tree/master/Android/badvpn\n  * uProxy-specific changes mostly confined to tun2socks/tun2socks.c and marked with `// ==== UPROXY ====` (like Psiphon-specific changes)\n * `src/android/libs/jsocks.jar`:\n  * http://jsocks.sourceforge.net/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuwnetworkslab%2Fcordova-plugin-tun2socks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuwnetworkslab%2Fcordova-plugin-tun2socks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuwnetworkslab%2Fcordova-plugin-tun2socks/lists"}