├── .github
└── workflows
│ └── build-demo.yaml
├── .gitignore
├── .metadata
├── CHANGELOG.md
├── LICENSE
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── build.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── id
│ └── laskarmedia
│ └── openvpn_flutter
│ └── OpenVPNFlutterPlugin.java
├── example
├── .github
│ └── workflows
│ │ └── demo.yaml
├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ └── id
│ │ │ │ └── laskarmedia
│ │ │ │ └── openvpn_flutter_example
│ │ │ │ └── MainActivity.kt
│ │ │ └── res
│ │ │ ├── drawable-v21
│ │ │ └── launch_background.xml
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-night
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ ├── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ │ └── LaunchImage.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchImage.png
│ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ └── README.md
│ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── Runner-Bridging-Header.h
│ │ └── Runner.entitlements
│ └── VPNExtension
│ │ ├── Info.plist
│ │ ├── PacketTunnelProvider.swift
│ │ └── VPNExtension.entitlements
├── lib
│ └── main.dart
├── pubspec.lock
└── pubspec.yaml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── ios
├── .gitignore
├── Assets
│ └── .gitkeep
├── Classes
│ ├── OpenVPNFlutterPlugin.h
│ ├── OpenVPNFlutterPlugin.m
│ └── SwiftOpenVPNFlutterPlugin.swift
└── openvpn_flutter.podspec
├── lib
├── openvpn_flutter.dart
└── src
│ ├── model
│ └── vpn_status.dart
│ └── vpn_engine.dart
└── pubspec.yaml
/.github/workflows/build-demo.yaml:
--------------------------------------------------------------------------------
1 | name: Openvpn_flutter
2 | on: push
3 |
4 | jobs:
5 | build:
6 | name: Build Flutter Artifacts
7 | runs-on: ubuntu-latest
8 | strategy:
9 | matrix:
10 | target: [documentation, apks]
11 | steps:
12 | - name: Checkout code
13 | uses: actions/checkout@v2
14 |
15 | - name: Set up JDK 21
16 | if: matrix.target != 'documentation'
17 | uses: actions/setup-java@v2
18 | with:
19 | distribution: 'adopt'
20 | java-version: '21.x'
21 |
22 | - name: Install Flutter SDK
23 | uses: subosito/flutter-action@v2
24 | with:
25 | channel: 'stable'
26 |
27 | - name: Flutter pub get
28 | run: flutter pub get
29 |
30 | - name: Build Documentation
31 | if: matrix.target == 'documentation'
32 | run: |
33 | flutter pub global activate dartdoc
34 | flutter pub global run dartdoc
35 |
36 | - name: Build APKs (Split by ABI)
37 | if: matrix.target == 'apks'
38 | run: cd example && flutter build apk --release --split-per-abi
39 |
40 | - name: Upload artifacts
41 | if: matrix.target == 'apks' || matrix.target == 'appbundle'
42 | uses: actions/upload-artifact@v4
43 | with:
44 | name: publish-artifacts-${{ matrix.target }}
45 | path: |
46 | build/app/outputs/flutter-apk/*.apk
47 | if-no-files-found: ignore
48 | overwrite: true
49 |
50 | publish:
51 | name: Publish the binaries
52 | needs: build
53 | runs-on: ubuntu-latest
54 | steps:
55 | - uses: actions/checkout@v2
56 |
57 | - name: Get project version
58 | id: project_version
59 | uses: its404/get-flutter-version@v1.0.0
60 |
61 | - name: Download apks
62 | uses: actions/download-artifact@v4
63 | with:
64 | name: publish-artifacts-apks
65 | path: build/app/outputs/flutter-apk
66 |
67 | - name: Release Binary
68 | uses: ncipollo/release-action@v1
69 | with:
70 | artifacts: "build/app/outputs/bundle/release/*.aab, build/app/outputs/flutter-apk/*.apk"
71 | token: ${{ secrets.GITHUB_TOKEN }}
72 | tag: v${{ steps.project_version.outputs.version_number }}+${{steps.project_version.outputs.build_number}}-${{github.run_number}}
73 | name: "Release ${{ steps.project_version.outputs.version_number }}+${{steps.project_version.outputs.build_number}}"
74 | generateReleaseNotes: true
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | .gradle/
12 | .vscode/launch.json
13 | .vscode/
14 |
15 | # IntelliJ related
16 | *.iml
17 | *.ipr
18 | *.iws
19 | .idea/
20 |
21 | # The .vscode folder contains launch configuration and tasks you configure in
22 | # VS Code which you may wish to be included in version control, so this line
23 | # is commented out by default.
24 | #.vscode/
25 |
26 | # Flutter/Dart/Pub related
27 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
28 | /pubspec.lock
29 | **/doc/api/
30 | .dart_tool/
31 | .packages
32 | build/
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
8 | channel: stable
9 |
10 | project_type: plugin
11 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 1.3.4
2 | * Fix notification issue for newest SDK
3 | ## 1.3.3
4 | * Solving namespace for android build
5 | ## 1.3.2
6 | * Fix datetime that being nulled (VPN Status)
7 | ## 1.3.1
8 | * Upgrade library gradles
9 | * Update native for Permission channel name ($APPNAME VPN Background & $APPNAME VPN Stats)
10 | * Clearify notifications on readme.md
11 | ## 1.3.0
12 | * Adept for SDK 34
13 | * Solving #105, #29, #99
14 | * Update examples to support flutter latest flutter (3.22.2 tested)
15 | ## 1.2.2
16 | * Update openvpnlib
17 | ## 1.2.1
18 | * Update openvpnlib
19 | ## 1.2.0+1
20 | * Update docs
21 | ## 1.2.0
22 | * Fix iOS issues (byteIn and byteOut not updated) #6
23 | * Add lastStatus and lastStage listener while initialize
24 | * Add packetsIn, packetsOut and connectedOn status
25 | * Update licenses to GPL3 (Before it was MIT)
26 | ## 1.1.3
27 | * Add permission request for android ```requestPermissionAndroid()``` #5
28 | * Continue the connection after user grant vpn connection #8
29 | ## 1.1.2
30 | * Fix exported errors on SDK 31
31 | * PendingIntent errors fixes
32 | ## 1.1.1+1
33 | * Update readme, more detail about iOS setup
34 | ## 1.1.1
35 | * Fix iOS by Adding PacketTunnelProvider
36 | * More detail at instructions
37 | * Fix VPNStatus not updated after disconnected
38 | ## 1.1.0
39 | * Add 'raw' on onVpnStageChanged
40 | * Add details on doc
41 | * Fix duration still going on failed to connect
42 | ## 1.0.1+2
43 | * Solving scores
44 | ## 1.0.1+1
45 | * iOS Support
46 | * Android Support
47 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Connect to the OpenVPN service using Flutter. Contributions through issues and pull requests are highly appreciated!
2 |
3 | ## Android Setup
4 |
5 | ### 1. Permission Handler
6 |
7 | #### Java
8 | Include the following code in the `onActivityResult` method of `MainActivity.java` (if you are using Java):
9 |
10 | ```java
11 | OpenVPNFlutterPlugin.connectWhileGranted(requestCode == 24 && resultCode == RESULT_OK);
12 | ```
13 |
14 | The complete method should look like this:
15 |
16 | ```java
17 | ...
18 | import id.laskarmedia.openvpn_flutter.OpenVPNFlutterPlugin;
19 | ...
20 |
21 | @Override
22 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
23 | OpenVPNFlutterPlugin.connectWhileGranted(requestCode == 24 && resultCode == RESULT_OK);
24 | super.onActivityResult(requestCode, resultCode, data);
25 | }
26 | ```
27 |
28 | #### Kotlin
29 | Include the following code in the `onActivityResult` method of `MainActivity.kt` (if you are using Kotlin):
30 |
31 | ```kotlin
32 | OpenVPNFlutterPlugin.connectWhileGranted(requestCode == 24 && resultCode == RESULT_OK);
33 | ```
34 |
35 | The complete method should look like this:
36 |
37 | ```kotlin
38 | ...
39 | import id.laskarmedia.openvpn_flutter.OpenVPNFlutterPlugin
40 | ...
41 | override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
42 | OpenVPNFlutterPlugin.connectWhileGranted(requestCode == 24 && resultCode == RESULT_OK)
43 | super.onActivityResult(requestCode, resultCode, data)
44 | }
45 | ```
46 |
47 | ### 2. App Bundle Build Not Connecting
48 |
49 | If you encounter issues with the app not connecting using the latest Flutter SDK, apply the following quick fix:
50 |
51 | Ensure that you include the following attribute within the `` tag in your `AndroidManifest.xml` file:
52 |
53 | ```xml
54 |
58 |
59 | ```
60 |
61 | ## iOS Setup
62 |
63 | ### 1. Add Capabilities
64 |
65 | Add the `App Groups` and `Network Extensions` capabilities to the Runner's target. Refer to the image below for detailed instructions:
66 |
67 |
68 |
69 | ### 2. Add New Target
70 |
71 | Click the `+` button on the bottom left, choose `NETWORK EXTENSION`, and follow the instructions in the image below:
72 |
73 |
74 |
75 | Add the same capabilities to the VPNExtension as you did for the Runner's target:
76 |
77 |
78 |
79 | ### 3. Copy and Paste
80 |
81 | Add the following lines to your Podfile (`ios/Podfile`):
82 |
83 | ```dart
84 | target 'VPNExtension' do
85 | use_frameworks!
86 | pod 'OpenVPNAdapter', :git => 'https://github.com/ss-abramchuk/OpenVPNAdapter.git', :tag => '0.8.0'
87 | end
88 | ```
89 |
90 | Open `VPNExtension > PacketTunnelProvider.swift` and copy-paste the script from [PacketTunnelProvider.swift](https://raw.githubusercontent.com/nizwar/openvpn_flutter/master/example/ios/VPNExtension/PacketTunnelProvider.swift).
91 |
92 |
93 |
94 | ## Note
95 |
96 | You must use iOS devices instead of the simulator to connect.
97 |
98 | ## Recipe
99 |
100 | ### Initialize
101 |
102 | Before starting, initialize the OpenVPN plugin:
103 |
104 | ```dart
105 | late OpenVPN openvpn;
106 |
107 | @override
108 | void initState() {
109 | openvpn = OpenVPN(onVpnStatusChanged: _onVpnStatusChanged, onVpnStageChanged: _onVpnStageChanged);
110 | openvpn.initialize(
111 | groupIdentifier: "GROUP_IDENTIFIER", ///Example 'group.com.laskarmedia.vpn'
112 | providerBundleIdentifier: "NETWORK_EXTENSION_IDENTIFIER", ///Example 'id.laskarmedia.openvpnFlutterExample.VPNExtension'
113 | localizedDescription: "LOCALIZED_DESCRIPTION" ///Example 'Laskarmedia VPN'
114 | );
115 | }
116 |
117 | void _onVpnStatusChanged(VPNStatus? vpnStatus){
118 | setState((){
119 | this.status = vpnStatus;
120 | });
121 | }
122 |
123 | void _onVpnStageChanged(VPNStage? stage){
124 | setState((){
125 | this.stage = stage;
126 | });
127 | }
128 | ```
129 |
130 | ### Connect to VPN
131 |
132 | ```dart
133 | void connect() {
134 | openvpn.connect(
135 | config,
136 | name,
137 | username: username,
138 | password: password,
139 | bypassPackages: [],
140 | // In iOS connection can get stuck in "connecting" if this flag is "false".
141 | // Solution is to switch it to "true".
142 | certIsRequired: false,
143 | );
144 | }
145 | ```
146 |
147 | ### Disconnect
148 |
149 | ```dart
150 | void disconnect(){
151 | openvpn.disconnect();
152 | }
153 | ```
154 |
155 | # Publishing to Play Store and App Store
156 |
157 | ### Android
158 |
159 | 1. You can use app bundles to publish the app.
160 | 2. Add the following to your files in the `android` folder (special thanks to https://github.com/nizwar/openvpn_flutter/issues/10). Otherwise, the connection may not be established in some cases and will silently report "disconnected" when trying to connect. This is likely related to some symbols being stripped by Google Play.
161 |
162 | ```
163 | gradle.properties > android.bundle.enableUncompressedNativeLibs=false
164 | AndroidManifest > android:extractNativeLibs="true" in the application tag
165 | ```
166 |
167 | Add the following inside the `android` tag in `app/build.gradle`:
168 |
169 | ```gradle
170 | android {
171 | ...
172 | //from here ======
173 | lintOptions {
174 | disable 'InvalidPackage'
175 | checkReleaseBuilds false
176 | }
177 |
178 | packagingOptions {
179 | jniLibs {
180 | useLegacyPackaging = true
181 | }
182 | }
183 |
184 | bundle {
185 | language {
186 | enableSplit = false
187 | }
188 | density {
189 | enableSplit = false
190 | }
191 | abi {
192 | enableSplit = false
193 | }
194 | }
195 | //to here
196 | ...
197 | }
198 | ```
199 |
200 | #### Notifications
201 |
202 | As the plugin shows notifications for connection status and connection details, you must request permission using third-party packages.
203 |
204 | Example using [permission_handler](https://pub.dev/packages/permission_handler):
205 |
206 | ```dart
207 | ///Put it anywhere you wish, like once you initialize the VPN or pre-connect to the server
208 | Permission.notification.isGranted.then((_) {
209 | if (!_) Permission.notification.request();
210 | });
211 | ```
212 |
213 | ### iOS
214 |
215 | 1. View [Apple Guidelines](https://developer.apple.com/app-store/review/guidelines/#vpn-apps) relating to VPN.
216 | 2. This plugin DOES use encryption, but it uses exempt encryptions.
217 |
218 | ## Licenses
219 |
220 | * [openvpn_flutter](https://github.com/nizwar/openvpn_flutter/blob/master/LICENSE) for this plugin
221 | * [ics-openvpn](https://github.com/schwabe/ics-openvpn) for the Android engine
222 | * [OpenVPNAdapter](https://github.com/ss-abramchuk/OpenVPNAdapter) for the iOS engine
223 |
224 | # Support
225 |
226 | If you appreciate my work, don't forget to give a thumbs up or support me with a cup of coffee.
227 |
228 |
229 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | # Additional information about this file can be found at
4 | # https://dart.dev/guides/language/analysis-options
5 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'id.laskarmedia.openvpn_flutter'
2 | version '1.0'
3 |
4 | buildscript {
5 | repositories {
6 | google()
7 | mavenCentral()
8 | maven { url 'https://jitpack.io' }
9 | }
10 |
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:7.4.2'
13 | }
14 | }
15 |
16 | rootProject.allprojects {
17 | repositories {
18 | google()
19 | mavenCentral()
20 | maven { url 'https://jitpack.io' }
21 | }
22 | }
23 |
24 |
25 | allprojects {
26 | repositories {
27 | mavenLocal()
28 | mavenCentral()
29 | maven { url "https://jitpack.io" }
30 | }
31 | }
32 |
33 | apply plugin: 'com.android.library'
34 |
35 | android {
36 | namespace = 'id.laskarmedia.openvpn_flutter'
37 | compileSdkVersion 34
38 |
39 | compileOptions {
40 | sourceCompatibility JavaVersion.VERSION_1_8
41 | targetCompatibility JavaVersion.VERSION_1_8
42 | }
43 |
44 | defaultConfig {
45 | minSdkVersion 16
46 | }
47 | }
48 |
49 | dependencies {
50 | implementation 'com.github.nizwar:openvpn_library:b3941ef040'
51 | }
52 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
6 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/android/src/main/java/id/laskarmedia/openvpn_flutter/OpenVPNFlutterPlugin.java:
--------------------------------------------------------------------------------
1 | package id.laskarmedia.openvpn_flutter;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.Activity;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.net.VpnService;
8 |
9 | import androidx.annotation.NonNull;
10 |
11 | import java.util.ArrayList;
12 |
13 | import de.blinkt.openvpn.OnVPNStatusChangeListener;
14 | import de.blinkt.openvpn.VPNHelper;
15 | import de.blinkt.openvpn.core.OpenVPNService;
16 | import io.flutter.embedding.engine.plugins.FlutterPlugin;
17 | import io.flutter.embedding.engine.plugins.activity.ActivityAware;
18 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
19 | import io.flutter.plugin.common.EventChannel;
20 | import io.flutter.plugin.common.MethodChannel;
21 |
22 | /**
23 | * OpenvpnFlutterPlugin
24 | */
25 | public class OpenVPNFlutterPlugin implements FlutterPlugin, ActivityAware {
26 |
27 | private MethodChannel vpnControlMethod;
28 | private EventChannel vpnStageEvent;
29 | // private EventChannel vpnStatusEvent;
30 | private EventChannel.EventSink vpnStageSink;
31 | // private EventChannel.EventSink vpnStatusSink;
32 |
33 | private static final String EVENT_CHANNEL_VPN_STAGE = "id.laskarmedia.openvpn_flutter/vpnstage";
34 | // private static final String EVENT_CHANNEL_VPN_STATUS = "id.laskarmedia.openvpn_flutter/vpnstatus";
35 | private static final String METHOD_CHANNEL_VPN_CONTROL = "id.laskarmedia.openvpn_flutter/vpncontrol";
36 |
37 | private static String config = "", username = "", password = "", name = "";
38 |
39 | private static ArrayList bypassPackages;
40 | @SuppressLint("StaticFieldLeak")
41 | private static VPNHelper vpnHelper;
42 | private Activity activity;
43 |
44 | Context mContext;
45 |
46 |
47 | public static void connectWhileGranted(boolean granted) {
48 | if (granted) {
49 | vpnHelper.startVPN(config, username, password, name, bypassPackages);
50 | }
51 | }
52 |
53 | @Override
54 | public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
55 | vpnStageEvent = new EventChannel(binding.getBinaryMessenger(), EVENT_CHANNEL_VPN_STAGE);
56 | vpnControlMethod = new MethodChannel(binding.getBinaryMessenger(), METHOD_CHANNEL_VPN_CONTROL);
57 |
58 | vpnStageEvent.setStreamHandler(new EventChannel.StreamHandler() {
59 | @Override
60 | public void onListen(Object arguments, EventChannel.EventSink events) {
61 | vpnStageSink = events;
62 | }
63 |
64 | @Override
65 | public void onCancel(Object arguments) {
66 | if (vpnStageSink != null) vpnStageSink.endOfStream();
67 | }
68 | });
69 |
70 | vpnControlMethod.setMethodCallHandler((call, result) -> {
71 |
72 | switch (call.method) {
73 | case "status":
74 | if (vpnHelper == null) {
75 | result.error("-1", "VPNEngine need to be initialize", "");
76 | return;
77 | }
78 | result.success(vpnHelper.status.toString());
79 | break;
80 | case "initialize":
81 | vpnHelper = new VPNHelper(activity);
82 | vpnHelper.setOnVPNStatusChangeListener(new OnVPNStatusChangeListener() {
83 | @Override
84 | public void onVPNStatusChanged(String status) {
85 | updateStage(status);
86 | }
87 |
88 | @Override
89 | public void onConnectionStatusChanged(String duration, String lastPacketReceive, String byteIn, String byteOut) {
90 |
91 | }
92 | });
93 | result.success(updateVPNStages());
94 | break;
95 | case "disconnect":
96 | if (vpnHelper == null)
97 | result.error("-1", "VPNEngine need to be initialize", "");
98 |
99 | vpnHelper.stopVPN();
100 | updateStage("disconnected");
101 | break;
102 | case "connect":
103 | if (vpnHelper == null) {
104 | result.error("-1", "VPNEngine need to be initialize", "");
105 | return;
106 | }
107 |
108 | config = call.argument("config");
109 | name = call.argument("name");
110 | username = call.argument("username");
111 | password = call.argument("password");
112 | bypassPackages = call.argument("bypass_packages");
113 |
114 | if (config == null) {
115 | result.error("-2", "OpenVPN Config is required", "");
116 | return;
117 | }
118 |
119 | final Intent permission = VpnService.prepare(activity);
120 | if (permission != null) {
121 | activity.startActivityForResult(permission, 24);
122 | return;
123 | }
124 | vpnHelper.startVPN(config, username, password, name, bypassPackages);
125 | break;
126 | case "stage":
127 | if (vpnHelper == null) {
128 | result.error("-1", "VPNEngine need to be initialize", "");
129 | return;
130 | }
131 | result.success(updateVPNStages());
132 | break;
133 | case "request_permission":
134 | final Intent request = VpnService.prepare(activity);
135 | if (request != null) {
136 | activity.startActivityForResult(request, 24);
137 | result.success(false);
138 | return;
139 | }
140 | result.success(true);
141 | break;
142 |
143 | default:
144 | }
145 | });
146 | mContext = binding.getApplicationContext();
147 | }
148 |
149 | public void updateStage(String stage) {
150 | if (stage == null) stage = "idle";
151 | if (vpnStageSink != null) vpnStageSink.success(stage.toLowerCase());
152 | }
153 |
154 |
155 | @Override
156 | public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
157 | vpnStageEvent.setStreamHandler(null);
158 | vpnControlMethod.setMethodCallHandler(null);
159 | // vpnStatusEvent.setStreamHandler(null);
160 | }
161 |
162 |
163 | private String updateVPNStages() {
164 | if (OpenVPNService.getStatus() == null) {
165 | OpenVPNService.setDefaultStatus();
166 | }
167 | updateStage(OpenVPNService.getStatus());
168 | return OpenVPNService.getStatus();
169 | }
170 |
171 | @Override
172 | public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) {
173 | activity = binding.getActivity();
174 | }
175 |
176 | @Override
177 | public void onDetachedFromActivityForConfigChanges() {
178 |
179 | }
180 |
181 | @Override
182 | public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
183 | activity = binding.getActivity();
184 | }
185 |
186 | @Override
187 | public void onDetachedFromActivity() {
188 |
189 | }
190 | }
191 |
--------------------------------------------------------------------------------
/example/.github/workflows/demo.yaml:
--------------------------------------------------------------------------------
1 | name: Openvpn_flutter
2 |
3 | on: push
4 |
5 | jobs:
6 | build:
7 | name: Build APK
8 | runs-on: macos-latest
9 | steps:
10 | - uses: actions/checkout@v1
11 | - uses: actions/setup-java@v1
12 | with:
13 | java-version: '12.x'
14 | - uses: subosito/flutter-action@v1
15 | with:
16 | flutter-version: '2.5.3'
17 | - run: flutter pub get
18 | - run: flutter build apk --release --split-per-abi
19 | - name: Release apks
20 | uses: ncipollo/release-action@v1
21 | with:
22 | artifacts: "build/app/outputs/apk/release/*.apk"
23 | token: ${{ secrets.GITHUB_TOKEN }}
24 | tag: v1.0.${{github.run_number}}
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Web related
35 | lib/generated_plugin_registrant.dart
36 |
37 | # Symbolication related
38 | app.*.symbols
39 |
40 | # Obfuscation related
41 | app.*.map.json
42 |
43 | # Android Studio will place build artifacts here
44 | /android/app/debug
45 | /android/app/profile
46 | /android/app/release
47 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: "d8a9f9a52e5af486f80d932e838ee93861ffd863"
8 | channel: "stable"
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
17 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
18 | - platform: android
19 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
20 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
21 | - platform: ios
22 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
23 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
24 | - platform: linux
25 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
26 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
27 | - platform: macos
28 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
29 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
30 | - platform: web
31 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
32 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
33 | - platform: windows
34 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
35 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # openvpn_flutter_example
2 |
3 | Demonstrates how to use the openvpn_flutter plugin.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13 |
14 | For help getting started with Flutter, view our
15 | [online documentation](https://flutter.dev/docs), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/example/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/to/reference-keystore
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "com.android.application"
3 | id "kotlin-android"
4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5 | id "dev.flutter.flutter-gradle-plugin"
6 | }
7 |
8 | android {
9 | namespace = "id.laskarmedia.openvpn_flutter_example"
10 | compileSdk = flutter.compileSdkVersion
11 | ndkVersion = flutter.ndkVersion
12 |
13 | compileOptions {
14 | sourceCompatibility = JavaVersion.VERSION_17
15 | targetCompatibility = JavaVersion.VERSION_17
16 | }
17 |
18 | kotlinOptions {
19 | jvmTarget = JavaVersion.VERSION_17
20 | }
21 |
22 | defaultConfig {
23 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
24 | applicationId = "id.laskarmedia.openvpn_flutter_example"
25 | // You can update the following values to match your application needs.
26 | // For more information, see: https://flutter.dev/to/review-gradle-config.
27 | minSdk = flutter.minSdkVersion
28 | targetSdk = flutter.targetSdkVersion
29 | versionCode = flutter.versionCode
30 | versionName = flutter.versionName
31 | }
32 |
33 | buildTypes {
34 | release {
35 | // TODO: Add your own signing config for the release build.
36 | // Signing with the debug keys for now, so `flutter run --release` works.
37 | signingConfig = signingConfigs.debug
38 | }
39 | }
40 | }
41 |
42 | flutter {
43 | source = "../.."
44 | }
45 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
16 |
25 |
29 |
33 |
34 |
35 |
36 |
37 |
38 |
40 |
43 |
44 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/id/laskarmedia/openvpn_flutter_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package id.laskarmedia.openvpn_flutter_example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 | import id.laskarmedia.openvpn_flutter.OpenVPNFlutterPlugin
5 | import android.content.Intent
6 |
7 | class MainActivity: FlutterActivity(){
8 | override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
9 | OpenVPNFlutterPlugin.connectWhileGranted(requestCode == 24 && resultCode == RESULT_OK)
10 | super.onActivityResult(requestCode, resultCode, data)
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | allprojects {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | }
6 | }
7 |
8 | rootProject.buildDir = "../build"
9 | subprojects {
10 | project.buildDir = "${rootProject.buildDir}/${project.name}"
11 | }
12 | subprojects {
13 | project.evaluationDependsOn(":app")
14 | }
15 |
16 | tasks.register("clean", Delete) {
17 | delete rootProject.buildDir
18 | }
19 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
6 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | def flutterSdkPath = {
3 | def properties = new Properties()
4 | file("local.properties").withInputStream { properties.load(it) }
5 | def flutterSdkPath = properties.getProperty("flutter.sdk")
6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7 | return flutterSdkPath
8 | }()
9 |
10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
11 |
12 | repositories {
13 | google()
14 | mavenCentral()
15 | gradlePluginPortal()
16 | }
17 | }
18 |
19 | plugins {
20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21 | id "com.android.application" version "8.3.2" apply false
22 | id "org.jetbrains.kotlin.android" version "1.8.22" apply false
23 | }
24 |
25 | include ":app"
26 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 12.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '12.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | end
41 | end
42 |
43 | target 'VPNExtension' do
44 | use_frameworks!
45 | use_modular_headers!
46 | pod 'OpenVPNAdapter', :git => 'https://github.com/ss-abramchuk/OpenVPNAdapter.git', :tag => '0.7.0'
47 | end
48 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - openvpn_flutter (0.0.1):
4 | - Flutter
5 | - OpenVPNAdapter (0.7.0):
6 | - OpenVPNAdapter/ASIO (= 0.7.0)
7 | - OpenVPNAdapter/LZ4 (= 0.7.0)
8 | - OpenVPNAdapter/mbedTLS (= 0.7.0)
9 | - OpenVPNAdapter/OpenVPN3 (= 0.7.0)
10 | - OpenVPNAdapter/OpenVPNAdapter (= 0.7.0)
11 | - OpenVPNAdapter/OpenVPNClient (= 0.7.0)
12 | - OpenVPNAdapter/ASIO (0.7.0)
13 | - OpenVPNAdapter/LZ4 (0.7.0)
14 | - OpenVPNAdapter/mbedTLS (0.7.0)
15 | - OpenVPNAdapter/OpenVPN3 (0.7.0)
16 | - OpenVPNAdapter/OpenVPNAdapter (0.7.0)
17 | - OpenVPNAdapter/OpenVPNClient (0.7.0)
18 |
19 | DEPENDENCIES:
20 | - Flutter (from `Flutter`)
21 | - openvpn_flutter (from `.symlinks/plugins/openvpn_flutter/ios`)
22 | - OpenVPNAdapter (from `https://github.com/ss-abramchuk/OpenVPNAdapter.git`, tag `0.7.0`)
23 |
24 | EXTERNAL SOURCES:
25 | Flutter:
26 | :path: Flutter
27 | openvpn_flutter:
28 | :path: ".symlinks/plugins/openvpn_flutter/ios"
29 | OpenVPNAdapter:
30 | :git: https://github.com/ss-abramchuk/OpenVPNAdapter.git
31 | :tag: 0.7.0
32 |
33 | CHECKOUT OPTIONS:
34 | OpenVPNAdapter:
35 | :git: https://github.com/ss-abramchuk/OpenVPNAdapter.git
36 | :tag: 0.7.0
37 |
38 | SPEC CHECKSUMS:
39 | Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
40 | openvpn_flutter: 35f2b149956e0be8d97c2af221321a495bcd92fa
41 | OpenVPNAdapter: 173fcc4c11a3a8a83ae8d250c079cdc5b9fb8ff1
42 |
43 | PODFILE CHECKSUM: 2da1a35c0d55987349665f85a190a76dad3ea298
44 |
45 | COCOAPODS: 1.11.3
46 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 54;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 27943ADCF203914DB1ED7EDB /* Pods_VPNExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42DF978FD322A8300CDC4355 /* Pods_VPNExtension.framework */; };
12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
13 | 414F810E277EDF1800823C7F /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 414F810D277EDF1800823C7F /* NetworkExtension.framework */; };
14 | 414F8127277F5FE900823C7F /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 414F810D277EDF1800823C7F /* NetworkExtension.framework */; };
15 | 414F812A277F5FE900823C7F /* PacketTunnelProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 414F8129277F5FE900823C7F /* PacketTunnelProvider.swift */; };
16 | 414F812F277F5FE900823C7F /* VPNExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 414F8126277F5FE900823C7F /* VPNExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
17 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
18 | 8CAAC5DBE36F5E564836AAC6 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C34416E4224B211C092E3C8 /* Pods_Runner.framework */; };
19 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
20 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
21 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
22 | /* End PBXBuildFile section */
23 |
24 | /* Begin PBXContainerItemProxy section */
25 | 414F812D277F5FE900823C7F /* PBXContainerItemProxy */ = {
26 | isa = PBXContainerItemProxy;
27 | containerPortal = 97C146E61CF9000F007C117D /* Project object */;
28 | proxyType = 1;
29 | remoteGlobalIDString = 414F8125277F5FE900823C7F;
30 | remoteInfo = VPNExtension;
31 | };
32 | /* End PBXContainerItemProxy section */
33 |
34 | /* Begin PBXCopyFilesBuildPhase section */
35 | 414F8121277EE0BF00823C7F /* Embed App Extensions */ = {
36 | isa = PBXCopyFilesBuildPhase;
37 | buildActionMask = 2147483647;
38 | dstPath = "";
39 | dstSubfolderSpec = 13;
40 | files = (
41 | 414F812F277F5FE900823C7F /* VPNExtension.appex in Embed App Extensions */,
42 | );
43 | name = "Embed App Extensions";
44 | runOnlyForDeploymentPostprocessing = 0;
45 | };
46 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
47 | isa = PBXCopyFilesBuildPhase;
48 | buildActionMask = 2147483647;
49 | dstPath = "";
50 | dstSubfolderSpec = 10;
51 | files = (
52 | );
53 | name = "Embed Frameworks";
54 | runOnlyForDeploymentPostprocessing = 0;
55 | };
56 | /* End PBXCopyFilesBuildPhase section */
57 |
58 | /* Begin PBXFileReference section */
59 | 02A5452F38927BB2143A7398 /* Pods-VPNExtension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VPNExtension.release.xcconfig"; path = "Target Support Files/Pods-VPNExtension/Pods-VPNExtension.release.xcconfig"; sourceTree = ""; };
60 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
61 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
62 | 160186CEBA8DB4239E3F19F4 /* Pods-VPNExtension.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VPNExtension.profile.xcconfig"; path = "Target Support Files/Pods-VPNExtension/Pods-VPNExtension.profile.xcconfig"; sourceTree = ""; };
63 | 339DB5C3D6EE52DC8A844AC7 /* Pods-VPNExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VPNExtension.debug.xcconfig"; path = "Target Support Files/Pods-VPNExtension/Pods-VPNExtension.debug.xcconfig"; sourceTree = ""; };
64 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
65 | 414F810C277EDF1800823C7F /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; };
66 | 414F810D277EDF1800823C7F /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; };
67 | 414F8116277EE0BF00823C7F /* PacketTunnelProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PacketTunnelProvider.swift; sourceTree = ""; };
68 | 414F8118277EE0BF00823C7F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
69 | 414F8119277EE0BF00823C7F /* VPNExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = VPNExtension.entitlements; sourceTree = ""; };
70 | 414F8126277F5FE900823C7F /* VPNExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = VPNExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
71 | 414F8129277F5FE900823C7F /* PacketTunnelProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PacketTunnelProvider.swift; sourceTree = ""; };
72 | 414F812B277F5FE900823C7F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
73 | 414F812C277F5FE900823C7F /* VPNExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = VPNExtension.entitlements; sourceTree = ""; };
74 | 42AB0A4C2E103974BEB27E84 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; };
75 | 42DF978FD322A8300CDC4355 /* Pods_VPNExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_VPNExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; };
76 | 4C8CF5E8BD32A398085F477E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; };
77 | 7206C892C0179DC8B30F0965 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
78 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
79 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
80 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
81 | 8C34416E4224B211C092E3C8 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
82 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
83 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
84 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
85 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
86 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
87 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
88 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
89 | /* End PBXFileReference section */
90 |
91 | /* Begin PBXFrameworksBuildPhase section */
92 | 414F8123277F5FE900823C7F /* Frameworks */ = {
93 | isa = PBXFrameworksBuildPhase;
94 | buildActionMask = 2147483647;
95 | files = (
96 | 414F8127277F5FE900823C7F /* NetworkExtension.framework in Frameworks */,
97 | 27943ADCF203914DB1ED7EDB /* Pods_VPNExtension.framework in Frameworks */,
98 | );
99 | runOnlyForDeploymentPostprocessing = 0;
100 | };
101 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
102 | isa = PBXFrameworksBuildPhase;
103 | buildActionMask = 2147483647;
104 | files = (
105 | 8CAAC5DBE36F5E564836AAC6 /* Pods_Runner.framework in Frameworks */,
106 | 414F810E277EDF1800823C7F /* NetworkExtension.framework in Frameworks */,
107 | );
108 | runOnlyForDeploymentPostprocessing = 0;
109 | };
110 | /* End PBXFrameworksBuildPhase section */
111 |
112 | /* Begin PBXGroup section */
113 | 414F8115277EE0BF00823C7F /* VPNExtension */ = {
114 | isa = PBXGroup;
115 | children = (
116 | 414F8116277EE0BF00823C7F /* PacketTunnelProvider.swift */,
117 | 414F8118277EE0BF00823C7F /* Info.plist */,
118 | 414F8119277EE0BF00823C7F /* VPNExtension.entitlements */,
119 | );
120 | path = VPNExtension;
121 | sourceTree = "";
122 | };
123 | 414F8128277F5FE900823C7F /* VPNExtension */ = {
124 | isa = PBXGroup;
125 | children = (
126 | 414F8129277F5FE900823C7F /* PacketTunnelProvider.swift */,
127 | 414F812B277F5FE900823C7F /* Info.plist */,
128 | 414F812C277F5FE900823C7F /* VPNExtension.entitlements */,
129 | );
130 | path = VPNExtension;
131 | sourceTree = "";
132 | };
133 | 58BD2BCC5238B46CA13F1784 /* Pods */ = {
134 | isa = PBXGroup;
135 | children = (
136 | 7206C892C0179DC8B30F0965 /* Pods-Runner.debug.xcconfig */,
137 | 4C8CF5E8BD32A398085F477E /* Pods-Runner.release.xcconfig */,
138 | 42AB0A4C2E103974BEB27E84 /* Pods-Runner.profile.xcconfig */,
139 | 339DB5C3D6EE52DC8A844AC7 /* Pods-VPNExtension.debug.xcconfig */,
140 | 02A5452F38927BB2143A7398 /* Pods-VPNExtension.release.xcconfig */,
141 | 160186CEBA8DB4239E3F19F4 /* Pods-VPNExtension.profile.xcconfig */,
142 | );
143 | path = Pods;
144 | sourceTree = "";
145 | };
146 | 7A7B2EBC5DC3A5AC09BE52C8 /* Frameworks */ = {
147 | isa = PBXGroup;
148 | children = (
149 | 414F810D277EDF1800823C7F /* NetworkExtension.framework */,
150 | 8C34416E4224B211C092E3C8 /* Pods_Runner.framework */,
151 | 42DF978FD322A8300CDC4355 /* Pods_VPNExtension.framework */,
152 | );
153 | name = Frameworks;
154 | sourceTree = "";
155 | };
156 | 9740EEB11CF90186004384FC /* Flutter */ = {
157 | isa = PBXGroup;
158 | children = (
159 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
160 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
161 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
162 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
163 | );
164 | name = Flutter;
165 | sourceTree = "";
166 | };
167 | 97C146E51CF9000F007C117D = {
168 | isa = PBXGroup;
169 | children = (
170 | 9740EEB11CF90186004384FC /* Flutter */,
171 | 97C146F01CF9000F007C117D /* Runner */,
172 | 414F8115277EE0BF00823C7F /* VPNExtension */,
173 | 414F8128277F5FE900823C7F /* VPNExtension */,
174 | 97C146EF1CF9000F007C117D /* Products */,
175 | 58BD2BCC5238B46CA13F1784 /* Pods */,
176 | 7A7B2EBC5DC3A5AC09BE52C8 /* Frameworks */,
177 | );
178 | sourceTree = "";
179 | };
180 | 97C146EF1CF9000F007C117D /* Products */ = {
181 | isa = PBXGroup;
182 | children = (
183 | 97C146EE1CF9000F007C117D /* Runner.app */,
184 | 414F8126277F5FE900823C7F /* VPNExtension.appex */,
185 | );
186 | name = Products;
187 | sourceTree = "";
188 | };
189 | 97C146F01CF9000F007C117D /* Runner */ = {
190 | isa = PBXGroup;
191 | children = (
192 | 414F810C277EDF1800823C7F /* Runner.entitlements */,
193 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
194 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
195 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
196 | 97C147021CF9000F007C117D /* Info.plist */,
197 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
198 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
199 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
200 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
201 | );
202 | path = Runner;
203 | sourceTree = "";
204 | };
205 | /* End PBXGroup section */
206 |
207 | /* Begin PBXNativeTarget section */
208 | 414F8125277F5FE900823C7F /* VPNExtension */ = {
209 | isa = PBXNativeTarget;
210 | buildConfigurationList = 414F8130277F5FE900823C7F /* Build configuration list for PBXNativeTarget "VPNExtension" */;
211 | buildPhases = (
212 | 3F480C1A61F117F06096298A /* [CP] Check Pods Manifest.lock */,
213 | 414F8122277F5FE900823C7F /* Sources */,
214 | 414F8123277F5FE900823C7F /* Frameworks */,
215 | 414F8124277F5FE900823C7F /* Resources */,
216 | );
217 | buildRules = (
218 | );
219 | dependencies = (
220 | );
221 | name = VPNExtension;
222 | productName = VPNExtension;
223 | productReference = 414F8126277F5FE900823C7F /* VPNExtension.appex */;
224 | productType = "com.apple.product-type.app-extension";
225 | };
226 | 97C146ED1CF9000F007C117D /* Runner */ = {
227 | isa = PBXNativeTarget;
228 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
229 | buildPhases = (
230 | 054FCCB2A6ECC8C69673DAE8 /* [CP] Check Pods Manifest.lock */,
231 | 9740EEB61CF901F6004384FC /* Run Script */,
232 | 97C146EA1CF9000F007C117D /* Sources */,
233 | 97C146EB1CF9000F007C117D /* Frameworks */,
234 | 97C146EC1CF9000F007C117D /* Resources */,
235 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
236 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
237 | C48572CEEC795E5E8BA8C739 /* [CP] Embed Pods Frameworks */,
238 | 414F8121277EE0BF00823C7F /* Embed App Extensions */,
239 | );
240 | buildRules = (
241 | );
242 | dependencies = (
243 | 414F812E277F5FE900823C7F /* PBXTargetDependency */,
244 | );
245 | name = Runner;
246 | productName = Runner;
247 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
248 | productType = "com.apple.product-type.application";
249 | };
250 | /* End PBXNativeTarget section */
251 |
252 | /* Begin PBXProject section */
253 | 97C146E61CF9000F007C117D /* Project object */ = {
254 | isa = PBXProject;
255 | attributes = {
256 | LastSwiftUpdateCheck = 1320;
257 | LastUpgradeCheck = 1510;
258 | ORGANIZATIONNAME = "";
259 | TargetAttributes = {
260 | 414F8125277F5FE900823C7F = {
261 | CreatedOnToolsVersion = 13.2.1;
262 | };
263 | 97C146ED1CF9000F007C117D = {
264 | CreatedOnToolsVersion = 7.3.1;
265 | LastSwiftMigration = 1100;
266 | };
267 | };
268 | };
269 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
270 | compatibilityVersion = "Xcode 9.3";
271 | developmentRegion = en;
272 | hasScannedForEncodings = 0;
273 | knownRegions = (
274 | en,
275 | Base,
276 | );
277 | mainGroup = 97C146E51CF9000F007C117D;
278 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
279 | projectDirPath = "";
280 | projectRoot = "";
281 | targets = (
282 | 97C146ED1CF9000F007C117D /* Runner */,
283 | 414F8125277F5FE900823C7F /* VPNExtension */,
284 | );
285 | };
286 | /* End PBXProject section */
287 |
288 | /* Begin PBXResourcesBuildPhase section */
289 | 414F8124277F5FE900823C7F /* Resources */ = {
290 | isa = PBXResourcesBuildPhase;
291 | buildActionMask = 2147483647;
292 | files = (
293 | );
294 | runOnlyForDeploymentPostprocessing = 0;
295 | };
296 | 97C146EC1CF9000F007C117D /* Resources */ = {
297 | isa = PBXResourcesBuildPhase;
298 | buildActionMask = 2147483647;
299 | files = (
300 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
301 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
302 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
303 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
304 | );
305 | runOnlyForDeploymentPostprocessing = 0;
306 | };
307 | /* End PBXResourcesBuildPhase section */
308 |
309 | /* Begin PBXShellScriptBuildPhase section */
310 | 054FCCB2A6ECC8C69673DAE8 /* [CP] Check Pods Manifest.lock */ = {
311 | isa = PBXShellScriptBuildPhase;
312 | buildActionMask = 2147483647;
313 | files = (
314 | );
315 | inputFileListPaths = (
316 | );
317 | inputPaths = (
318 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
319 | "${PODS_ROOT}/Manifest.lock",
320 | );
321 | name = "[CP] Check Pods Manifest.lock";
322 | outputFileListPaths = (
323 | );
324 | outputPaths = (
325 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
326 | );
327 | runOnlyForDeploymentPostprocessing = 0;
328 | shellPath = /bin/sh;
329 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
330 | showEnvVarsInLog = 0;
331 | };
332 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
333 | isa = PBXShellScriptBuildPhase;
334 | alwaysOutOfDate = 1;
335 | buildActionMask = 2147483647;
336 | files = (
337 | );
338 | inputPaths = (
339 | "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
340 | );
341 | name = "Thin Binary";
342 | outputPaths = (
343 | );
344 | runOnlyForDeploymentPostprocessing = 0;
345 | shellPath = /bin/sh;
346 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
347 | };
348 | 3F480C1A61F117F06096298A /* [CP] Check Pods Manifest.lock */ = {
349 | isa = PBXShellScriptBuildPhase;
350 | buildActionMask = 2147483647;
351 | files = (
352 | );
353 | inputFileListPaths = (
354 | );
355 | inputPaths = (
356 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
357 | "${PODS_ROOT}/Manifest.lock",
358 | );
359 | name = "[CP] Check Pods Manifest.lock";
360 | outputFileListPaths = (
361 | );
362 | outputPaths = (
363 | "$(DERIVED_FILE_DIR)/Pods-VPNExtension-checkManifestLockResult.txt",
364 | );
365 | runOnlyForDeploymentPostprocessing = 0;
366 | shellPath = /bin/sh;
367 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
368 | showEnvVarsInLog = 0;
369 | };
370 | 9740EEB61CF901F6004384FC /* Run Script */ = {
371 | isa = PBXShellScriptBuildPhase;
372 | alwaysOutOfDate = 1;
373 | buildActionMask = 2147483647;
374 | files = (
375 | );
376 | inputPaths = (
377 | );
378 | name = "Run Script";
379 | outputPaths = (
380 | );
381 | runOnlyForDeploymentPostprocessing = 0;
382 | shellPath = /bin/sh;
383 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
384 | };
385 | C48572CEEC795E5E8BA8C739 /* [CP] Embed Pods Frameworks */ = {
386 | isa = PBXShellScriptBuildPhase;
387 | buildActionMask = 2147483647;
388 | files = (
389 | );
390 | inputFileListPaths = (
391 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
392 | );
393 | name = "[CP] Embed Pods Frameworks";
394 | outputFileListPaths = (
395 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
396 | );
397 | runOnlyForDeploymentPostprocessing = 0;
398 | shellPath = /bin/sh;
399 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
400 | showEnvVarsInLog = 0;
401 | };
402 | /* End PBXShellScriptBuildPhase section */
403 |
404 | /* Begin PBXSourcesBuildPhase section */
405 | 414F8122277F5FE900823C7F /* Sources */ = {
406 | isa = PBXSourcesBuildPhase;
407 | buildActionMask = 2147483647;
408 | files = (
409 | 414F812A277F5FE900823C7F /* PacketTunnelProvider.swift in Sources */,
410 | );
411 | runOnlyForDeploymentPostprocessing = 0;
412 | };
413 | 97C146EA1CF9000F007C117D /* Sources */ = {
414 | isa = PBXSourcesBuildPhase;
415 | buildActionMask = 2147483647;
416 | files = (
417 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
418 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
419 | );
420 | runOnlyForDeploymentPostprocessing = 0;
421 | };
422 | /* End PBXSourcesBuildPhase section */
423 |
424 | /* Begin PBXTargetDependency section */
425 | 414F812E277F5FE900823C7F /* PBXTargetDependency */ = {
426 | isa = PBXTargetDependency;
427 | target = 414F8125277F5FE900823C7F /* VPNExtension */;
428 | targetProxy = 414F812D277F5FE900823C7F /* PBXContainerItemProxy */;
429 | };
430 | /* End PBXTargetDependency section */
431 |
432 | /* Begin PBXVariantGroup section */
433 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
434 | isa = PBXVariantGroup;
435 | children = (
436 | 97C146FB1CF9000F007C117D /* Base */,
437 | );
438 | name = Main.storyboard;
439 | sourceTree = "";
440 | };
441 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
442 | isa = PBXVariantGroup;
443 | children = (
444 | 97C147001CF9000F007C117D /* Base */,
445 | );
446 | name = LaunchScreen.storyboard;
447 | sourceTree = "";
448 | };
449 | /* End PBXVariantGroup section */
450 |
451 | /* Begin XCBuildConfiguration section */
452 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
453 | isa = XCBuildConfiguration;
454 | buildSettings = {
455 | ALWAYS_SEARCH_USER_PATHS = NO;
456 | CLANG_ANALYZER_NONNULL = YES;
457 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
458 | CLANG_CXX_LIBRARY = "libc++";
459 | CLANG_ENABLE_MODULES = YES;
460 | CLANG_ENABLE_OBJC_ARC = YES;
461 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
462 | CLANG_WARN_BOOL_CONVERSION = YES;
463 | CLANG_WARN_COMMA = YES;
464 | CLANG_WARN_CONSTANT_CONVERSION = YES;
465 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
466 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
467 | CLANG_WARN_EMPTY_BODY = YES;
468 | CLANG_WARN_ENUM_CONVERSION = YES;
469 | CLANG_WARN_INFINITE_RECURSION = YES;
470 | CLANG_WARN_INT_CONVERSION = YES;
471 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
472 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
473 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
474 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
475 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
476 | CLANG_WARN_STRICT_PROTOTYPES = YES;
477 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
478 | CLANG_WARN_UNREACHABLE_CODE = YES;
479 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
480 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
481 | COPY_PHASE_STRIP = NO;
482 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
483 | ENABLE_NS_ASSERTIONS = NO;
484 | ENABLE_STRICT_OBJC_MSGSEND = YES;
485 | GCC_C_LANGUAGE_STANDARD = gnu99;
486 | GCC_NO_COMMON_BLOCKS = YES;
487 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
488 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
489 | GCC_WARN_UNDECLARED_SELECTOR = YES;
490 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
491 | GCC_WARN_UNUSED_FUNCTION = YES;
492 | GCC_WARN_UNUSED_VARIABLE = YES;
493 | IPHONEOS_DEPLOYMENT_TARGET = 12.0;
494 | MTL_ENABLE_DEBUG_INFO = NO;
495 | SDKROOT = iphoneos;
496 | SUPPORTED_PLATFORMS = iphoneos;
497 | TARGETED_DEVICE_FAMILY = "1,2";
498 | VALIDATE_PRODUCT = YES;
499 | };
500 | name = Profile;
501 | };
502 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
503 | isa = XCBuildConfiguration;
504 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
505 | buildSettings = {
506 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
507 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
508 | CLANG_ENABLE_MODULES = YES;
509 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
510 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
511 | DEVELOPMENT_TEAM = 426BMQ75MF;
512 | ENABLE_BITCODE = NO;
513 | INFOPLIST_FILE = Runner/Info.plist;
514 | LD_RUNPATH_SEARCH_PATHS = (
515 | "$(inherited)",
516 | "@executable_path/Frameworks",
517 | );
518 | PRODUCT_BUNDLE_IDENTIFIER = id.laskarmedia.openvpnFlutterExample;
519 | PRODUCT_NAME = "$(TARGET_NAME)";
520 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
521 | SWIFT_VERSION = 5.0;
522 | VERSIONING_SYSTEM = "apple-generic";
523 | };
524 | name = Profile;
525 | };
526 | 414F8131277F5FE900823C7F /* Debug */ = {
527 | isa = XCBuildConfiguration;
528 | baseConfigurationReference = 339DB5C3D6EE52DC8A844AC7 /* Pods-VPNExtension.debug.xcconfig */;
529 | buildSettings = {
530 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
531 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
532 | CLANG_ENABLE_OBJC_WEAK = YES;
533 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
534 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
535 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
536 | CODE_SIGN_ENTITLEMENTS = VPNExtension/VPNExtension.entitlements;
537 | CODE_SIGN_STYLE = Automatic;
538 | CURRENT_PROJECT_VERSION = 1;
539 | DEVELOPMENT_TEAM = 426BMQ75MF;
540 | GCC_C_LANGUAGE_STANDARD = gnu11;
541 | GENERATE_INFOPLIST_FILE = YES;
542 | INFOPLIST_FILE = VPNExtension/Info.plist;
543 | INFOPLIST_KEY_CFBundleDisplayName = VPNExtension;
544 | INFOPLIST_KEY_NSHumanReadableCopyright = "";
545 | IPHONEOS_DEPLOYMENT_TARGET = 15.2;
546 | LD_RUNPATH_SEARCH_PATHS = (
547 | "$(inherited)",
548 | "@executable_path/Frameworks",
549 | "@executable_path/../../Frameworks",
550 | );
551 | MARKETING_VERSION = 1.0;
552 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
553 | MTL_FAST_MATH = YES;
554 | PRODUCT_BUNDLE_IDENTIFIER = id.laskarmedia.openvpnFlutterExample.VPNExtension;
555 | PRODUCT_NAME = "$(TARGET_NAME)";
556 | SKIP_INSTALL = YES;
557 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
558 | SWIFT_EMIT_LOC_STRINGS = YES;
559 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
560 | SWIFT_VERSION = 5.0;
561 | TARGETED_DEVICE_FAMILY = "1,2";
562 | };
563 | name = Debug;
564 | };
565 | 414F8132277F5FE900823C7F /* Release */ = {
566 | isa = XCBuildConfiguration;
567 | baseConfigurationReference = 02A5452F38927BB2143A7398 /* Pods-VPNExtension.release.xcconfig */;
568 | buildSettings = {
569 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
570 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
571 | CLANG_ENABLE_OBJC_WEAK = YES;
572 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
573 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
574 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
575 | CODE_SIGN_ENTITLEMENTS = VPNExtension/VPNExtension.entitlements;
576 | CODE_SIGN_STYLE = Automatic;
577 | CURRENT_PROJECT_VERSION = 1;
578 | DEVELOPMENT_TEAM = 426BMQ75MF;
579 | GCC_C_LANGUAGE_STANDARD = gnu11;
580 | GENERATE_INFOPLIST_FILE = YES;
581 | INFOPLIST_FILE = VPNExtension/Info.plist;
582 | INFOPLIST_KEY_CFBundleDisplayName = VPNExtension;
583 | INFOPLIST_KEY_NSHumanReadableCopyright = "";
584 | IPHONEOS_DEPLOYMENT_TARGET = 15.2;
585 | LD_RUNPATH_SEARCH_PATHS = (
586 | "$(inherited)",
587 | "@executable_path/Frameworks",
588 | "@executable_path/../../Frameworks",
589 | );
590 | MARKETING_VERSION = 1.0;
591 | MTL_FAST_MATH = YES;
592 | PRODUCT_BUNDLE_IDENTIFIER = id.laskarmedia.openvpnFlutterExample.VPNExtension;
593 | PRODUCT_NAME = "$(TARGET_NAME)";
594 | SKIP_INSTALL = YES;
595 | SWIFT_EMIT_LOC_STRINGS = YES;
596 | SWIFT_VERSION = 5.0;
597 | TARGETED_DEVICE_FAMILY = "1,2";
598 | };
599 | name = Release;
600 | };
601 | 414F8133277F5FE900823C7F /* Profile */ = {
602 | isa = XCBuildConfiguration;
603 | baseConfigurationReference = 160186CEBA8DB4239E3F19F4 /* Pods-VPNExtension.profile.xcconfig */;
604 | buildSettings = {
605 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
606 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
607 | CLANG_ENABLE_OBJC_WEAK = YES;
608 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
609 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
610 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
611 | CODE_SIGN_ENTITLEMENTS = VPNExtension/VPNExtension.entitlements;
612 | CODE_SIGN_STYLE = Automatic;
613 | CURRENT_PROJECT_VERSION = 1;
614 | DEVELOPMENT_TEAM = 426BMQ75MF;
615 | GCC_C_LANGUAGE_STANDARD = gnu11;
616 | GENERATE_INFOPLIST_FILE = YES;
617 | INFOPLIST_FILE = VPNExtension/Info.plist;
618 | INFOPLIST_KEY_CFBundleDisplayName = VPNExtension;
619 | INFOPLIST_KEY_NSHumanReadableCopyright = "";
620 | IPHONEOS_DEPLOYMENT_TARGET = 15.2;
621 | LD_RUNPATH_SEARCH_PATHS = (
622 | "$(inherited)",
623 | "@executable_path/Frameworks",
624 | "@executable_path/../../Frameworks",
625 | );
626 | MARKETING_VERSION = 1.0;
627 | MTL_FAST_MATH = YES;
628 | PRODUCT_BUNDLE_IDENTIFIER = id.laskarmedia.openvpnFlutterExample.VPNExtension;
629 | PRODUCT_NAME = "$(TARGET_NAME)";
630 | SKIP_INSTALL = YES;
631 | SWIFT_EMIT_LOC_STRINGS = YES;
632 | SWIFT_VERSION = 5.0;
633 | TARGETED_DEVICE_FAMILY = "1,2";
634 | };
635 | name = Profile;
636 | };
637 | 97C147031CF9000F007C117D /* Debug */ = {
638 | isa = XCBuildConfiguration;
639 | buildSettings = {
640 | ALWAYS_SEARCH_USER_PATHS = NO;
641 | CLANG_ANALYZER_NONNULL = YES;
642 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
643 | CLANG_CXX_LIBRARY = "libc++";
644 | CLANG_ENABLE_MODULES = YES;
645 | CLANG_ENABLE_OBJC_ARC = YES;
646 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
647 | CLANG_WARN_BOOL_CONVERSION = YES;
648 | CLANG_WARN_COMMA = YES;
649 | CLANG_WARN_CONSTANT_CONVERSION = YES;
650 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
651 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
652 | CLANG_WARN_EMPTY_BODY = YES;
653 | CLANG_WARN_ENUM_CONVERSION = YES;
654 | CLANG_WARN_INFINITE_RECURSION = YES;
655 | CLANG_WARN_INT_CONVERSION = YES;
656 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
657 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
658 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
659 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
660 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
661 | CLANG_WARN_STRICT_PROTOTYPES = YES;
662 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
663 | CLANG_WARN_UNREACHABLE_CODE = YES;
664 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
665 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
666 | COPY_PHASE_STRIP = NO;
667 | DEBUG_INFORMATION_FORMAT = dwarf;
668 | ENABLE_STRICT_OBJC_MSGSEND = YES;
669 | ENABLE_TESTABILITY = YES;
670 | GCC_C_LANGUAGE_STANDARD = gnu99;
671 | GCC_DYNAMIC_NO_PIC = NO;
672 | GCC_NO_COMMON_BLOCKS = YES;
673 | GCC_OPTIMIZATION_LEVEL = 0;
674 | GCC_PREPROCESSOR_DEFINITIONS = (
675 | "DEBUG=1",
676 | "$(inherited)",
677 | );
678 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
679 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
680 | GCC_WARN_UNDECLARED_SELECTOR = YES;
681 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
682 | GCC_WARN_UNUSED_FUNCTION = YES;
683 | GCC_WARN_UNUSED_VARIABLE = YES;
684 | IPHONEOS_DEPLOYMENT_TARGET = 12.0;
685 | MTL_ENABLE_DEBUG_INFO = YES;
686 | ONLY_ACTIVE_ARCH = YES;
687 | SDKROOT = iphoneos;
688 | TARGETED_DEVICE_FAMILY = "1,2";
689 | };
690 | name = Debug;
691 | };
692 | 97C147041CF9000F007C117D /* Release */ = {
693 | isa = XCBuildConfiguration;
694 | buildSettings = {
695 | ALWAYS_SEARCH_USER_PATHS = NO;
696 | CLANG_ANALYZER_NONNULL = YES;
697 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
698 | CLANG_CXX_LIBRARY = "libc++";
699 | CLANG_ENABLE_MODULES = YES;
700 | CLANG_ENABLE_OBJC_ARC = YES;
701 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
702 | CLANG_WARN_BOOL_CONVERSION = YES;
703 | CLANG_WARN_COMMA = YES;
704 | CLANG_WARN_CONSTANT_CONVERSION = YES;
705 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
706 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
707 | CLANG_WARN_EMPTY_BODY = YES;
708 | CLANG_WARN_ENUM_CONVERSION = YES;
709 | CLANG_WARN_INFINITE_RECURSION = YES;
710 | CLANG_WARN_INT_CONVERSION = YES;
711 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
712 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
713 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
714 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
715 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
716 | CLANG_WARN_STRICT_PROTOTYPES = YES;
717 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
718 | CLANG_WARN_UNREACHABLE_CODE = YES;
719 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
720 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
721 | COPY_PHASE_STRIP = NO;
722 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
723 | ENABLE_NS_ASSERTIONS = NO;
724 | ENABLE_STRICT_OBJC_MSGSEND = YES;
725 | GCC_C_LANGUAGE_STANDARD = gnu99;
726 | GCC_NO_COMMON_BLOCKS = YES;
727 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
728 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
729 | GCC_WARN_UNDECLARED_SELECTOR = YES;
730 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
731 | GCC_WARN_UNUSED_FUNCTION = YES;
732 | GCC_WARN_UNUSED_VARIABLE = YES;
733 | IPHONEOS_DEPLOYMENT_TARGET = 12.0;
734 | MTL_ENABLE_DEBUG_INFO = NO;
735 | SDKROOT = iphoneos;
736 | SUPPORTED_PLATFORMS = iphoneos;
737 | SWIFT_COMPILATION_MODE = wholemodule;
738 | SWIFT_OPTIMIZATION_LEVEL = "-O";
739 | TARGETED_DEVICE_FAMILY = "1,2";
740 | VALIDATE_PRODUCT = YES;
741 | };
742 | name = Release;
743 | };
744 | 97C147061CF9000F007C117D /* Debug */ = {
745 | isa = XCBuildConfiguration;
746 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
747 | buildSettings = {
748 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
749 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
750 | CLANG_ENABLE_MODULES = YES;
751 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
752 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
753 | DEVELOPMENT_TEAM = 426BMQ75MF;
754 | ENABLE_BITCODE = NO;
755 | INFOPLIST_FILE = Runner/Info.plist;
756 | LD_RUNPATH_SEARCH_PATHS = (
757 | "$(inherited)",
758 | "@executable_path/Frameworks",
759 | );
760 | PRODUCT_BUNDLE_IDENTIFIER = id.laskarmedia.openvpnFlutterExample;
761 | PRODUCT_NAME = "$(TARGET_NAME)";
762 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
763 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
764 | SWIFT_VERSION = 5.0;
765 | VERSIONING_SYSTEM = "apple-generic";
766 | };
767 | name = Debug;
768 | };
769 | 97C147071CF9000F007C117D /* Release */ = {
770 | isa = XCBuildConfiguration;
771 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
772 | buildSettings = {
773 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
774 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
775 | CLANG_ENABLE_MODULES = YES;
776 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
777 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
778 | DEVELOPMENT_TEAM = 426BMQ75MF;
779 | ENABLE_BITCODE = NO;
780 | INFOPLIST_FILE = Runner/Info.plist;
781 | LD_RUNPATH_SEARCH_PATHS = (
782 | "$(inherited)",
783 | "@executable_path/Frameworks",
784 | );
785 | PRODUCT_BUNDLE_IDENTIFIER = id.laskarmedia.openvpnFlutterExample;
786 | PRODUCT_NAME = "$(TARGET_NAME)";
787 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
788 | SWIFT_VERSION = 5.0;
789 | VERSIONING_SYSTEM = "apple-generic";
790 | };
791 | name = Release;
792 | };
793 | /* End XCBuildConfiguration section */
794 |
795 | /* Begin XCConfigurationList section */
796 | 414F8130277F5FE900823C7F /* Build configuration list for PBXNativeTarget "VPNExtension" */ = {
797 | isa = XCConfigurationList;
798 | buildConfigurations = (
799 | 414F8131277F5FE900823C7F /* Debug */,
800 | 414F8132277F5FE900823C7F /* Release */,
801 | 414F8133277F5FE900823C7F /* Profile */,
802 | );
803 | defaultConfigurationIsVisible = 0;
804 | defaultConfigurationName = Release;
805 | };
806 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
807 | isa = XCConfigurationList;
808 | buildConfigurations = (
809 | 97C147031CF9000F007C117D /* Debug */,
810 | 97C147041CF9000F007C117D /* Release */,
811 | 249021D3217E4FDB00AE95B9 /* Profile */,
812 | );
813 | defaultConfigurationIsVisible = 0;
814 | defaultConfigurationName = Release;
815 | };
816 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
817 | isa = XCConfigurationList;
818 | buildConfigurations = (
819 | 97C147061CF9000F007C117D /* Debug */,
820 | 97C147071CF9000F007C117D /* Release */,
821 | 249021D4217E4FDB00AE95B9 /* Profile */,
822 | );
823 | defaultConfigurationIsVisible = 0;
824 | defaultConfigurationName = Release;
825 | };
826 | /* End XCConfigurationList section */
827 | };
828 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
829 | }
830 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Openvpn Flutter
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | openvpn_flutter_example
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | UIViewControllerBasedStatusBarAppearance
45 |
46 | CADisableMinimumFrameDurationOnPhone
47 |
48 | UIApplicationSupportsIndirectInputEvents
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.developer.networking.networkextension
6 |
7 | packet-tunnel-provider
8 |
9 | com.apple.security.application-groups
10 |
11 | group.com.laskarmedia.vpn
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/example/ios/VPNExtension/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSExtension
6 |
7 | NSExtensionPointIdentifier
8 | com.apple.networkextension.packet-tunnel
9 | NSExtensionPrincipalClass
10 | $(PRODUCT_MODULE_NAME).PacketTunnelProvider
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/example/ios/VPNExtension/PacketTunnelProvider.swift:
--------------------------------------------------------------------------------
1 | //
2 | // PacketTunnelProvider.swift
3 | // VPNExtension
4 | //
5 | // Created by Mochamad Nizwar Syafuan on 31/12/21.
6 | //
7 |
8 | import NetworkExtension
9 | import OpenVPNAdapter
10 | import os.log
11 |
12 | extension NEPacketTunnelFlow: OpenVPNAdapterPacketFlow {}
13 |
14 | class PacketTunnelProvider: NEPacketTunnelProvider {
15 |
16 | lazy var vpnAdapter: OpenVPNAdapter = {
17 | let adapter = OpenVPNAdapter()
18 | adapter.delegate = self
19 | return adapter
20 | }()
21 |
22 | let vpnReachability = OpenVPNReachability()
23 | var providerManager: NETunnelProviderManager!
24 |
25 | var startHandler: ((Error?) -> Void)?
26 | var stopHandler: (() -> Void)?
27 | var groupIdentifier: String?
28 |
29 | static var connectionIndex = 0;
30 | static var timeOutEnabled = true;
31 |
32 | func loadProviderManager(completion:@escaping (_ error : Error?) -> Void) {
33 | NETunnelProviderManager.loadAllFromPreferences { (managers, error) in
34 | if error == nil {
35 | self.providerManager = managers?.first ?? NETunnelProviderManager()
36 | completion(nil)
37 | } else {
38 | completion(error)
39 | }
40 | }
41 | }
42 |
43 | override func startTunnel(options: [String : NSObject]?, completionHandler: @escaping (Error?) -> Void) {
44 | guard
45 | let protocolConfiguration = protocolConfiguration as? NETunnelProviderProtocol,
46 | let providerConfiguration = protocolConfiguration.providerConfiguration
47 | else {
48 | fatalError()
49 | }
50 | guard let ovpnFileContent: Data = providerConfiguration["config"] as? Data else {
51 | fatalError()
52 | }
53 |
54 | guard let groupIdentifier: Data = providerConfiguration["groupIdentifier"] as? Data else{
55 | fatalError()
56 | }
57 | self.groupIdentifier = String(decoding: groupIdentifier, as: UTF8.self)
58 |
59 | let configuration = OpenVPNConfiguration()
60 | configuration.fileContent = ovpnFileContent
61 | configuration.tunPersist = false
62 |
63 | // Apply OpenVPN configuration.
64 | let properties: OpenVPNConfigurationEvaluation
65 | do {
66 | properties = try vpnAdapter.apply(configuration: configuration)
67 | } catch {
68 | completionHandler(error)
69 | return
70 | }
71 |
72 | if !properties.autologin {
73 | guard let username = options?["username"] as? String, let password = options?["password"] as? String else {
74 | fatalError()
75 | }
76 | let credentials = OpenVPNCredentials()
77 | credentials.username = username
78 | credentials.password = password
79 | do {
80 | try vpnAdapter.provide(credentials: credentials)
81 | } catch {
82 | completionHandler(error)
83 | return
84 | }
85 | }
86 |
87 | vpnReachability.startTracking { [weak self] status in
88 | guard status == .reachableViaWiFi else { return }
89 | self?.vpnAdapter.reconnect(afterTimeInterval: 5)
90 | }
91 | startHandler = completionHandler
92 | vpnAdapter.connect(using: packetFlow)
93 | }
94 |
95 | @objc func stopVPN() {
96 | loadProviderManager { (err :Error?) in
97 | if err == nil {
98 | self.providerManager.connection.stopVPNTunnel();
99 | }
100 | }
101 | }
102 |
103 | override func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {
104 | stopHandler = completionHandler
105 | if vpnReachability.isTracking {
106 | vpnReachability.stopTracking()
107 | }
108 | vpnAdapter.disconnect()
109 | }
110 |
111 | override func handleAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)? = nil) {
112 | if String(data: messageData, encoding: .utf8) == "OPENVPN_STATS" {
113 | var toSave = ""
114 | let formatter = DateFormatter();
115 | formatter.dateFormat = "yyyy-MM-dd HH:mm:ss";
116 | toSave += UserDefaults.init(suiteName: groupIdentifier)?.string(forKey: "connected_on") ?? ""
117 | toSave+="_"
118 | toSave += String(vpnAdapter.interfaceStatistics.packetsIn)
119 | toSave+="_"
120 | toSave += String(vpnAdapter.interfaceStatistics.packetsOut)
121 | toSave+="_"
122 | toSave += String(vpnAdapter.interfaceStatistics.bytesIn)
123 | toSave+="_"
124 | toSave += String(vpnAdapter.interfaceStatistics.bytesOut)
125 | UserDefaults.init(suiteName: groupIdentifier)?.setValue(toSave, forKey: "connectionUpdate")
126 | }
127 | }
128 | }
129 |
130 | extension PacketTunnelProvider: OpenVPNAdapterDelegate {
131 | func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, configureTunnelWithNetworkSettings networkSettings: NEPacketTunnelNetworkSettings?, completionHandler: @escaping (Error?) -> Void) {
132 | networkSettings?.dnsSettings?.matchDomains = [""]
133 | setTunnelNetworkSettings(networkSettings, completionHandler: completionHandler)
134 | }
135 |
136 |
137 | func _updateEvent(_ event: OpenVPNAdapterEvent, openVPNAdapter: OpenVPNAdapter) {
138 | var toSave = ""
139 | let formatter = DateFormatter();
140 | formatter.dateFormat = "yyyy-MM-dd HH:mm:ss";
141 | switch event {
142 | case .connected:
143 | toSave = "CONNECTED"
144 | UserDefaults.init(suiteName: groupIdentifier)?.setValue(formatter.string(from: Date.now), forKey: "connected_on")
145 | break
146 | case .disconnected:
147 | toSave = "DISCONNECTED"
148 | break
149 | case .connecting:
150 | toSave = "CONNECTING"
151 | break
152 | case .reconnecting:
153 | toSave = "RECONNECTING"
154 | break
155 | case .info:
156 | toSave = "CONNECTED"
157 | break
158 | default:
159 | UserDefaults.init(suiteName: groupIdentifier)?.removeObject(forKey: "connected_on")
160 | toSave = "INVALID"
161 | }
162 | UserDefaults.init(suiteName: groupIdentifier)?.setValue(toSave, forKey: "vpnStage")
163 | }
164 |
165 | func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, handleEvent event: OpenVPNAdapterEvent, message: String?) {
166 | PacketTunnelProvider.timeOutEnabled = true;
167 | _updateEvent(event, openVPNAdapter: openVPNAdapter)
168 | switch event {
169 | case .connected:
170 | PacketTunnelProvider.timeOutEnabled = false;
171 | if reasserting {
172 | reasserting = false
173 | }
174 | guard let startHandler = startHandler else { return }
175 | startHandler(nil)
176 | self.startHandler = nil
177 | break
178 | case .disconnected:
179 | PacketTunnelProvider.timeOutEnabled = false;
180 | guard let stopHandler = stopHandler else { return }
181 | if vpnReachability.isTracking {
182 | vpnReachability.stopTracking()
183 | }
184 | stopHandler()
185 | self.stopHandler = nil
186 | break
187 | case .reconnecting:
188 | reasserting = true
189 | break
190 | default:
191 | break
192 | }
193 | }
194 |
195 | func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, handleError error: Error) {
196 | guard let fatal = (error as NSError).userInfo[OpenVPNAdapterErrorFatalKey] as? Bool, fatal == true else {
197 | return
198 | }
199 | if vpnReachability.isTracking {
200 | vpnReachability.stopTracking()
201 | }
202 | if let startHandler = startHandler {
203 | startHandler(error)
204 | self.startHandler = nil
205 | } else {
206 | cancelTunnelWithError(error)
207 | }
208 | }
209 |
210 | func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, handleLogMessage logMessage: String) {
211 | }
212 | }
213 |
--------------------------------------------------------------------------------
/example/ios/VPNExtension/VPNExtension.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.developer.networking.networkextension
6 |
7 | packet-tunnel-provider
8 |
9 | com.apple.security.application-groups
10 |
11 | group.com.laskarmedia.vpn
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'dart:async';
5 |
6 | import 'package:openvpn_flutter/openvpn_flutter.dart';
7 |
8 | void main() {
9 | runApp(const MyApp());
10 | }
11 |
12 | class MyApp extends StatefulWidget {
13 | const MyApp({Key? key}) : super(key: key);
14 |
15 | @override
16 | State createState() => _MyAppState();
17 | }
18 |
19 | class _MyAppState extends State {
20 | late OpenVPN engine;
21 | VpnStatus? status;
22 | String? stage;
23 | bool _granted = false;
24 | @override
25 | void initState() {
26 | engine = OpenVPN(
27 | onVpnStatusChanged: (data) {
28 | setState(() {
29 | status = data;
30 | });
31 | },
32 | onVpnStageChanged: (data, raw) {
33 | setState(() {
34 | stage = raw;
35 | });
36 | },
37 | );
38 |
39 | engine.initialize(
40 | groupIdentifier: "group.com.laskarmedia.vpn",
41 | providerBundleIdentifier:
42 | "id.laskarmedia.openvpnFlutterExample.VPNExtension",
43 | localizedDescription: "VPN by Nizwar",
44 | lastStage: (stage) {
45 | setState(() {
46 | this.stage = stage.name;
47 | });
48 | },
49 | lastStatus: (status) {
50 | setState(() {
51 | this.status = status;
52 | });
53 | },
54 | );
55 | super.initState();
56 | }
57 |
58 | Future initPlatformState() async {
59 | engine.connect(
60 | config,
61 | "USA",
62 | username: defaultVpnUsername,
63 | password: defaultVpnPassword,
64 | certIsRequired: true,
65 | );
66 | if (!mounted) return;
67 | }
68 |
69 | @override
70 | Widget build(BuildContext context) {
71 | return MaterialApp(
72 | home: Scaffold(
73 | appBar: AppBar(
74 | title: const Text('Plugin example app'),
75 | ),
76 | body: Center(
77 | child: Column(
78 | mainAxisSize: MainAxisSize.min,
79 | children: [
80 | Text(stage?.toString() ?? VPNStage.disconnected.toString()),
81 | Text(status?.toJson().toString() ?? ""),
82 | TextButton(
83 | child: const Text("Start"),
84 | onPressed: () {
85 | initPlatformState();
86 | },
87 | ),
88 | TextButton(
89 | child: const Text("STOP"),
90 | onPressed: () {
91 | engine.disconnect();
92 | },
93 | ),
94 | if (Platform.isAndroid)
95 | TextButton(
96 | child: Text(_granted ? "Granted" : "Request Permission"),
97 | onPressed: () {
98 | engine.requestPermissionAndroid().then((value) {
99 | setState(() {
100 | _granted = value;
101 | });
102 | });
103 | },
104 | ),
105 | ],
106 | ),
107 | ),
108 | ),
109 | );
110 | }
111 | }
112 |
113 | const String defaultVpnUsername = "";
114 | const String defaultVpnPassword = "";
115 |
116 | String get config => "HERE IS YOUR OVPN SCRIPT";
117 |
--------------------------------------------------------------------------------
/example/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | async:
5 | dependency: transitive
6 | description:
7 | name: async
8 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
9 | url: "https://pub.dev"
10 | source: hosted
11 | version: "2.11.0"
12 | boolean_selector:
13 | dependency: transitive
14 | description:
15 | name: boolean_selector
16 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
17 | url: "https://pub.dev"
18 | source: hosted
19 | version: "2.1.1"
20 | characters:
21 | dependency: transitive
22 | description:
23 | name: characters
24 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
25 | url: "https://pub.dev"
26 | source: hosted
27 | version: "1.3.0"
28 | clock:
29 | dependency: transitive
30 | description:
31 | name: clock
32 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
33 | url: "https://pub.dev"
34 | source: hosted
35 | version: "1.1.1"
36 | collection:
37 | dependency: transitive
38 | description:
39 | name: collection
40 | sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
41 | url: "https://pub.dev"
42 | source: hosted
43 | version: "1.19.0"
44 | cupertino_icons:
45 | dependency: "direct main"
46 | description:
47 | name: cupertino_icons
48 | sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
49 | url: "https://pub.dev"
50 | source: hosted
51 | version: "1.0.8"
52 | fake_async:
53 | dependency: transitive
54 | description:
55 | name: fake_async
56 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
57 | url: "https://pub.dev"
58 | source: hosted
59 | version: "1.3.1"
60 | flutter:
61 | dependency: "direct main"
62 | description: flutter
63 | source: sdk
64 | version: "0.0.0"
65 | flutter_lints:
66 | dependency: "direct dev"
67 | description:
68 | name: flutter_lints
69 | sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493
70 | url: "https://pub.dev"
71 | source: hosted
72 | version: "1.0.4"
73 | flutter_test:
74 | dependency: "direct dev"
75 | description: flutter
76 | source: sdk
77 | version: "0.0.0"
78 | leak_tracker:
79 | dependency: transitive
80 | description:
81 | name: leak_tracker
82 | sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
83 | url: "https://pub.dev"
84 | source: hosted
85 | version: "10.0.7"
86 | leak_tracker_flutter_testing:
87 | dependency: transitive
88 | description:
89 | name: leak_tracker_flutter_testing
90 | sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
91 | url: "https://pub.dev"
92 | source: hosted
93 | version: "3.0.8"
94 | leak_tracker_testing:
95 | dependency: transitive
96 | description:
97 | name: leak_tracker_testing
98 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
99 | url: "https://pub.dev"
100 | source: hosted
101 | version: "3.0.1"
102 | lints:
103 | dependency: transitive
104 | description:
105 | name: lints
106 | sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c
107 | url: "https://pub.dev"
108 | source: hosted
109 | version: "1.0.1"
110 | matcher:
111 | dependency: transitive
112 | description:
113 | name: matcher
114 | sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
115 | url: "https://pub.dev"
116 | source: hosted
117 | version: "0.12.16+1"
118 | material_color_utilities:
119 | dependency: transitive
120 | description:
121 | name: material_color_utilities
122 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
123 | url: "https://pub.dev"
124 | source: hosted
125 | version: "0.11.1"
126 | meta:
127 | dependency: transitive
128 | description:
129 | name: meta
130 | sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
131 | url: "https://pub.dev"
132 | source: hosted
133 | version: "1.15.0"
134 | openvpn_flutter:
135 | dependency: "direct main"
136 | description:
137 | path: ".."
138 | relative: true
139 | source: path
140 | version: "1.3.3"
141 | path:
142 | dependency: transitive
143 | description:
144 | name: path
145 | sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
146 | url: "https://pub.dev"
147 | source: hosted
148 | version: "1.9.0"
149 | sky_engine:
150 | dependency: transitive
151 | description: flutter
152 | source: sdk
153 | version: "0.0.0"
154 | source_span:
155 | dependency: transitive
156 | description:
157 | name: source_span
158 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
159 | url: "https://pub.dev"
160 | source: hosted
161 | version: "1.10.0"
162 | stack_trace:
163 | dependency: transitive
164 | description:
165 | name: stack_trace
166 | sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
167 | url: "https://pub.dev"
168 | source: hosted
169 | version: "1.12.0"
170 | stream_channel:
171 | dependency: transitive
172 | description:
173 | name: stream_channel
174 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
175 | url: "https://pub.dev"
176 | source: hosted
177 | version: "2.1.2"
178 | string_scanner:
179 | dependency: transitive
180 | description:
181 | name: string_scanner
182 | sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
183 | url: "https://pub.dev"
184 | source: hosted
185 | version: "1.3.0"
186 | term_glyph:
187 | dependency: transitive
188 | description:
189 | name: term_glyph
190 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
191 | url: "https://pub.dev"
192 | source: hosted
193 | version: "1.2.1"
194 | test_api:
195 | dependency: transitive
196 | description:
197 | name: test_api
198 | sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
199 | url: "https://pub.dev"
200 | source: hosted
201 | version: "0.7.3"
202 | vector_math:
203 | dependency: transitive
204 | description:
205 | name: vector_math
206 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
207 | url: "https://pub.dev"
208 | source: hosted
209 | version: "2.1.4"
210 | vm_service:
211 | dependency: transitive
212 | description:
213 | name: vm_service
214 | sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
215 | url: "https://pub.dev"
216 | source: hosted
217 | version: "14.3.0"
218 | sdks:
219 | dart: ">=3.4.0 <4.0.0"
220 | flutter: ">=3.18.0-18.0.pre.54"
221 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: openvpn_flutter_example
2 | description: Demonstrates how to use the openvpn_flutter plugin.
3 | publish_to: 'none'
4 | version: 1.0.0+1
5 |
6 | environment:
7 | sdk: ">=2.15.0 <4.0.0"
8 | dependencies:
9 | flutter:
10 | sdk: flutter
11 |
12 | openvpn_flutter:
13 | path: ../
14 | cupertino_icons: ^1.0.2
15 |
16 | dev_dependencies:
17 | flutter_test:
18 | sdk: flutter
19 | flutter_lints: ^1.0.0
20 |
21 | flutter:
22 | uses-material-design: true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vagrant/
3 | .sconsign.dblite
4 | .svn/
5 |
6 | .DS_Store
7 | *.swp
8 | profile
9 |
10 | DerivedData/
11 | build/
12 | GeneratedPluginRegistrant.h
13 | GeneratedPluginRegistrant.m
14 |
15 | .generated/
16 |
17 | *.pbxuser
18 | *.mode1v3
19 | *.mode2v3
20 | *.perspectivev3
21 |
22 | !default.pbxuser
23 | !default.mode1v3
24 | !default.mode2v3
25 | !default.perspectivev3
26 |
27 | xcuserdata
28 |
29 | *.moved-aside
30 |
31 | *.pyc
32 | *sync/
33 | Icon?
34 | .tags*
35 |
36 | /Flutter/Generated.xcconfig
37 | /Flutter/ephemeral/
38 | /Flutter/flutter_export_environment.sh
--------------------------------------------------------------------------------
/ios/Assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nizwar/openvpn_flutter/363f3c7bc538c3f33f762f15c3caa1646eb5333f/ios/Assets/.gitkeep
--------------------------------------------------------------------------------
/ios/Classes/OpenVPNFlutterPlugin.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface OpenVPNFlutterPlugin : NSObject
4 | @end
5 |
--------------------------------------------------------------------------------
/ios/Classes/OpenVPNFlutterPlugin.m:
--------------------------------------------------------------------------------
1 | #import "OpenvpnFlutterPlugin.h"
2 | #if __has_include()
3 | #import
4 | #else
5 | // Support project import fallback if the generated compatibility header
6 | // is not copied when this plugin is created as a library.
7 | // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
8 | #import "openvpn_flutter-Swift.h"
9 | #endif
10 |
11 | @implementation OpenVPNFlutterPlugin
12 | + (void)registerWithRegistrar:(NSObject*)registrar {
13 | [SwiftOpenVPNFlutterPlugin registerWithRegistrar:registrar];
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/ios/Classes/SwiftOpenVPNFlutterPlugin.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 | import NetworkExtension
4 |
5 | public class SwiftOpenVPNFlutterPlugin: NSObject, FlutterPlugin {
6 | private static var utils : VPNUtils! = VPNUtils()
7 |
8 | private static var EVENT_CHANNEL_VPN_STAGE = "id.laskarmedia.openvpn_flutter/vpnstage"
9 | private static var METHOD_CHANNEL_VPN_CONTROL = "id.laskarmedia.openvpn_flutter/vpncontrol"
10 |
11 | public static var stage: FlutterEventSink?
12 | private var initialized : Bool = false
13 |
14 | public static func register(with registrar: FlutterPluginRegistrar) {
15 | let instance = SwiftOpenVPNFlutterPlugin()
16 | instance.onRegister(registrar)
17 | }
18 |
19 | public func onRegister(_ registrar: FlutterPluginRegistrar){
20 | let vpnControlM = FlutterMethodChannel(name: SwiftOpenVPNFlutterPlugin.METHOD_CHANNEL_VPN_CONTROL, binaryMessenger: registrar.messenger())
21 | let vpnStageE = FlutterEventChannel(name: SwiftOpenVPNFlutterPlugin.EVENT_CHANNEL_VPN_STAGE, binaryMessenger: registrar.messenger())
22 |
23 | vpnStageE.setStreamHandler(StageHandler())
24 | vpnControlM.setMethodCallHandler({(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
25 | switch call.method {
26 | case "status":
27 | SwiftOpenVPNFlutterPlugin.utils.getTraffictStats()
28 | result(UserDefaults.init(suiteName: SwiftOpenVPNFlutterPlugin.utils.groupIdentifier)?.string(forKey: "connectionUpdate"))
29 | break;
30 | case "stage":
31 | result(SwiftOpenVPNFlutterPlugin.utils.currentStatus())
32 | break;
33 | case "initialize":
34 | let providerBundleIdentifier: String? = (call.arguments as? [String: Any])?["providerBundleIdentifier"] as? String
35 | let localizedDescription: String? = (call.arguments as? [String: Any])?["localizedDescription"] as? String
36 | let groupIdentifier: String? = (call.arguments as? [String: Any])?["groupIdentifier"] as? String
37 | if providerBundleIdentifier == nil {
38 | result(FlutterError(code: "-2",
39 | message: "providerBundleIdentifier content empty or null",
40 | details: nil));
41 | return;
42 | }
43 | if localizedDescription == nil {
44 | result(FlutterError(code: "-3",
45 | message: "localizedDescription content empty or null",
46 | details: nil));
47 | return;
48 | }
49 | if groupIdentifier == nil {
50 | result(FlutterError(code: "-4",
51 | message: "groupIdentifier content empty or null",
52 | details: nil));
53 | return;
54 | }
55 | SwiftOpenVPNFlutterPlugin.utils.groupIdentifier = groupIdentifier
56 | SwiftOpenVPNFlutterPlugin.utils.localizedDescription = localizedDescription
57 | SwiftOpenVPNFlutterPlugin.utils.providerBundleIdentifier = providerBundleIdentifier
58 | SwiftOpenVPNFlutterPlugin.utils.loadProviderManager{(err:Error?) in
59 | if err == nil{
60 | result(SwiftOpenVPNFlutterPlugin.utils.currentStatus())
61 | }else{
62 | result(FlutterError(code: "-4", message: err?.localizedDescription, details: err?.localizedDescription));
63 | }
64 | }
65 | self.initialized = true
66 | break;
67 | case "disconnect":
68 | SwiftOpenVPNFlutterPlugin.utils.stopVPN()
69 | break;
70 | case "connect":
71 | if !self.initialized {
72 | result(FlutterError(code: "-1",
73 | message: "VPNEngine need to be initialize",
74 | details: nil));
75 | }
76 | let config: String? = (call.arguments as? [String : Any])? ["config"] as? String
77 | let username: String? = (call.arguments as? [String : Any])? ["username"] as? String
78 | let password: String? = (call.arguments as? [String : Any])? ["password"] as? String
79 | if config == nil{
80 | result(FlutterError(code: "-2",
81 | message:"Config is empty or nulled",
82 | details: "Config can't be nulled"))
83 | return
84 | }
85 |
86 | SwiftOpenVPNFlutterPlugin.utils.configureVPN(config: config, username: username, password: password, completion: {(success:Error?) -> Void in
87 | if(success == nil){
88 | result(nil)
89 | }else{
90 | result(FlutterError(code: "99",
91 | message: "permission denied",
92 | details: success?.localizedDescription))
93 | }
94 | })
95 | break;
96 | case "dispose":
97 | self.initialized = false
98 | default:
99 | break;
100 | }
101 | })
102 | }
103 |
104 |
105 | class StageHandler: NSObject, FlutterStreamHandler {
106 | func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? {
107 | SwiftOpenVPNFlutterPlugin.utils.stage = events
108 | return nil
109 | }
110 |
111 | func onCancel(withArguments arguments: Any?) -> FlutterError? {
112 | SwiftOpenVPNFlutterPlugin.utils.stage = nil
113 | return nil
114 | }
115 | }
116 |
117 |
118 | }
119 |
120 |
121 | @available(iOS 9.0, *)
122 | class VPNUtils {
123 | var providerManager: NETunnelProviderManager!
124 | var providerBundleIdentifier : String?
125 | var localizedDescription : String?
126 | var groupIdentifier : String?
127 | var stage : FlutterEventSink!
128 | var vpnStageObserver : NSObjectProtocol?
129 |
130 | func loadProviderManager(completion:@escaping (_ error : Error?) -> Void) {
131 | NETunnelProviderManager.loadAllFromPreferences { (managers, error) in
132 | if error == nil {
133 | self.providerManager = managers?.first ?? NETunnelProviderManager()
134 | completion(nil)
135 | } else {
136 | completion(error)
137 | }
138 | }
139 | }
140 |
141 | func onVpnStatusChanged(notification : NEVPNStatus) {
142 | switch notification {
143 | case NEVPNStatus.connected:
144 | stage?("connected")
145 | break;
146 | case NEVPNStatus.connecting:
147 | stage?("connecting")
148 | break;
149 | case NEVPNStatus.disconnected:
150 | stage?("disconnected")
151 | break;
152 | case NEVPNStatus.disconnecting:
153 | stage?("disconnecting")
154 | break;
155 | case NEVPNStatus.invalid:
156 | stage?("invalid")
157 | break;
158 | case NEVPNStatus.reasserting:
159 | stage?("reasserting")
160 | break;
161 | default:
162 | stage?("null")
163 | break;
164 | }
165 | }
166 |
167 | func onVpnStatusChangedString(notification : NEVPNStatus?) -> String?{
168 | if notification == nil {
169 | return "disconnected"
170 | }
171 | switch notification! {
172 | case NEVPNStatus.connected:
173 | return "connected";
174 | case NEVPNStatus.connecting:
175 | return "connecting";
176 | case NEVPNStatus.disconnected:
177 | return "disconnected";
178 | case NEVPNStatus.disconnecting:
179 | return "disconnecting";
180 | case NEVPNStatus.invalid:
181 | return "invalid";
182 | case NEVPNStatus.reasserting:
183 | return "reasserting";
184 | default:
185 | return "";
186 | }
187 | }
188 |
189 | func currentStatus() -> String? {
190 | if self.providerManager != nil {
191 | return onVpnStatusChangedString(notification: self.providerManager.connection.status)}
192 | else{
193 | return "disconnected"
194 | }
195 | }
196 |
197 | func configureVPN(config: String?, username : String?,password : String?,completion:@escaping (_ error : Error?) -> Void) {
198 | let configData = config
199 | self.providerManager?.loadFromPreferences { error in
200 | if error == nil {
201 | let tunnelProtocol = NETunnelProviderProtocol()
202 | tunnelProtocol.serverAddress = ""
203 | tunnelProtocol.providerBundleIdentifier = self.providerBundleIdentifier
204 | let nullData = "".data(using: .utf8)
205 | tunnelProtocol.providerConfiguration = [
206 | "config": configData?.data(using: .utf8) ?? nullData!,
207 | "groupIdentifier": self.groupIdentifier?.data(using: .utf8) ?? nullData!,
208 | "username" : username?.data(using: .utf8) ?? nullData!,
209 | "password" : password?.data(using: .utf8) ?? nullData!
210 | ]
211 | tunnelProtocol.disconnectOnSleep = false
212 | self.providerManager.protocolConfiguration = tunnelProtocol
213 | self.providerManager.localizedDescription = self.localizedDescription // the title of the VPN profile which will appear on Settings
214 | self.providerManager.isEnabled = true
215 | self.providerManager.saveToPreferences(completionHandler: { (error) in
216 | if error == nil {
217 | self.providerManager.loadFromPreferences(completionHandler: { (error) in
218 | if error != nil {
219 | completion(error);
220 | return;
221 | }
222 | do {
223 | if self.vpnStageObserver != nil {
224 | NotificationCenter.default.removeObserver(self.vpnStageObserver!,
225 | name: NSNotification.Name.NEVPNStatusDidChange,
226 | object: nil)
227 | }
228 | self.vpnStageObserver = NotificationCenter.default.addObserver(forName: NSNotification.Name.NEVPNStatusDidChange,
229 | object: nil ,
230 | queue: nil) { [weak self] notification in
231 | let nevpnconn = notification.object as! NEVPNConnection
232 | let status = nevpnconn.status
233 | self?.onVpnStatusChanged(notification: status)
234 | }
235 |
236 | if username != nil && password != nil{
237 | let options: [String : NSObject] = [
238 | "username": username! as NSString,
239 | "password": password! as NSString
240 | ]
241 | try self.providerManager.connection.startVPNTunnel(options: options)
242 | }else{
243 | try self.providerManager.connection.startVPNTunnel()
244 | }
245 | completion(nil);
246 | } catch let error {
247 | self.stopVPN()
248 | print("Error info: \(error)")
249 | completion(error);
250 | }
251 | })
252 | } else {
253 | completion(error);
254 | }
255 | })
256 | }
257 | }
258 |
259 |
260 | }
261 |
262 | func stopVPN() {
263 | self.providerManager.connection.stopVPNTunnel();
264 | }
265 |
266 | func getTraffictStats(){
267 | if let session = self.providerManager?.connection as? NETunnelProviderSession {
268 | do {
269 | try session.sendProviderMessage("OPENVPN_STATS".data(using: .utf8)!) {(data) in
270 | //Do nothing
271 | }
272 | } catch {
273 | // some error
274 | }
275 | }
276 | }
277 | }
278 |
--------------------------------------------------------------------------------
/ios/openvpn_flutter.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
3 | # Run `pod lib lint openvpn_flutter.podspec` to validate before publishing.
4 | #
5 | Pod::Spec.new do |s|
6 | s.name = 'openvpn_flutter'
7 | s.version = '0.0.1'
8 | s.summary = 'OpenVPN for flutter'
9 | s.description = <<-DESC
10 | OpenVPN for flutter
11 | DESC
12 | s.homepage = 'http://nizwar.github.io/home'
13 | s.license = { :file => '../LICENSE' }
14 | s.author = { 'Laskarmedia' => 'nizwar@laskarmedia.id' }
15 | s.source = { :path => '.' }
16 | s.source_files = 'Classes/**/*'
17 | s.dependency 'Flutter'
18 | s.platform = :ios, '9.0'
19 |
20 | # Flutter.framework does not contain a i386 slice.
21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
22 | s.swift_version = '5.0'
23 | end
24 |
--------------------------------------------------------------------------------
/lib/openvpn_flutter.dart:
--------------------------------------------------------------------------------
1 | export 'src/vpn_engine.dart';
2 | export 'src/model/vpn_status.dart';
3 |
--------------------------------------------------------------------------------
/lib/src/model/vpn_status.dart:
--------------------------------------------------------------------------------
1 | ///To store datas of VPN Connection's status detail
2 | class VpnStatus {
3 | VpnStatus({
4 | this.duration,
5 | this.connectedOn,
6 | this.byteIn,
7 | this.byteOut,
8 | this.packetsIn,
9 | this.packetsOut,
10 | });
11 |
12 | ///Latest connection date
13 | ///Return null if vpn disconnected
14 | final DateTime? connectedOn;
15 |
16 | ///Duration of vpn usage
17 | final String? duration;
18 |
19 | ///Download byte usages
20 | final String? byteIn;
21 |
22 | ///Upload byte usages
23 | final String? byteOut;
24 |
25 | ///Packets in byte usages
26 | final String? packetsIn;
27 |
28 | ///Packets out byte usages
29 | final String? packetsOut;
30 |
31 | /// VPNStatus as empty data
32 | factory VpnStatus.empty() => VpnStatus(
33 | duration: "00:00:00",
34 | connectedOn: null,
35 | byteIn: "0",
36 | byteOut: "0",
37 | packetsIn: "0",
38 | packetsOut: "0",
39 | );
40 |
41 | ///Convert to JSON
42 | Map toJson() => {
43 | "connected_on": connectedOn,
44 | "duration": duration,
45 | "byte_in": byteIn,
46 | "byte_out": byteOut,
47 | "packets_in": packetsIn,
48 | "packets_out": packetsOut,
49 | };
50 |
51 | @override
52 | String toString() => toJson().toString();
53 | }
54 |
--------------------------------------------------------------------------------
/lib/src/vpn_engine.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:convert';
3 | import 'dart:io';
4 | import 'dart:math';
5 | import 'package:flutter/services.dart';
6 | import 'model/vpn_status.dart';
7 |
8 | ///Stages of vpn connections
9 | enum VPNStage {
10 | prepare,
11 | authenticating,
12 | connecting,
13 | authentication,
14 | connected,
15 | disconnected,
16 | disconnecting,
17 | denied,
18 | error,
19 | // ignore: constant_identifier_names
20 | wait_connection,
21 | // ignore: constant_identifier_names
22 | vpn_generate_config,
23 | // ignore: constant_identifier_names
24 | get_config,
25 | // ignore: constant_identifier_names
26 | tcp_connect,
27 | // ignore: constant_identifier_names
28 | udp_connect,
29 | // ignore: constant_identifier_names
30 | assign_ip,
31 | resolve,
32 | exiting,
33 | unknown
34 | }
35 |
36 | class OpenVPN {
37 | ///Channel's names of _vpnStageSnapshot
38 | static const String _eventChannelVpnStage =
39 | "id.laskarmedia.openvpn_flutter/vpnstage";
40 |
41 | ///Channel's names of _channelControl
42 | static const String _methodChannelVpnControl =
43 | "id.laskarmedia.openvpn_flutter/vpncontrol";
44 |
45 | ///Method channel to invoke methods from native side
46 | static const MethodChannel _channelControl =
47 | MethodChannel(_methodChannelVpnControl);
48 |
49 | ///Snapshot of stream that produced by native side
50 | static Stream _vpnStageSnapshot() =>
51 | const EventChannel(_eventChannelVpnStage).receiveBroadcastStream().cast();
52 |
53 | ///Timer to get vpnstatus as a loop
54 | ///
55 | ///I know it was bad practice, but this is the only way to avoid android status duration having long delay
56 | Timer? _vpnStatusTimer;
57 |
58 | ///To indicate the engine already initialize
59 | bool initialized = false;
60 |
61 | ///Use tempDateTime to countdown, especially on android that has delays
62 | DateTime? _tempDateTime;
63 |
64 | VPNStage? _lastStage;
65 |
66 | /// is a listener to see vpn status detail
67 | final Function(VpnStatus? data)? onVpnStatusChanged;
68 |
69 | /// is a listener to see what stage the connection was
70 | final Function(VPNStage stage, String rawStage)? onVpnStageChanged;
71 |
72 | /// OpenVPN's Constructions, don't forget to implement the listeners
73 | /// onVpnStatusChanged is a listener to see vpn status detail
74 | /// onVpnStageChanged is a listener to see what stage the connection was
75 | OpenVPN({this.onVpnStatusChanged, this.onVpnStageChanged});
76 |
77 | ///This function should be called before any usage of OpenVPN
78 | ///All params required for iOS, make sure you read the plugin's documentation
79 | ///
80 | ///
81 | ///providerBundleIdentfier is for your Network Extension identifier
82 | ///
83 | ///localizedDescription is for description to show in user's settings
84 | ///
85 | ///
86 | ///Will return latest VPNStage
87 | Future initialize({
88 | String? providerBundleIdentifier,
89 | String? localizedDescription,
90 | String? groupIdentifier,
91 | Function(VpnStatus status)? lastStatus,
92 | Function(VPNStage stage)? lastStage,
93 | }) async {
94 | if (Platform.isIOS) {
95 | assert(
96 | groupIdentifier != null &&
97 | providerBundleIdentifier != null &&
98 | localizedDescription != null,
99 | "These values are required for ios.");
100 | }
101 | onVpnStatusChanged?.call(VpnStatus.empty());
102 | initialized = true;
103 | _initializeListener();
104 | return _channelControl.invokeMethod("initialize", {
105 | "groupIdentifier": groupIdentifier,
106 | "providerBundleIdentifier": providerBundleIdentifier,
107 | "localizedDescription": localizedDescription,
108 | }).then((value) {
109 | Future.wait([
110 | status().then((value) => lastStatus?.call(value)),
111 | stage().then((value) {
112 | if (value == VPNStage.connected && _vpnStatusTimer == null) {
113 | _createTimer();
114 | }
115 | return lastStage?.call(value);
116 | }),
117 | ]);
118 | });
119 | }
120 |
121 | ///Connect to VPN
122 | ///
123 | ///config : Your openvpn configuration script, you can find it inside your .ovpn file
124 | ///
125 | ///name : name that will show in user's notification
126 | ///
127 | ///certIsRequired : default is false, if your config file has cert, set it to true
128 | ///
129 | ///username & password : set your username and password if your config file has auth-user-pass
130 | ///
131 | ///bypassPackages : exclude some apps to access/use the VPN Connection, it was List of applications package's name (Android Only)
132 | Future connect(String config, String name,
133 | {String? username,
134 | String? password,
135 | List? bypassPackages,
136 | bool certIsRequired = false}) {
137 | if (!initialized) throw ("OpenVPN need to be initialized");
138 | if (!certIsRequired) config += "client-cert-not-required";
139 | _tempDateTime = DateTime.now();
140 |
141 | try {
142 | return _channelControl.invokeMethod("connect", {
143 | "config": config,
144 | "name": name,
145 | "username": username,
146 | "password": password,
147 | "bypass_packages": bypassPackages ?? []
148 | });
149 | } on PlatformException catch (e) {
150 | throw ArgumentError(e.message);
151 | }
152 | }
153 |
154 | ///Disconnect from VPN
155 | void disconnect() {
156 | _tempDateTime = null;
157 | _channelControl.invokeMethod("disconnect");
158 | if (_vpnStatusTimer?.isActive ?? false) {
159 | _vpnStatusTimer?.cancel();
160 | _vpnStatusTimer = null;
161 | }
162 | }
163 |
164 | ///Check if connected to vpn
165 | Future isConnected() async =>
166 | stage().then((value) => value == VPNStage.connected);
167 |
168 | ///Get latest connection stage
169 | Future stage() async {
170 | String? stage = await _channelControl.invokeMethod("stage");
171 | return _strToStage(stage ?? "disconnected");
172 | }
173 |
174 | ///Get latest connection status
175 | Future status() {
176 | //Have to check if user already connected to get real data
177 | return stage().then((value) async {
178 | var status = VpnStatus.empty();
179 | if (value == VPNStage.connected) {
180 | status = await _channelControl.invokeMethod("status").then((value) {
181 | if (value == null) return VpnStatus.empty();
182 |
183 | if (Platform.isIOS) {
184 | var splitted = value.split("_");
185 | var connectedOn = DateTime.tryParse(splitted[0]);
186 | if (connectedOn == null) return VpnStatus.empty();
187 | return VpnStatus(
188 | connectedOn: connectedOn,
189 | duration: _duration(DateTime.now().difference(connectedOn).abs()),
190 | packetsIn: splitted[1],
191 | packetsOut: splitted[2],
192 | byteIn: splitted[3],
193 | byteOut: splitted[4],
194 | );
195 | } else if (Platform.isAndroid) {
196 | var data = jsonDecode(value);
197 | var connectedOn =
198 | DateTime.tryParse(data["connected_on"].toString()) ??
199 | _tempDateTime ??
200 | DateTime.now();
201 | String byteIn =
202 | data["byte_in"] != null ? data["byte_in"].toString() : "0";
203 | String byteOut =
204 | data["byte_out"] != null ? data["byte_out"].toString() : "0";
205 | if (byteIn.trim().isEmpty) byteIn = "0";
206 | if (byteOut.trim().isEmpty) byteOut = "0";
207 | return VpnStatus(
208 | connectedOn: connectedOn,
209 | duration: _duration(DateTime.now().difference(connectedOn).abs()),
210 | byteIn: byteIn,
211 | byteOut: byteOut,
212 | packetsIn: byteIn,
213 | packetsOut: byteOut,
214 | );
215 | } else {
216 | throw Exception("Openvpn not supported on this platform");
217 | }
218 | });
219 | }
220 | return status;
221 | });
222 | }
223 |
224 | ///Request android permission (Return true if already granted)
225 | Future requestPermissionAndroid() async {
226 | return _channelControl
227 | .invokeMethod("request_permission")
228 | .then((value) => value ?? false);
229 | }
230 |
231 | ///Sometimes config script has too many Remotes, it cause ANR in several devices,
232 | ///This happened because the plugin check every remote and somehow affected the UI to freeze
233 | ///
234 | ///Use this function if you wanted to force user to use 1 remote by randomize the remotes provided
235 | static Future filteredConfig(String? config) async {
236 | List remotes = [];
237 | List output = [];
238 | if (config == null) return null;
239 | var raw = config.split("\n");
240 |
241 | for (var item in raw) {
242 | if (item.trim().toLowerCase().startsWith("remote ")) {
243 | if (!output.contains("REMOTE_HERE")) {
244 | output.add("REMOTE_HERE");
245 | }
246 | remotes.add(item);
247 | } else {
248 | output.add(item);
249 | }
250 | }
251 | String fastestServer = remotes[Random().nextInt(remotes.length - 1)];
252 | int indexRemote = output.indexWhere((element) => element == "REMOTE_HERE");
253 | output.removeWhere((element) => element == "REMOTE_HERE");
254 | output.insert(indexRemote, fastestServer);
255 | return output.join("\n");
256 | }
257 |
258 | ///Convert duration that produced by native side as Connection Time
259 | String _duration(Duration duration) {
260 | String twoDigits(int n) => n.toString().padLeft(2, "0");
261 | String twoDigitMinutes = twoDigits(duration.inMinutes.remainder(60));
262 | String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60));
263 | return "${twoDigits(duration.inHours)}:$twoDigitMinutes:$twoDigitSeconds";
264 | }
265 |
266 | ///Private function to convert String to VPNStage
267 | static VPNStage _strToStage(String? stage) {
268 | if (stage == null ||
269 | stage.trim().isEmpty ||
270 | stage.trim() == "idle" ||
271 | stage.trim() == "invalid") {
272 | return VPNStage.disconnected;
273 | }
274 | var indexStage = VPNStage.values.indexWhere((element) => element
275 | .toString()
276 | .trim()
277 | .toLowerCase()
278 | .contains(stage.toString().trim().toLowerCase()));
279 | if (indexStage >= 0) return VPNStage.values[indexStage];
280 | return VPNStage.unknown;
281 | }
282 |
283 | ///Initialize listener, called when you start connection and stoped while
284 | void _initializeListener() {
285 | _vpnStageSnapshot().listen((event) {
286 | var vpnStage = _strToStage(event);
287 | if (vpnStage != _lastStage) {
288 | onVpnStageChanged?.call(vpnStage, event);
289 | _lastStage = vpnStage;
290 | }
291 | if (vpnStage != VPNStage.disconnected) {
292 | if (Platform.isAndroid) {
293 | _createTimer();
294 | } else if (Platform.isIOS && vpnStage == VPNStage.connected) {
295 | _createTimer();
296 | }
297 | } else {
298 | _vpnStatusTimer?.cancel();
299 | }
300 | });
301 | }
302 |
303 | ///Create timer to invoke status
304 | void _createTimer() {
305 | if (_vpnStatusTimer != null) {
306 | _vpnStatusTimer!.cancel();
307 | _vpnStatusTimer = null;
308 | }
309 | _vpnStatusTimer ??=
310 | Timer.periodic(const Duration(seconds: 1), (timer) async {
311 | onVpnStatusChanged?.call(await status());
312 | });
313 | }
314 | }
315 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: openvpn_flutter
2 | description: A plugin that allow you to connect OpenVPN service with Flutter
3 | version: 1.3.4
4 | homepage: https://github.com/nizwar/openvpn_flutter
5 |
6 | environment:
7 | sdk: ">=2.15.0 <4.0.0"
8 | flutter: ">=2.5.0"
9 |
10 | dependencies:
11 | flutter:
12 | sdk: flutter
13 |
14 | dev_dependencies:
15 | flutter_lints: ^3.0.1
16 | flutter_test:
17 | sdk: flutter
18 |
19 | flutter:
20 | plugin:
21 | platforms:
22 | android:
23 | package: id.laskarmedia.openvpn_flutter
24 | pluginClass: OpenVPNFlutterPlugin
25 | ios:
26 | pluginClass: OpenVPNFlutterPlugin
27 |
--------------------------------------------------------------------------------