Giter VIP home page Giter VIP logo

nepackettunnelvpndemo's Introduction

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.

Server side demo is here.

This 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.

Inspired by ShadowVPN-iOS.

Prerequisites to build

  1. 
    
  2. Then you need an iPhone. Network Extension App cannot run in iOS Simulators, you need a real iPhone to debug.

  3. Login Apple developer portal, 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.

  4. Register an App Group in developer portal as well

  5. 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.

  6. 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.

  7. Open this xcodeproj with XCode, select NEPacketTunnelVPNDemo target, in General > Identity section, change Bundle Identifier to App ID you created. Then import profiles you generated in General > Signing (Debug) section and General > Signing (Release) section.

  8. Do the same thing for NEPacketTunnelVPNDemoTunnel target.

  9. Find a Linux machine, build and run simple-vpn-demo, fill its IP address to ViewController.swift.

Run

  1. After build & run simple-vpn-demo, your terminal should be like this.

  2. After build & run NEPacketTunnelVPNDemo on your iPhone, Xcode log window should look like this, iPhone screen should look like this.

  3. The Connect at the center of iPhone screen is a BUTTON, after you click it, your iPhone screen should look like this, and Xcode log window should look like this. simple-vpn-demo terminal window should look like this, which means VPN server is now receiving traffic.

  4. Your IP address displaying on http://whatismyipaddress.com/ on your iPhone should be different before and after click the Connect button. thus Q.E.D.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.