npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-vpn-proxy-detect

v0.1.0

Published

Checks for VPN & Proxy connections

Readme

react-native-vpn-proxy-detect

A React Native library for detecting VPN and Proxy connections on iOS and Android devices.

Features

  • ✅ Detect VPN connections
  • ✅ Detect Proxy connections
  • ✅ iOS and Android support
  • ✅ TypeScript support
  • ✅ Turbo Module architecture
  • ✅ Promise-based API

Installation

npm install react-native-vpn-proxy-detect

iOS

Run cd ios && pod install to install the iOS dependencies.

Android

No additional setup required for Android.

Usage

Import Methods

// Named imports (recommended)
import { detectVPN, detectProxy } from 'react-native-vpn-proxy-detect';

// Default import (for backward compatibility)
import VpnProxyDetect from 'react-native-vpn-proxy-detect';

Detect VPN Connection

import { detectVPN } from 'react-native-vpn-proxy-detect';

async function checkVPN() {
  try {
    const isVPNActive = await detectVPN();
    console.log('VPN is active:', isVPNActive);
  } catch (error) {
    console.error('Failed to detect VPN:', error);
  }
}

Detect Proxy Connection

import { detectProxy } from 'react-native-vpn-proxy-detect';

async function checkProxy() {
  try {
    const isProxyActive = await detectProxy();
    console.log('Proxy is active:', isProxyActive);
  } catch (error) {
    console.error('Failed to detect proxy:', error);
  }
}

Check Both VPN and Proxy

import { detectVPN, detectProxy } from 'react-native-vpn-proxy-detect';

async function checkNetworkSecurity() {
  try {
    const [vpnResult, proxyResult] = await Promise.all([
      detectVPN(),
      detectProxy()
    ]);
    
    console.log('VPN Status:', vpnResult ? 'Active' : 'Inactive');
    console.log('Proxy Status:', proxyResult ? 'Active' : 'Inactive');
  } catch (error) {
    console.error('Failed to detect network status:', error);
  }
}

Using Default Export (Backward Compatibility)

import VpnProxyDetect from 'react-native-vpn-proxy-detect';

async function checkSecurity() {
  try {
    const vpnActive = await VpnProxyDetect.detectVPN();
    const proxyActive = await VpnProxyDetect.detectProxy();
    
    console.log('VPN:', vpnActive);
    console.log('Proxy:', proxyActive);
  } catch (error) {
    console.error('Detection failed:', error);
  }
}

API Reference

detectVPN(): Promise<boolean>

Detects if a VPN connection is currently active.

Returns: Promise that resolves to true if VPN is active, false otherwise.

Throws: Error if detection fails.

detectProxy(): Promise<boolean>

Detects if a proxy connection is currently active.

Returns: Promise that resolves to true if proxy is active, false otherwise.

Throws: Error if detection fails.

Platform-Specific Implementation

iOS

  • Uses CFNetworkCopySystemProxySettings() to detect VPN connections by checking for network interfaces like tap, tun, ppp, ipsec, and utun
  • Uses CFNetworkCopyProxiesForURL() to detect proxy settings

Android

  • Uses ConnectivityManager and NetworkCapabilities to detect VPN connections
  • Checks system properties for proxy configuration

Example App

The library includes a complete example app demonstrating all features. To run it:

# Install dependencies
yarn

# Run on iOS
yarn example ios

# Run on Android  
yarn example android

Migration from react-native-vpn-detect

This library is a modernized version of react-native-vpn-detect with the following improvements:

  • New import syntax: Use named imports instead of default export
  • Turbo Module: Better performance and future-proof architecture
  • TypeScript: Full TypeScript support out of the box
  • Modern tooling: Latest React Native development tools

Migration Guide

Old usage:

import Security from "react-native-vpn-detect";

const vpnActive = await Security.detectVPN();
const proxyActive = await Security.detectProxy();

New usage:

import { detectVPN, detectProxy } from 'react-native-vpn-proxy-detect';

const vpnActive = await detectVPN();
const proxyActive = await detectProxy();

Contributing

License

MIT


Made with create-react-native-library