react-native-ovpn 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/Openvpn.podspec +34 -0
- package/README.md +80 -0
- package/android/build.gradle +98 -0
- package/android/libs/README.md +46 -0
- package/android/libs/ics-openvpn.aar +0 -0
- package/android/src/main/AndroidManifest.xml +54 -0
- package/android/src/main/java/com/openvpn/NotificationHelper.kt +59 -0
- package/android/src/main/java/com/openvpn/OpenvpnEventBus.kt +52 -0
- package/android/src/main/java/com/openvpn/OpenvpnException.kt +6 -0
- package/android/src/main/java/com/openvpn/OpenvpnModule.kt +140 -0
- package/android/src/main/java/com/openvpn/OpenvpnPackage.kt +31 -0
- package/android/src/main/java/com/openvpn/OpenvpnService.kt +248 -0
- package/android/src/main/java/com/openvpn/PermissionLauncher.kt +39 -0
- package/android/src/main/java/com/openvpn/ProfileBuilder.kt +68 -0
- package/android/src/main/res/drawable/ic_vpn_default.xml +10 -0
- package/android/src/main/res/values/strings.xml +6 -0
- package/android/src/test/java/com/openvpn/NotificationHelperTest.kt +49 -0
- package/android/src/test/java/com/openvpn/ProfileBuilderTest.kt +83 -0
- package/app.plugin.js +3 -0
- package/ios/Openvpn-Bridging-Header.h +8 -0
- package/ios/Openvpn.h +5 -0
- package/ios/Openvpn.mm +123 -0
- package/ios/OpenvpnAppGroup.swift +59 -0
- package/ios/OpenvpnConstants.swift +46 -0
- package/ios/OpenvpnEventBridge.swift +58 -0
- package/ios/OpenvpnManager.swift +219 -0
- package/ios/PacketTunnelProvider/Info.plist +31 -0
- package/ios/PacketTunnelProvider/PacketTunnelProvider.swift +199 -0
- package/ios/PacketTunnelProvider/README.md +106 -0
- package/lib/module/NativeOpenvpn.js +5 -0
- package/lib/module/NativeOpenvpn.js.map +1 -0
- package/lib/module/OpenVPNClient.js +185 -0
- package/lib/module/OpenVPNClient.js.map +1 -0
- package/lib/module/errors.js +13 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/reconnect.js +51 -0
- package/lib/module/reconnect.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/plugin/src/android/index.d.ts +5 -0
- package/lib/typescript/plugin/src/android/index.d.ts.map +1 -0
- package/lib/typescript/plugin/src/android/withAndroidAarCheck.d.ts +5 -0
- package/lib/typescript/plugin/src/android/withAndroidAarCheck.d.ts.map +1 -0
- package/lib/typescript/plugin/src/android/withAndroidLegacyPackaging.d.ts +5 -0
- package/lib/typescript/plugin/src/android/withAndroidLegacyPackaging.d.ts.map +1 -0
- package/lib/typescript/plugin/src/android/withAndroidMinSdk.d.ts +5 -0
- package/lib/typescript/plugin/src/android/withAndroidMinSdk.d.ts.map +1 -0
- package/lib/typescript/plugin/src/android/withAndroidNotificationIcon.d.ts +5 -0
- package/lib/typescript/plugin/src/android/withAndroidNotificationIcon.d.ts.map +1 -0
- package/lib/typescript/plugin/src/android/withAndroidPermissions.d.ts +5 -0
- package/lib/typescript/plugin/src/android/withAndroidPermissions.d.ts.map +1 -0
- package/lib/typescript/plugin/src/android/withAndroidService.d.ts +5 -0
- package/lib/typescript/plugin/src/android/withAndroidService.d.ts.map +1 -0
- package/lib/typescript/plugin/src/index.d.ts +6 -0
- package/lib/typescript/plugin/src/index.d.ts.map +1 -0
- package/lib/typescript/plugin/src/ios/index.d.ts +5 -0
- package/lib/typescript/plugin/src/ios/index.d.ts.map +1 -0
- package/lib/typescript/plugin/src/ios/withIosDeploymentTarget.d.ts +5 -0
- package/lib/typescript/plugin/src/ios/withIosDeploymentTarget.d.ts.map +1 -0
- package/lib/typescript/plugin/src/ios/withIosEntitlements.d.ts +5 -0
- package/lib/typescript/plugin/src/ios/withIosEntitlements.d.ts.map +1 -0
- package/lib/typescript/plugin/src/ios/withIosInfoPlist.d.ts +5 -0
- package/lib/typescript/plugin/src/ios/withIosInfoPlist.d.ts.map +1 -0
- package/lib/typescript/plugin/src/types.d.ts +14 -0
- package/lib/typescript/plugin/src/types.d.ts.map +1 -0
- package/lib/typescript/src/NativeOpenvpn.d.ts +41 -0
- package/lib/typescript/src/NativeOpenvpn.d.ts.map +1 -0
- package/lib/typescript/src/OpenVPNClient.d.ts +37 -0
- package/lib/typescript/src/OpenVPNClient.d.ts.map +1 -0
- package/lib/typescript/src/errors.d.ts +9 -0
- package/lib/typescript/src/errors.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +5 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/reconnect.d.ts +23 -0
- package/lib/typescript/src/reconnect.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +41 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +193 -0
- package/plugin/build/android/index.d.ts +4 -0
- package/plugin/build/android/index.js +24 -0
- package/plugin/build/android/withAndroidAarCheck.d.ts +4 -0
- package/plugin/build/android/withAndroidAarCheck.js +60 -0
- package/plugin/build/android/withAndroidLegacyPackaging.d.ts +4 -0
- package/plugin/build/android/withAndroidLegacyPackaging.js +18 -0
- package/plugin/build/android/withAndroidMinSdk.d.ts +4 -0
- package/plugin/build/android/withAndroidMinSdk.js +13 -0
- package/plugin/build/android/withAndroidNotificationIcon.d.ts +4 -0
- package/plugin/build/android/withAndroidNotificationIcon.js +64 -0
- package/plugin/build/android/withAndroidPermissions.d.ts +4 -0
- package/plugin/build/android/withAndroidPermissions.js +30 -0
- package/plugin/build/android/withAndroidService.d.ts +4 -0
- package/plugin/build/android/withAndroidService.js +40 -0
- package/plugin/build/index.d.ts +5 -0
- package/plugin/build/index.js +18 -0
- package/plugin/build/ios/index.d.ts +4 -0
- package/plugin/build/ios/index.js +15 -0
- package/plugin/build/ios/withIosDeploymentTarget.d.ts +4 -0
- package/plugin/build/ios/withIosDeploymentTarget.js +28 -0
- package/plugin/build/ios/withIosEntitlements.d.ts +4 -0
- package/plugin/build/ios/withIosEntitlements.js +15 -0
- package/plugin/build/ios/withIosInfoPlist.d.ts +4 -0
- package/plugin/build/ios/withIosInfoPlist.js +14 -0
- package/plugin/build/types.d.ts +13 -0
- package/plugin/build/types.js +2 -0
- package/src/NativeOpenvpn.ts +46 -0
- package/src/OpenVPNClient.ts +239 -0
- package/src/errors.ts +29 -0
- package/src/index.ts +12 -0
- package/src/reconnect.ts +68 -0
- package/src/types.ts +53 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Setting up the OpenVPN Network Extension target
|
|
2
|
+
|
|
3
|
+
iOS NetworkExtension code runs in a separate process from your app. To use
|
|
4
|
+
`react-native-ovpn`, you need to add a **Packet Tunnel Provider** extension
|
|
5
|
+
target to your Xcode project. This file walks you through it; Plan 4's Expo
|
|
6
|
+
config plugin will automate all of these steps for Expo consumers.
|
|
7
|
+
|
|
8
|
+
## Prerequisites
|
|
9
|
+
|
|
10
|
+
- Apple Developer account
|
|
11
|
+
- Your app's App ID has the **Network Extensions** capability enabled at
|
|
12
|
+
https://developer.apple.com/account/resources/identifiers — request "Packet
|
|
13
|
+
Tunnel Provider" specifically. Apple typically grants this same-day.
|
|
14
|
+
|
|
15
|
+
## Steps
|
|
16
|
+
|
|
17
|
+
### 1. Create the extension target
|
|
18
|
+
|
|
19
|
+
In Xcode, with your app's workspace open:
|
|
20
|
+
|
|
21
|
+
1. **File → New → Target**
|
|
22
|
+
2. Choose **iOS → Network Extension** (under "Application Extension")
|
|
23
|
+
3. Click **Next**, then in the configuration:
|
|
24
|
+
- **Product Name:** `OpenVPNTunnel`
|
|
25
|
+
- **Provider Type:** Packet Tunnel
|
|
26
|
+
- **Language:** Swift
|
|
27
|
+
4. Click **Finish**. When prompted, **Activate** the new scheme.
|
|
28
|
+
|
|
29
|
+
### 2. Replace the auto-generated `PacketTunnelProvider.swift`
|
|
30
|
+
|
|
31
|
+
Xcode generates a placeholder. Replace it with our template:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cp node_modules/react-native-ovpn/ios/PacketTunnelProvider/PacketTunnelProvider.swift \
|
|
35
|
+
ios/OpenVPNTunnel/PacketTunnelProvider.swift
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
(Adjust paths for your project layout.)
|
|
39
|
+
|
|
40
|
+
### 3. Add OpenVPNAdapter to the extension target
|
|
41
|
+
|
|
42
|
+
Edit your `ios/Podfile`. Add a separate `target` block for the extension:
|
|
43
|
+
|
|
44
|
+
```ruby
|
|
45
|
+
target 'OpenVPNTunnel' do
|
|
46
|
+
pod 'OpenVPNAdapter', '~> 0.8.0'
|
|
47
|
+
end
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Run `pod install`.
|
|
51
|
+
|
|
52
|
+
### 4. Configure entitlements on BOTH targets
|
|
53
|
+
|
|
54
|
+
In Xcode, select your **host app target** → **Signing & Capabilities**:
|
|
55
|
+
|
|
56
|
+
- Add capability: **App Groups**. Use an identifier like `group.<host-bundle-id>.openvpn`.
|
|
57
|
+
- Add capability: **Keychain Sharing** (optional — only if you want credential reuse).
|
|
58
|
+
|
|
59
|
+
Select your **OpenVPNTunnel extension target** → **Signing & Capabilities**:
|
|
60
|
+
|
|
61
|
+
- Add capability: **App Groups**. Use the **same identifier** as the host.
|
|
62
|
+
- Add capability: **Network Extensions** → check **Packet Tunnel**.
|
|
63
|
+
|
|
64
|
+
Both targets must have the same App Group identifier; this is the shared
|
|
65
|
+
container the host and extension use to exchange stats and logs.
|
|
66
|
+
|
|
67
|
+
### 5. Tell our library about the App Group identifier
|
|
68
|
+
|
|
69
|
+
Edit your **host app's `Info.plist`**:
|
|
70
|
+
|
|
71
|
+
```xml
|
|
72
|
+
<key>OpenVPNAppGroupIdentifier</key>
|
|
73
|
+
<string>group.com.example.app.openvpn</string>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
(Replace with the exact identifier you used in step 4.)
|
|
77
|
+
|
|
78
|
+
If your extension's bundle identifier does NOT follow the convention
|
|
79
|
+
`<host-bundle-id>.OpenVPNTunnel` (which is the default the library assumes),
|
|
80
|
+
also add:
|
|
81
|
+
|
|
82
|
+
```xml
|
|
83
|
+
<key>OpenVPNExtensionBundleIdentifier</key>
|
|
84
|
+
<string>your.exact.extension.bundle.identifier</string>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 6. Build and run
|
|
88
|
+
|
|
89
|
+
Build the **host app target** first. If it succeeds, build the **OpenVPNTunnel
|
|
90
|
+
extension target** to validate its setup. The first time you run on a real
|
|
91
|
+
device, iOS will prompt the user with "Allow VPN configuration?" — that's the
|
|
92
|
+
expected flow.
|
|
93
|
+
|
|
94
|
+
## Troubleshooting
|
|
95
|
+
|
|
96
|
+
- **"Network Extension entitlement is missing"** → Your App ID does not have
|
|
97
|
+
the capability. Enable it at developer.apple.com.
|
|
98
|
+
- **"NEVPNError code 5"** → The provisioning profile does not include the
|
|
99
|
+
Network Extension entitlement. Regenerate the profile after enabling the
|
|
100
|
+
capability.
|
|
101
|
+
- **Connection succeeds but no traffic flows** → App Group identifiers don't
|
|
102
|
+
match between host and extension, or `OpenVPNAppGroupIdentifier` Info.plist
|
|
103
|
+
key is missing from the host.
|
|
104
|
+
- **Extension crashes at launch** → Most often `NSExtensionPrincipalClass` in
|
|
105
|
+
the extension's `Info.plist` is wrong. It should read
|
|
106
|
+
`$(PRODUCT_MODULE_NAME).PacketTunnelProvider`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"..\\..\\src","sources":["NativeOpenvpn.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AA4ClD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,SAAS,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeEventEmitter, NativeModules } from 'react-native';
|
|
4
|
+
import NativeOpenvpn from "./NativeOpenvpn.js";
|
|
5
|
+
import { ERROR_CODES, HARD_ERROR_CODES, OpenVPNError } from "./errors.js";
|
|
6
|
+
import { Scheduler } from "./reconnect.js";
|
|
7
|
+
|
|
8
|
+
// NativeEventEmitter requires a NativeModule with addListener/removeListeners.
|
|
9
|
+
// In tests the TurboModule mock satisfies this shape.
|
|
10
|
+
|
|
11
|
+
export class OpenVPNClient {
|
|
12
|
+
listeners = {
|
|
13
|
+
state: new Set(),
|
|
14
|
+
stats: new Set(),
|
|
15
|
+
log: new Set(),
|
|
16
|
+
error: new Set(),
|
|
17
|
+
reconnecting: new Set()
|
|
18
|
+
};
|
|
19
|
+
subscriptions = [];
|
|
20
|
+
currentConnect = null;
|
|
21
|
+
userRequestedDisconnect = false;
|
|
22
|
+
hardErrorPending = false;
|
|
23
|
+
scheduler = null;
|
|
24
|
+
lastParams = null;
|
|
25
|
+
lastReconnectOpts = {
|
|
26
|
+
maxRetries: 5,
|
|
27
|
+
baseDelayMs: 1000,
|
|
28
|
+
maxDelayMs: 60000
|
|
29
|
+
};
|
|
30
|
+
constructor() {
|
|
31
|
+
// On iOS (including the jest defaultPlatform) NativeEventEmitter requires
|
|
32
|
+
// a non-null module. Use the imported TurboModule instance (or native
|
|
33
|
+
// registry) as that module — it always exposes addListener/removeListeners.
|
|
34
|
+
const nativeModule = NativeModules.Openvpn ?? NativeOpenvpn;
|
|
35
|
+
// NativeModule type is not exported from react-native, cast via any.
|
|
36
|
+
|
|
37
|
+
this.emitter = new NativeEventEmitter(nativeModule);
|
|
38
|
+
this.subscriptions.push(this.emitter.addListener('OpenVpn:state', s => {
|
|
39
|
+
const state = s;
|
|
40
|
+
this.emit('state', state);
|
|
41
|
+
if (state === 'connected') {
|
|
42
|
+
this.settleConnect(null, true);
|
|
43
|
+
if (this.scheduler) {
|
|
44
|
+
this.scheduler.stop();
|
|
45
|
+
this.scheduler = null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (state === 'disconnected') this.handleDisconnect();
|
|
49
|
+
}), this.emitter.addListener('OpenVpn:stats', s => {
|
|
50
|
+
this.emit('stats', s);
|
|
51
|
+
}), this.emitter.addListener('OpenVpn:log', line => {
|
|
52
|
+
this.emit('log', line);
|
|
53
|
+
}), this.emitter.addListener('OpenVpn:error', raw => {
|
|
54
|
+
const r = raw;
|
|
55
|
+
const code = ERROR_CODES.includes(r.code) ? r.code : 'NATIVE_ERROR';
|
|
56
|
+
const err = new OpenVPNError(code, r.nativeMessage);
|
|
57
|
+
this.emit('error', err);
|
|
58
|
+
if (HARD_ERROR_CODES.has(code)) {
|
|
59
|
+
this.hardErrorPending = true;
|
|
60
|
+
if (this.currentConnect) this.settleConnect(err, false);
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
on(event, fn) {
|
|
65
|
+
this.listeners[event].add(fn);
|
|
66
|
+
}
|
|
67
|
+
off(event, fn) {
|
|
68
|
+
this.listeners[event].delete(fn);
|
|
69
|
+
}
|
|
70
|
+
removeAllListeners() {
|
|
71
|
+
for (const key of Object.keys(this.listeners)) {
|
|
72
|
+
this.listeners[key].clear();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
emit(event, payload) {
|
|
76
|
+
for (const fn of this.listeners[event]) fn(payload);
|
|
77
|
+
}
|
|
78
|
+
dispose() {
|
|
79
|
+
for (const sub of this.subscriptions) sub.remove();
|
|
80
|
+
this.subscriptions = [];
|
|
81
|
+
this.removeAllListeners();
|
|
82
|
+
}
|
|
83
|
+
async requestPermission() {
|
|
84
|
+
return NativeOpenvpn.requestPermission();
|
|
85
|
+
}
|
|
86
|
+
async getStatus() {
|
|
87
|
+
const raw = await NativeOpenvpn.getStatus();
|
|
88
|
+
return raw;
|
|
89
|
+
}
|
|
90
|
+
async getStats() {
|
|
91
|
+
return NativeOpenvpn.getStats();
|
|
92
|
+
}
|
|
93
|
+
async connect(options) {
|
|
94
|
+
if (this.currentConnect) {
|
|
95
|
+
throw new OpenVPNError('NATIVE_ERROR', 'connect() called while already connecting');
|
|
96
|
+
}
|
|
97
|
+
if (this.scheduler) {
|
|
98
|
+
this.scheduler.stop();
|
|
99
|
+
this.scheduler = null;
|
|
100
|
+
}
|
|
101
|
+
this.userRequestedDisconnect = false;
|
|
102
|
+
this.hardErrorPending = false;
|
|
103
|
+
const params = {
|
|
104
|
+
config: options.config,
|
|
105
|
+
username: options.username,
|
|
106
|
+
password: options.password,
|
|
107
|
+
killSwitch: options.killSwitch ?? false,
|
|
108
|
+
dns: options.dns ?? [],
|
|
109
|
+
allowedApps: options.allowedApps ?? [],
|
|
110
|
+
disallowedApps: options.disallowedApps ?? [],
|
|
111
|
+
notification: options.notification ?? {}
|
|
112
|
+
};
|
|
113
|
+
this.lastParams = params;
|
|
114
|
+
this.lastReconnectOpts = {
|
|
115
|
+
maxRetries: options.reconnect?.maxRetries ?? 5,
|
|
116
|
+
baseDelayMs: options.reconnect?.baseDelayMs ?? 1000,
|
|
117
|
+
maxDelayMs: options.reconnect?.maxDelayMs ?? 60000
|
|
118
|
+
};
|
|
119
|
+
return new Promise((resolve, reject) => {
|
|
120
|
+
this.currentConnect = {
|
|
121
|
+
resolve,
|
|
122
|
+
reject
|
|
123
|
+
};
|
|
124
|
+
NativeOpenvpn.connect(params).catch(nativeErr => {
|
|
125
|
+
this.settleConnect(new OpenVPNError('NATIVE_ERROR', nativeErr.message), false);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
async disconnect() {
|
|
130
|
+
this.userRequestedDisconnect = true;
|
|
131
|
+
if (this.scheduler) {
|
|
132
|
+
this.scheduler.stop();
|
|
133
|
+
this.scheduler = null;
|
|
134
|
+
}
|
|
135
|
+
await NativeOpenvpn.disconnect();
|
|
136
|
+
}
|
|
137
|
+
settleConnect(err, resolved) {
|
|
138
|
+
const pending = this.currentConnect;
|
|
139
|
+
if (!pending) return;
|
|
140
|
+
this.currentConnect = null;
|
|
141
|
+
if (resolved) pending.resolve();else if (err) pending.reject(err);
|
|
142
|
+
}
|
|
143
|
+
handleDisconnect() {
|
|
144
|
+
if (this.userRequestedDisconnect || this.hardErrorPending) return;
|
|
145
|
+
if (!this.lastParams) return;
|
|
146
|
+
// Immediately overwrite the just-emitted 'disconnected' so the UI never
|
|
147
|
+
// paints an enabled Connect button between auto-retry attempts. React's
|
|
148
|
+
// automatic batching collapses both setState calls in this tick.
|
|
149
|
+
this.emit('state', 'reconnecting');
|
|
150
|
+
if (this.scheduler) {
|
|
151
|
+
// We're already in a retry loop and just heard another drop —
|
|
152
|
+
// tell the scheduler the most-recent attempt failed.
|
|
153
|
+
this.scheduler.notifyFailure();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.scheduler = new Scheduler({
|
|
157
|
+
maxRetries: this.lastReconnectOpts.maxRetries,
|
|
158
|
+
baseDelayMs: this.lastReconnectOpts.baseDelayMs,
|
|
159
|
+
maxDelayMs: this.lastReconnectOpts.maxDelayMs,
|
|
160
|
+
onAttempt: ({
|
|
161
|
+
attempt,
|
|
162
|
+
delayMs
|
|
163
|
+
}) => {
|
|
164
|
+
this.emit('state', 'reconnecting');
|
|
165
|
+
this.emit('reconnecting', {
|
|
166
|
+
attempt,
|
|
167
|
+
delayMs
|
|
168
|
+
});
|
|
169
|
+
// Drive retries off state events, not the connect() Promise — the
|
|
170
|
+
// catch here only logs; the eventual 'disconnected' event drives
|
|
171
|
+
// notifyFailure via handleDisconnect.
|
|
172
|
+
NativeOpenvpn.connect(this.lastParams).catch(nativeErr => {
|
|
173
|
+
this.emit('error', new OpenVPNError('NATIVE_ERROR', nativeErr.message));
|
|
174
|
+
});
|
|
175
|
+
},
|
|
176
|
+
onExhausted: () => {
|
|
177
|
+
this.emit('error', new OpenVPNError('RECONNECT_EXHAUSTED'));
|
|
178
|
+
this.emit('state', 'disconnected');
|
|
179
|
+
this.scheduler = null;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
this.scheduler.start();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=OpenVPNClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","NativeOpenvpn","ERROR_CODES","HARD_ERROR_CODES","OpenVPNError","Scheduler","OpenVPNClient","listeners","state","Set","stats","log","error","reconnecting","subscriptions","currentConnect","userRequestedDisconnect","hardErrorPending","scheduler","lastParams","lastReconnectOpts","maxRetries","baseDelayMs","maxDelayMs","constructor","nativeModule","Openvpn","emitter","push","addListener","s","emit","settleConnect","stop","handleDisconnect","line","raw","r","code","includes","err","nativeMessage","has","on","event","fn","add","off","delete","removeAllListeners","key","Object","keys","clear","payload","dispose","sub","remove","requestPermission","getStatus","getStats","connect","options","params","config","username","password","killSwitch","dns","allowedApps","disallowedApps","notification","reconnect","Promise","resolve","reject","catch","nativeErr","message","disconnect","resolved","pending","notifyFailure","onAttempt","attempt","delayMs","onExhausted","start"],"sourceRoot":"..\\..\\src","sources":["OpenVPNClient.ts"],"mappings":";;AACA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAChE,OAAOC,aAAa,MAAM,oBAAiB;AAE3C,SAASC,WAAW,EAAEC,gBAAgB,EAAEC,YAAY,QAAQ,aAAU;AAGtE,SAASC,SAAS,QAAQ,gBAAa;;AAavC;AACA;;AAMA,OAAO,MAAMC,aAAa,CAAC;EAERC,SAAS,GAEtB;IACFC,KAAK,EAAE,IAAIC,GAAG,CAAC,CAAC;IAChBC,KAAK,EAAE,IAAID,GAAG,CAAC,CAAC;IAChBE,GAAG,EAAE,IAAIF,GAAG,CAAC,CAAC;IACdG,KAAK,EAAE,IAAIH,GAAG,CAAC,CAAC;IAChBI,YAAY,EAAE,IAAIJ,GAAG,CAAC;EACxB,CAAC;EACOK,aAAa,GAA0B,EAAE;EAEzCC,cAAc,GAGX,IAAI;EAEPC,uBAAuB,GAAG,KAAK;EAC/BC,gBAAgB,GAAG,KAAK;EACxBC,SAAS,GAAqB,IAAI;EACl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UTH_FAILED', 'TLS_FAILED', 'NETWORK_UNREACHABLE', 'RECONNECT_EXHAUSTED', 'NATIVE_ERROR'];
|
|
4
|
+
export class OpenVPNError extends Error {
|
|
5
|
+
constructor(code, nativeMessage) {
|
|
6
|
+
super(nativeMessage ? `${code}: ${nativeMessage}` : code);
|
|
7
|
+
this.name = 'OpenVPNError';
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.nativeMessage = nativeMessage;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export const HARD_ERROR_CODES = new Set(['AUTH_FAILED', 'INVALID_CONFIG', 'PERMISSION_DENIED']);
|
|
13
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ERROR_CODES","OpenVPNError","Error","constructor","code","nativeMessage","name","HARD_ERROR_CODES","Set"],"sourceRoot":"..\\..\\src","sources":["errors.ts"],"mappings":";;AAAA,OAAO,MAAMA,WAAW,GAAG,CACzB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,CACN;AAIV,OAAO,MAAMC,YAAY,SAASC,KAAK,CAAC;EAItCC,WAAWA,CAACC,IAAe,EAAEC,aAAsB,EAAE;IACnD,KAAK,CAACA,aAAa,GAAG,GAAGD,IAAI,KAAKC,aAAa,EAAE,GAAGD,IAAI,CAAC;IACzD,IAAI,CAACE,IAAI,GAAG,cAAc;IAC1B,IAAI,CAACF,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,aAAa,GAAGA,aAAa;EACpC;AACF;AAEA,OAAO,MAAME,gBAAwC,GAAG,IAAIC,GAAG,CAAC,CAC9D,aAAa,EACb,gBAAgB,EAChB,mBAAmB,CACpB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OpenVPNClient","OpenVPNError","ERROR_CODES"],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,oBAAiB;AAC/C,SAASC,YAAY,EAAEC,WAAW,QAAQ,aAAU","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function calculateDelay(attempt, baseDelayMs, maxDelayMs) {
|
|
4
|
+
const raw = baseDelayMs * Math.pow(2, attempt);
|
|
5
|
+
return Math.min(raw, maxDelayMs);
|
|
6
|
+
}
|
|
7
|
+
export class Scheduler {
|
|
8
|
+
attempt = 0;
|
|
9
|
+
timer = null;
|
|
10
|
+
started = false;
|
|
11
|
+
constructor(opts) {
|
|
12
|
+
this.opts = opts;
|
|
13
|
+
}
|
|
14
|
+
start() {
|
|
15
|
+
if (this.started) return;
|
|
16
|
+
this.started = true;
|
|
17
|
+
this.attempt = 0;
|
|
18
|
+
this.scheduleNext();
|
|
19
|
+
}
|
|
20
|
+
stop() {
|
|
21
|
+
this.started = false;
|
|
22
|
+
if (this.timer !== null) {
|
|
23
|
+
clearTimeout(this.timer);
|
|
24
|
+
this.timer = null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
notifyFailure() {
|
|
28
|
+
if (!this.started) return;
|
|
29
|
+
if (this.attempt >= this.opts.maxRetries) {
|
|
30
|
+
this.stop();
|
|
31
|
+
this.opts.onExhausted();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.scheduleNext();
|
|
35
|
+
}
|
|
36
|
+
scheduleNext() {
|
|
37
|
+
if (this.timer !== null) {
|
|
38
|
+
clearTimeout(this.timer);
|
|
39
|
+
}
|
|
40
|
+
const delayMs = calculateDelay(this.attempt, this.opts.baseDelayMs, this.opts.maxDelayMs);
|
|
41
|
+
this.timer = setTimeout(() => {
|
|
42
|
+
this.timer = null;
|
|
43
|
+
this.attempt += 1;
|
|
44
|
+
this.opts.onAttempt({
|
|
45
|
+
attempt: this.attempt,
|
|
46
|
+
delayMs
|
|
47
|
+
});
|
|
48
|
+
}, delayMs);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=reconnect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["calculateDelay","attempt","baseDelayMs","maxDelayMs","raw","Math","pow","min","Scheduler","timer","started","constructor","opts","start","scheduleNext","stop","clearTimeout","notifyFailure","maxRetries","onExhausted","delayMs","setTimeout","onAttempt"],"sourceRoot":"..\\..\\src","sources":["reconnect.ts"],"mappings":";;AAAA,OAAO,SAASA,cAAcA,CAC5BC,OAAe,EACfC,WAAmB,EACnBC,UAAkB,EACV;EACR,MAAMC,GAAG,GAAGF,WAAW,GAAGG,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEL,OAAO,CAAC;EAC9C,OAAOI,IAAI,CAACE,GAAG,CAACH,GAAG,EAAED,UAAU,CAAC;AAClC;AAUA,OAAO,MAAMK,SAAS,CAAC;EAEbP,OAAO,GAAG,CAAC;EACXQ,KAAK,GAAyC,IAAI;EAClDC,OAAO,GAAG,KAAK;EAEvBC,WAAWA,CAACC,IAAsB,EAAE;IAClC,IAAI,CAACA,IAAI,GAAGA,IAAI;EAClB;EAEAC,KAAKA,CAAA,EAAS;IACZ,IAAI,IAAI,CAACH,OAAO,EAAE;IAClB,IAAI,CAACA,OAAO,GAAG,IAAI;IACnB,IAAI,CAACT,OAAO,GAAG,CAAC;IAChB,IAAI,CAACa,YAAY,CAAC,CAAC;EACrB;EAEAC,IAAIA,CAAA,EAAS;IACX,IAAI,CAACL,OAAO,GAAG,KAAK;IACpB,IAAI,IAAI,CAACD,KAAK,KAAK,IAAI,EAAE;MACvBO,YAAY,CAAC,IAAI,CAACP,KAAK,CAAC;MACxB,IAAI,CAACA,KAAK,GAAG,IAAI;IACnB;EACF;EAEAQ,aAAaA,CAAA,EAAS;IACpB,IAAI,CAAC,IAAI,CAACP,OAAO,EAAE;IACnB,IAAI,IAAI,CAACT,OAAO,IAAI,IAAI,CAACW,IAAI,CAACM,UAAU,EAAE;MACxC,IAAI,CAACH,IAAI,CAAC,CAAC;MACX,IAAI,CAACH,IAAI,CAACO,WAAW,CAAC,CAAC;MACvB;IACF;IACA,IAAI,CAACL,YAAY,CAAC,CAAC;EACrB;EAEQA,YAAYA,CAAA,EAAS;IAC3B,IAAI,IAAI,CAACL,KAAK,KAAK,IAAI,EAAE;MACvBO,YAAY,CAAC,IAAI,CAACP,KAAK,CAAC;IAC1B;IACA,MAAMW,OAAO,GAAGpB,cAAc,CAC5B,IAAI,CAACC,OAAO,EACZ,IAAI,CAACW,IAAI,CAACV,WAAW,EACrB,IAAI,CAACU,IAAI,CAACT,UACZ,CAAC;IACD,IAAI,CAACM,KAAK,GAAGY,UAAU,CAAC,MAAM;MAC5B,IAAI,CAACZ,KAAK,GAAG,IAAI;MACjB,IAAI,CAACR,OAAO,IAAI,CAAC;MACjB,IAAI,CAACW,IAAI,CAACU,SAAS,CAAC;QAAErB,OAAO,EAAE,IAAI,CAACA,OAAO;QAAEmB;MAAQ,CAAC,CAAC;IACzD,CAAC,EAAEA,OAAO,CAAC;EACb;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"..\\..\\src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/android/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AASnD,QAAA,MAAM,kBAAkB,EAAE,YAAY,CAAC,kBAAkB,CAcxD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import type { OpenVPNPluginProps } from '../types';
|
|
3
|
+
declare const withAndroidAarCheck: ConfigPlugin<OpenVPNPluginProps>;
|
|
4
|
+
export default withAndroidAarCheck;
|
|
5
|
+
//# sourceMappingURL=withAndroidAarCheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withAndroidAarCheck.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/android/withAndroidAarCheck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAUnD,QAAA,MAAM,mBAAmB,EAAE,YAAY,CAAC,kBAAkB,CAqBzD,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import type { OpenVPNPluginProps } from '../types';
|
|
3
|
+
declare const withAndroidLegacyPackaging: ConfigPlugin<OpenVPNPluginProps>;
|
|
4
|
+
export default withAndroidLegacyPackaging;
|
|
5
|
+
//# sourceMappingURL=withAndroidLegacyPackaging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withAndroidLegacyPackaging.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/android/withAndroidLegacyPackaging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,QAAA,MAAM,0BAA0B,EAAE,YAAY,CAAC,kBAAkB,CAgBhE,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withAndroidMinSdk.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/android/withAndroidMinSdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;wBAaf,YAAY,CAAC,kBAAkB,CAAC;AAApE,wBAAqE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import type { OpenVPNPluginProps } from '../types';
|
|
3
|
+
declare const withAndroidNotificationIcon: ConfigPlugin<OpenVPNPluginProps>;
|
|
4
|
+
export default withAndroidNotificationIcon;
|
|
5
|
+
//# sourceMappingURL=withAndroidNotificationIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withAndroidNotificationIcon.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/android/withAndroidNotificationIcon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,QAAA,MAAM,2BAA2B,EAAE,YAAY,CAAC,kBAAkB,CA8BjE,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import type { OpenVPNPluginProps } from '../types';
|
|
3
|
+
declare const withAndroidPermissions: ConfigPlugin<OpenVPNPluginProps>;
|
|
4
|
+
export default withAndroidPermissions;
|
|
5
|
+
//# sourceMappingURL=withAndroidPermissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withAndroidPermissions.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/android/withAndroidPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAUnD,QAAA,MAAM,sBAAsB,EAAE,YAAY,CAAC,kBAAkB,CAmB5D,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withAndroidService.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/android/withAndroidService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,QAAA,MAAM,kBAAkB,EAAE,YAAY,CAAC,kBAAkB,CAoCxD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import type { OpenVPNPluginProps } from './types';
|
|
3
|
+
declare const withOpenVPN: ConfigPlugin<OpenVPNPluginProps>;
|
|
4
|
+
export default withOpenVPN;
|
|
5
|
+
export type { OpenVPNPluginProps } from './types';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAKlD,QAAA,MAAM,WAAW,EAAE,YAAY,CAAC,kBAAkB,CAWjD,CAAC;AAEF,eAAe,WAAW,CAAC;AAC3B,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/ios/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAMnD,QAAA,MAAM,cAAc,EAAE,YAAY,CAAC,kBAAkB,CAKpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import type { OpenVPNPluginProps } from '../types';
|
|
3
|
+
declare const withIosDeploymentTarget: ConfigPlugin<OpenVPNPluginProps>;
|
|
4
|
+
export default withIosDeploymentTarget;
|
|
5
|
+
//# sourceMappingURL=withIosDeploymentTarget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withIosDeploymentTarget.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/ios/withIosDeploymentTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,QAAA,MAAM,uBAAuB,EAAE,YAAY,CAAC,kBAAkB,CAuB7D,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import type { OpenVPNPluginProps } from '../types';
|
|
3
|
+
declare const withIosEntitlements: ConfigPlugin<OpenVPNPluginProps>;
|
|
4
|
+
export default withIosEntitlements;
|
|
5
|
+
//# sourceMappingURL=withIosEntitlements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withIosEntitlements.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/ios/withIosEntitlements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,QAAA,MAAM,mBAAmB,EAAE,YAAY,CAAC,kBAAkB,CAYzD,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withIosInfoPlist.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/ios/withIosInfoPlist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,QAAA,MAAM,gBAAgB,EAAE,YAAY,CAAC,kBAAkB,CAWtD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type OpenVPNPluginProps = {
|
|
2
|
+
/** Required. App Group identifier shared by host and extension on iOS. */
|
|
3
|
+
iosAppGroup: string;
|
|
4
|
+
/** Optional. If the extension target's bundle id doesn't follow the default
|
|
5
|
+
* `<host>.OpenVPNTunnel` convention, set it here so the host knows what to
|
|
6
|
+
* start. */
|
|
7
|
+
iosExtensionBundleIdentifier?: string;
|
|
8
|
+
/** Optional. Path (relative to the consumer's project root) to a small
|
|
9
|
+
* notification icon to use on Android. PNG or vector drawable. */
|
|
10
|
+
androidNotificationIcon?: string;
|
|
11
|
+
/** Optional. Override the default notification channel name on Android. */
|
|
12
|
+
androidNotificationChannelName?: string;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../plugin/src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAC;IAEpB;;iBAEa;IACb,4BAA4B,CAAC,EAAE,MAAM,CAAC;IAEtC;uEACmE;IACnE,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAEjC,2EAA2E;IAC3E,8BAA8B,CAAC,EAAE,MAAM,CAAC;CACzC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export type NativeNotificationConfig = {
|
|
3
|
+
title?: string;
|
|
4
|
+
text?: string;
|
|
5
|
+
smallIcon?: string;
|
|
6
|
+
channelId?: string;
|
|
7
|
+
};
|
|
8
|
+
export type NativeConnectParams = {
|
|
9
|
+
config: string;
|
|
10
|
+
username: string;
|
|
11
|
+
password: string;
|
|
12
|
+
killSwitch: boolean;
|
|
13
|
+
dns: string[];
|
|
14
|
+
allowedApps: string[];
|
|
15
|
+
disallowedApps: string[];
|
|
16
|
+
notification: NativeNotificationConfig;
|
|
17
|
+
};
|
|
18
|
+
export type NativeStatus = {
|
|
19
|
+
state: string;
|
|
20
|
+
connectedSince?: number;
|
|
21
|
+
server?: string;
|
|
22
|
+
localIp?: string;
|
|
23
|
+
remoteIp?: string;
|
|
24
|
+
};
|
|
25
|
+
export type NativeStats = {
|
|
26
|
+
bytesIn: number;
|
|
27
|
+
bytesOut: number;
|
|
28
|
+
durationMs: number;
|
|
29
|
+
};
|
|
30
|
+
export interface Spec extends TurboModule {
|
|
31
|
+
requestPermission(): Promise<boolean>;
|
|
32
|
+
connect(params: NativeConnectParams): Promise<void>;
|
|
33
|
+
disconnect(): Promise<void>;
|
|
34
|
+
getStatus(): Promise<NativeStatus>;
|
|
35
|
+
getStats(): Promise<NativeStats>;
|
|
36
|
+
addListener(eventName: string): void;
|
|
37
|
+
removeListeners(count: number): void;
|
|
38
|
+
}
|
|
39
|
+
declare const _default: Spec;
|
|
40
|
+
export default _default;
|
|
41
|
+
//# sourceMappingURL=NativeOpenvpn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeOpenvpn.d.ts","sourceRoot":"","sources":["../../../src/NativeOpenvpn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,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