Skip to content

Commit e73019c

Browse files
committed
✨ feat(version): release 2.0.0
1 parent 5adc6b1 commit e73019c

File tree

4 files changed

+150
-15
lines changed

4 files changed

+150
-15
lines changed

README.md

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
# react-native-simple-openvpn
22

33
[![npm latest][version-img]][pkg-url]
4-
[![download][download-img]][pkg-url]
4+
[![download month][dl-month-img]][pkg-url]
5+
[![download total][dl-total-img]][pkg-url]
56
![platforms][platform-img]
67
[![GNU General Public License][license-img]](LICENSE)
78

89
English | [简体中文](./README.zh-CN.md)
910

1011
A simple react native module to interact with OpenVPN
1112

13+
If this project has helped you out, please support us with a star 🌟
14+
1215
## Versions
1316

1417
| RNSimpleOpenvpn | React Native |
1518
| --------------- | ------------ |
1619
| 1.0.0 ~ 1.2.0 | 0.56 ~ 0.66 |
20+
| 2.0.0 | 0.63 ~ 0.68 |
1721

1822
## Preview
1923

@@ -42,6 +46,40 @@ From react-native 0.60 autolinking will take care of the link step
4246
react-native link react-native-simple-openvpn
4347
```
4448

49+
### Android
50+
51+
Add the following to `android/settings.gradle` :
52+
53+
```diff
54+
rootProject.name = 'example'
55+
+ include ':vpnLib'
56+
+ project(':vpnLib').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-simple-openvpn/vpnLib')
57+
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
58+
include ':app'
59+
```
60+
61+
#### Import jniLibs
62+
63+
Due to file size limitations, jniLibs are too big to be published on npm. Use the assets on [GitHub Releases](https://github.com/ccnnde/react-native-simple-openvpn/releases) instead
64+
65+
Download and unzip the resources you need for the corresponding architecture, and put them in `android/app/src/main/jniLibs` (create a new `jniLibs` folder if you don't have one)
66+
67+
```sh
68+
project
69+
├── android
70+
│ ├── app
71+
│ │ └── src
72+
│ │ └── main
73+
│ │ └── jniLibs
74+
│ │ ├── arm64-v8a
75+
│ │ ├── armeabi-v7a
76+
│ │ ├── x86
77+
│ │ └── x86_64
78+
│ └── ...
79+
├── ios
80+
└── ...
81+
```
82+
4583
### iOS
4684

4785
If using CocoaPods, run it in the `ios/` directory
@@ -164,9 +202,10 @@ export default App;
164202

165203
## Properties
166204

167-
| Name | Value | Description |
168-
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
169-
| VpnState | VPN_STATE_DISCONNECTED = 0 <br/> VPN_STATE_CONNECTING = 1 <br/> VPN_STATE_CONNECTED = 2 <br/> VPN_STATE_DISCONNECTING = 3 <br/> VPN_OTHER_STATE = 4 <br/> | VPN Current Status |
205+
| Name | Value | Description |
206+
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
207+
| VpnState | VPN_STATE_DISCONNECTED = 0 <br/> VPN_STATE_CONNECTING = 1 <br/> VPN_STATE_CONNECTED = 2 <br/> VPN_STATE_DISCONNECTING = 3 <br/> VPN_OTHER_STATE = 4 <br/> | VPN Current Status |
208+
| CompatMode | MODERN_DEFAULTS = 0 <br/> OVPN_TWO_FIVE_PEER = 1 <br/> OVPN_TWO_FOUR_PEER = 2 <br/> OVPN_TWO_THREE_PEER = 3 <br/> | OpenVPN Compatibility Mode(**Android only**) |
170209

171210
## Types
172211

@@ -178,6 +217,9 @@ interface VpnOptions {
178217
ovpnString?: string;
179218
ovpnFileName?: string;
180219
assetsPath?: string;
220+
notificationTitle?: string;
221+
compatMode?: RNSimpleOpenvpn.CompatMode;
222+
useLegacyProvider?: boolean;
181223
providerBundleIdentifier: string;
182224
localizedDescription?: string;
183225
}
@@ -204,6 +246,25 @@ The name of the OpenVPN configuration file, without extensions, using the defaul
204246
- `assetsPath` is `''` when not passed in, the file path is `assets/xxx.ovpn`
205247
- When passing in a path, such as `'ovpn/'`, the file path is `assets/ovpn/xxx.ovpn`
206248

249+
#### notificationTitle
250+
251+
**Android only**,the title of the notification, using the default value `OpenVPN` if not passed in
252+
253+
#### compatMode
254+
255+
**Android only**[OpenVPN compatibility mode](#properties), using the default value `MODERN_DEFAULTS` if not passed in
256+
257+
| Mode | Description |
258+
| ------------------- | ----------------------------- |
259+
| MODERN_DEFAULTS | Modern defaults |
260+
| OVPN_TWO_FIVE_PEER | OpenVPN 2.5.x peers |
261+
| OVPN_TWO_FOUR_PEER | OpenVPN 2.4.x peers |
262+
| OVPN_TWO_THREE_PEER | OpenVPN 2.3.x and older peers |
263+
264+
#### useLegacyProvider
265+
266+
**Android only**,load OpenSSL legacy provider or not, using the default value `false` if not passed in
267+
207268
#### providerBundleIdentifier
208269

209270
**iOS only**,the bundle identifier of the Network Extension target
@@ -255,13 +316,13 @@ However, if you need to dynamically change the `remote` address in the configura
255316

256317
The following items were used in this project
257318

258-
- Android - [ics-openvpn](https://github.com/schwabe/ics-openvpn), for personal project reasons, the Android side is currently using an older version of its core library
319+
- Android - [ics-openvpn](https://github.com/schwabe/ics-openvpn) v0.7.33
259320
- iOS - [OpenVPNAdapter](https://github.com/ss-abramchuk/OpenVPNAdapter) v0.8.0
260321

261322
## Todo
262323

263324
- [x] Resolve RN 0.65 warning
264-
- [ ] Upgrade to the latest Android OpenVPN library
325+
- [x] Upgrade to the latest Android OpenVPN library
265326

266327
## License
267328

@@ -271,6 +332,7 @@ The following items were used in this project
271332

272333
[pkg-url]: https://www.npmjs.com/package/react-native-simple-openvpn
273334
[version-img]: https://img.shields.io/npm/v/react-native-simple-openvpn?color=deepgreen&style=flat-square
274-
[download-img]: https://img.shields.io/npm/dm/react-native-simple-openvpn?style=flat-square
335+
[dl-month-img]: https://img.shields.io/npm/dm/react-native-simple-openvpn?style=flat-square
336+
[dl-total-img]: https://img.shields.io/npm/dt/react-native-simple-openvpn?label=total&style=flat-square
275337
[platform-img]: https://img.shields.io/badge/platforms-android%20|%20ios-lightgrey?style=flat-square
276338
[license-img]: https://img.shields.io/badge/license-GPL%20v2-orange?style=flat-square

README.zh-CN.md

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
# react-native-simple-openvpn
22

33
[![npm latest][version-img]][pkg-url]
4-
[![download][download-img]][pkg-url]
4+
[![download month][dl-month-img]][pkg-url]
5+
[![download total][dl-total-img]][pkg-url]
56
![platforms][platform-img]
67
[![GNU General Public License][license-img]](LICENSE)
78

89
简体中文 | [English](./README.md)
910

10-
A simple react native module to interact with OpenVPN
11+
react-native-simple-openvpn 提供了与 OpenVPN 交互的接口
12+
13+
如果本项目对你有所帮助,请 star 🌟 鼓励,谢谢 🙏
1114

1215
## 版本
1316

1417
| RNSimpleOpenvpn | React Native |
1518
| --------------- | ------------ |
1619
| 1.0.0 ~ 1.2.0 | 0.56 ~ 0.66 |
20+
| 2.0.0 | 0.63 ~ 0.68 |
1721

1822
## 预览
1923

@@ -42,6 +46,40 @@ yarn add react-native-simple-openvpn
4246
react-native link react-native-simple-openvpn
4347
```
4448

