{"id":13826918,"url":"https://github.com/davlxd/NEPacketTunnelVPNDemo","last_synced_at":"2025-07-09T02:32:35.335Z","repository":{"id":145120001,"uuid":"75892323","full_name":"davlxd/NEPacketTunnelVPNDemo","owner":"davlxd","description":"iOS VPN client implementation demo based on iOS9 NetworkExtension NETunnelProvider APIs","archived":true,"fork":false,"pushed_at":"2020-07-12T10:00:23.000Z","size":1279,"stargazers_count":211,"open_issues_count":19,"forks_count":73,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-08-04T09:06:00.683Z","etag":null,"topics":["demo","ios","network-extension","packet-tunnel","swift-3","tun","tunnel"],"latest_commit_sha":null,"homepage":null,"language":"Swift","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/davlxd.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}},"created_at":"2016-12-08T01:49:33.000Z","updated_at":"2024-07-14T10:36:28.000Z","dependencies_parsed_at":"2024-01-07T22:50:00.773Z","dependency_job_id":"5d51b7d8-408f-4d87-a36a-b18fefa2a8d6","html_url":"https://github.com/davlxd/NEPacketTunnelVPNDemo","commit_stats":null,"previous_names":["lxdcn/nepackettunnelvpndemo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davlxd/NEPacketTunnelVPNDemo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davlxd%2FNEPacketTunnelVPNDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davlxd%2FNEPacketTunnelVPNDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davlxd%2FNEPacketTunnelVPNDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davlxd%2FNEPacketTunnelVPNDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davlxd","download_url":"https://codeload.github.com/davlxd/NEPacketTunnelVPNDemo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davlxd%2FNEPacketTunnelVPNDemo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264380383,"owners_count":23599039,"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":["demo","ios","network-extension","packet-tunnel","swift-3","tun","tunnel"],"created_at":"2024-08-04T09:01:46.725Z","updated_at":"2025-07-09T02:32:34.970Z","avatar_url":"https://github.com/davlxd.png","language":"Swift","funding_links":[],"categories":["\u003ca id=\"692d86299dedab073fbb6144a5b2bd64\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"471c124b012dbde8ea3288f35667efc8\"\u003e\u003c/a\u003e流量检测"],"readme":"Apple released a new version of `Network Extension` since iOS9, which allows us to implement our own VPN protocol. This repo provides a simple demo using `Network Extension` with Swift 3.\n\nServer side demo is [here](https://github.com/lxdcn/simple-vpn-demo).\n\nThis demo and server side demo are extremely simplified and only for demonstration purposes, a lot of stuff are hard coded. Further design and elaboration are required if you want apply this demo to your app.\n\nInspired by [ShadowVPN-iOS](https://github.com/clowwindy/ShadowVPN-iOS).\n\n## Prerequisites to build\n\n1. ~~~First, you need to request NetworkExtension entitlement for your Apple ID from Apple by filling the form here: https://developer.apple.com/contact/network-extension. From my experience, it gonna take 2-6 weeks for Apple to process your request.~~~  2017-12-16 Update: This is no longer needed.\n\n2. Then you need an iPhone. Network Extension App cannot run in iOS Simulators, you need a real iPhone to debug.\n\n3. Login Apple [developer portal](https://developer.apple.com/account/ios/certificate), register 2 new App IDs, one for App target and another for NetworkExtension tunnel target. And make sure `App Groups` and `Network Extensions` are checked in `App Services` section.\n\n4. Register an `App Group` in developer portal as well\n\n5. Then, again in `App IDs` section of developer portal, edit the 2 App IDs you created at 3rd step, configure `App Groups` to the app group you created at 4th step.\n\n6. Also in developer portal, generate 2 iOS App Development provision profiles for the 2 App IDs created before, ~~~make sure `Network Extension` entitlement is selected on 'Do you need additional entitlements?' page~~~ (2017-12-27 Update: This is probably not needed as well). Then download them and save them to disk.\n\n7. Open this xcodeproj with XCode, select `NEPacketTunnelVPNDemo` target, in `General \u003e Identity` section, change `Bundle Identifier` to App ID you created. Then import profiles you generated in `General \u003e Signing (Debug)` section and `General \u003e Signing (Release)` section.\n\n8. Do the same thing for `NEPacketTunnelVPNDemoTunnel` target.\n\n9. Find a Linux machine, build and run [simple-vpn-demo](https://github.com/lxdcn/simple-vpn-demo), fill its IP address to [ViewController.swift](https://github.com/lxdcn/NEPacketTunnelVPNDemo/blob/master/NEPacketTunnelVPNDemo/ViewController.swift#L18).\n\n## Run\n\n1. After build \u0026 run `simple-vpn-demo`, your terminal should be like [this](https://raw.githubusercontent.com/lxdcn/NEPacketTunnelVPNDemo/master/doc/simple-vpn-demo-terminal-before.png).\n\n2. After build \u0026 run `NEPacketTunnelVPNDemo` on your iPhone, Xcode log window should look like [this](https://raw.githubusercontent.com/lxdcn/NEPacketTunnelVPNDemo/master/doc/xcode-log-window-before.png), iPhone screen should look like [this](https://raw.githubusercontent.com/lxdcn/NEPacketTunnelVPNDemo/master/doc/iphone-before.png).\n\n3. The `Connect` at the center of iPhone screen is a **BUTTON**, after you click it, your iPhone screen should look like [this](https://raw.githubusercontent.com/lxdcn/NEPacketTunnelVPNDemo/master/doc/iphone-after.png), and Xcode log window should look like [this](https://raw.githubusercontent.com/lxdcn/NEPacketTunnelVPNDemo/master/doc/xcode-log-window-after.png). `simple-vpn-demo` terminal window should look like [this](https://raw.githubusercontent.com/lxdcn/NEPacketTunnelVPNDemo/master/doc/simple-vpn-demo-terminal-after.png), which means VPN server is now receiving traffic.\n\n4. Your IP address displaying on [http://whatismyipaddress.com/](http://whatismyipaddress.com/) on your iPhone should be different before and after click the `Connect` button. thus Q.E.D.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavlxd%2FNEPacketTunnelVPNDemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavlxd%2FNEPacketTunnelVPNDemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavlxd%2FNEPacketTunnelVPNDemo/lists"}