https://github.com/hectorqin/react-native-vpn2sock
vpn2socks package for react-native. Not support IOS currently.
https://github.com/hectorqin/react-native-vpn2sock
Last synced: 3 months ago
JSON representation
vpn2socks package for react-native. Not support IOS currently.
- Host: GitHub
- URL: https://github.com/hectorqin/react-native-vpn2sock
- Owner: hectorqin
- License: mit
- Created: 2021-02-01T08:22:53.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-12T08:45:56.000Z (over 4 years ago)
- Last Synced: 2025-05-29T07:17:38.639Z (4 months ago)
- Language: C
- Homepage:
- Size: 3.19 MB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# react-native-vpn2sock
vpn2socks package for react-native. Not support IOS currently.
## Installation
```sh
npm install react-native-vpn2sock
```## Usage
```js
import Vpn2sock from "react-native-vpn2sock";type SocketConfig = {
name?: string;
type: number;
host: string;
port: number;
username?: string;
password?: string;
method?: string;
udpRelay?: boolean; // 是否支持 udp relay
dnsServer?: string; // DNS server
applicationMode?: number; // VPN 模式,分为全局,白名单,黑名单
applications?: Array; // 应用 packageName 列表,白名单或者黑名单
};
// ...Vpn2sock.isRunning(TUNNEL_ID).then((r) => {
console.log('isRunning ', r);
});
// 关闭VPN
Vpn2sock.stopTunnel(TUNNEL_ID).then((r) => {
console.log('stopTunnel ', r);
});
// host 能否访问
Vpn2sock.isReachable(SOCKET_SERVER.host, SOCKET_SERVER.port).then(
(r) => {
console.log('isReachable ', r);
}
);
// 开启VPN
Vpn2sock.startTunnel(TUNNEL_ID, SOCKET_SERVER).then((r) => {
console.log('startTunnel ', r);
});
```## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## License
MIT