49+
### Android
50+
51+
在项目的 `android/settings.gradle` 中添加以下代码:
52+
53+
```diff
54+
rootProject.name = 'example'
55+
+ include ':vpnLib'
56+
+ project(':vpnLib').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-simple-openvpn/vpnLib')
57+
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
58+
include ':app'
59+
```
60+
61+
#### 导入 jniLibs
62+
63+
由于存在文件大小的限制,jniLibs 无法随模块一起发布到 npm 上。故使用 [GitHub Releases](https://github.com/ccnnde/react-native-simple-openvpn/releases) 中的 assets 来代替
64+
65+
下载并解压你需要的相应架构的资源,然后将其放入 `android/app/src/main/jniLibs` 中(如果 `jniLibs` 文件夹不存在则手动新建一个)
66+
67+
```sh
68+
project
69+
├── android
70+
│ ├── app
71+
│ │ └── src
72+
│ │ └── main
73+
│ │ └── jniLibs
74+
│ │ ├── arm64-v8a
75+
│ │ ├── armeabi-v7a
76+
│ │ ├── x86
77+
│ │ └── x86_64
78+
│ └── ...
79+
├── ios
80+
└── ...
81+
```
82+
4583
### iOS
4684

4785
如果使用 CocoaPods, 在 `ios/` 目录下运行
@@ -164,9 +202,10 @@ export default App;
164202

165203
## 属性
166204

167-
| 名称 || 描述 |
168-
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
169-
| VpnState | VPN_STATE_DISCONNECTED = 0 <br/> VPN_STATE_CONNECTING = 1 <br/> VPN_STATE_CONNECTED = 2 <br/> VPN_STATE_DISCONNECTING = 3 <br/> VPN_OTHER_STATE = 4 <br/> | VPN 当前状态 |
205+
| 名称 || 描述 |
206+
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
207+
| VpnState | VPN_STATE_DISCONNECTED = 0 <br/> VPN_STATE_CONNECTING = 1 <br/> VPN_STATE_CONNECTED = 2 <br/> VPN_STATE_DISCONNECTING = 3 <br/> VPN_OTHER_STATE = 4 <br/> | VPN 当前状态 |
208+
| CompatMode | MODERN_DEFAULTS = 0 <br/> OVPN_TWO_FIVE_PEER = 1 <br/> OVPN_TWO_FOUR_PEER = 2 <br/> OVPN_TWO_THREE_PEER = 3 <br> | OpenVPN 兼容模式(**Android only**) |
170209

171210
## 类型
172211

@@ -178,6 +217,9 @@ interface VpnOptions {
178217
ovpnString?: string;
179218
ovpnFileName?: string;
180219
assetsPath?: string;
220+
notificationTitle?: string;
221+
compatMode?: RNSimpleOpenvpn.CompatMode;
222+
useLegacyProvider?: boolean;
181223
providerBundleIdentifier: string;
182224
localizedDescription?: string;
183225
}
@@ -204,6 +246,25 @@ OpenVPN 配置文件的名称,不含扩展名,未传入时使用默认名称
204246
- 未传入时 `assetsPath``''`,文件路径为 `assets/xxx.ovpn`
205247
- 传入路径时,比如 `'ovpn/'`,文件路径为 `assets/ovpn/xxx.ovpn`
206248

249+
#### notificationTitle
250+
251+
**Android 专用**,通知的标题,未传入时使用默认值 `OpenVPN`
252+
253+
#### compatMode
254+
255+
**Android 专用**[OpenVPN 兼容模式](#properties),未传入时使用默认值 `MODERN_DEFAULTS`
256+
257+
| 模式 | 描述 |
258+
| ------------------- | ----------------------------- |
259+
| MODERN_DEFAULTS | Modern defaults |
260+
| OVPN_TWO_FIVE_PEER | OpenVPN 2.5.x peers |
261+
| OVPN_TWO_FOUR_PEER | OpenVPN 2.4.x peers |
262+
| OVPN_TWO_THREE_PEER | OpenVPN 2.3.x and older peers |
263+
264+
#### useLegacyProvider
265+
266+
**Android 专用**,是否加载 OpenSSL legacy provider,未传入时使用默认值 `false`
267+
207268
#### providerBundleIdentifier
208269

209270
**iOS 专用**,Network Extension target 的 bundle identifier
@@ -255,7 +316,7 @@ remote <IP address> <port>
255316

256317
本项目使用到了以下项目
257318

258-
- Android - [ics-openvpn](https://github.com/schwabe/ics-openvpn),由于个人项目的原因,Android 端目前使用的是其核心库的较旧版本
319+
- Android - [ics-openvpn](https://github.com/schwabe/ics-openvpn) v0.7.33
259320
- iOS - [OpenVPNAdapter](https://github.com/ss-abramchuk/OpenVPNAdapter) v0.8.0
260321

261322
## License
@@ -266,6 +327,7 @@ remote <IP address> <port>
266327

267328
[pkg-url]: https://www.npmjs.com/package/react-native-simple-openvpn
268329
[version-img]: https://img.shields.io/npm/v/react-native-simple-openvpn?color=deepgreen&style=flat-square
269-
[download-img]: https://img.shields.io/npm/dm/react-native-simple-openvpn?style=flat-square
330+
[dl-month-img]: https://img.shields.io/npm/dm/react-native-simple-openvpn?style=flat-square
331+
[dl-total-img]: https://img.shields.io/npm/dt/react-native-simple-openvpn?label=total&style=flat-square
270332
[platform-img]: https://img.shields.io/badge/platforms-android%20|%20ios-lightgrey?style=flat-square
271333
[license-img]: https://img.shields.io/badge/license-GPL%20v2-orange?style=flat-square

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"name": "react-native-simple-openvpn",
33
"title": "React Native Simple Openvpn",
4-
"version": "1.2.0",
4+
"version": "2.0.0",
55
"description": "React Native Open VPN Module",
66
"main": "index.js",
77
"types": "index.d.ts",
88
"files": [
99
"README.md",
1010
"android",
11+
"vpnLib",
1112
"index.js",
1213
"index.d.ts",
1314
"ios",
@@ -38,6 +39,9 @@
3839
"license": "GPL-2.0-or-later",
3940
"licenseFilename": "LICENSE",
4041
"readmeFilename": "README.md",
42+
"peerDependencies": {
43+
"react-native": ">=0.63"
44+
},
4145
"devDependencies": {
4246
"archiver": "^5.3.0",
4347
"clang-format": "^1.4.0",

vpnLib/.npmignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ignored suffix
2+
.DS_Store
3+
.npmignore
4+
.clang-format
5+
6+
# .so
7+
src/main/jniLibs/

0 commit comments

Comments
 (0)