
Product
Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.
react-native-wireguard-vpn-connect
Advanced tools
A React Native module for implementing WireGuard VPN functionality in iOS and Android applications. This package provides a native implementation of WireGuard tunneling with a simple JavaScript interface.
# Using npm
npm install react-native-wireguard-vpn --save
# Using yarn
yarn add react-native-wireguard-vpn
cd ios && pod install && cd ..
<key>NSLocalNetworkUsageDescription</key>
<string>This app requires access to network features for VPN functionality</string>
<key>UIBackgroundModes</key>
<array>
<string>network-authentication</string>
<string>network</string>
</array>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.BIND_VPN_SERVICE" />
android {
compileSdkVersion 34
defaultConfig {
minSdkVersion 21
targetSdkVersion 34
}
}
import WireGuardVpnModule, {
WireGuardConfig,
WireGuardStatus
} from 'react-native-wireguard-vpn';
// Configuration object
const config: WireGuardConfig = {
privateKey: 'YOUR_PRIVATE_KEY',
publicKey: 'SERVER_PUBLIC_KEY',
serverAddress: 'SERVER_IP',
serverPort: 51820,
allowedIPs: ['0.0.0.0/0'],
dns: ['1.1.1.1'],
mtu: 1450,
presharedKey: 'OPTIONAL_PRESHARED_KEY' // Optional
};
// Initialize VPN service
await WireGuardVpnModule.initialize();
// Connect to VPN
try {
await WireGuardVpnModule.connect(config);
console.log('Connected successfully');
} catch (error) {
console.error('Connection failed:', error);
}
// Check VPN status
const status: WireGuardStatus = await WireGuardVpnModule.getStatus();
console.log('VPN Status:', status);
// Disconnect from VPN
await WireGuardVpnModule.disconnect();
initialize(): Promise<void>Initializes the VPN service. Must be called before any other operations.
connect(config: WireGuardConfig): Promise<void>Connects to the VPN using the provided configuration.
disconnect(): Promise<void>Disconnects from the VPN.
getStatus(): Promise<WireGuardStatus>Gets the current VPN connection status.
isSupported(): Promise<boolean>Checks if WireGuard VPN is supported on the device.
interface WireGuardConfig {
privateKey: string;
publicKey: string;
serverAddress: string;
serverPort: number;
allowedIPs: string[];
dns?: string[];
mtu?: number;
presharedKey?: string;
}
interface WireGuardStatus {
isConnected: boolean;
tunnelState: 'ACTIVE' | 'INACTIVE' | 'ERROR';
error?: string;
}
Check out the example app in our GitHub repository for a complete implementation.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
For bugs and feature requests, please create an issue on our GitHub repository.
FAQs
React Native WireGuard VPN package for iOS and Android
The npm package react-native-wireguard-vpn-connect receives a total of 17 weekly downloads. As such, react-native-wireguard-vpn-connect popularity was classified as not popular.
We found that react-native-wireguard-vpn-connect demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.