High-performance IP address filtering for Meta/Facebook networks (ASN 32934)
A lightweight, fast, and reliable TypeScript/JavaScript library to detect if an IP address belongs to Meta (formerly Facebook) infrastructure. Perfect for analytics, security filtering, bot detection, and network analysis.
- β Lightning fast IP address detection
- β IPv4 and IPv6 support - Complete coverage
- β TypeScript native with full type definitions
- β ESM and CommonJS compatible
- β Zero dependencies runtime (uses cidr-matcher for efficiency)
- β Monthly updates - Always up-to-date with latest Meta IP ranges
- β Comprehensive tests with 100% coverage
- β Production ready - Used in enterprise applications
# npm
npm install @palmthree-studio/meta-asn-filter
# yarn
yarn add @palmthree-studio/meta-asn-filter
# pnpm
pnpm add @palmthree-studio/meta-asn-filterimport { isMetaIP } from "@palmthree-studio/meta-asn-filter";
// Check if an IP belongs to Meta/Facebook
console.log(isMetaIP("69.63.189.44")); // true - Meta IPv4
console.log(isMetaIP("2a03:2880::1")); // true - Meta IPv6
console.log(isMetaIP("8.8.8.8")); // false - Google DNS
console.log(isMetaIP("2001:4860:4860::8888")); // false - Google IPv6const { isMetaIP } = require("@palmthree-studio/meta-asn-filter");
if (isMetaIP(userIP)) {
console.log("Traffic from Meta/Facebook detected");
}import { isMetaIP } from "@palmthree-studio/meta-asn-filter";
function shouldTrackVisitor(ip: string): boolean {
// Filter out Meta crawler traffic from analytics
return !isMetaIP(ip);
}import { isMetaIP } from "@palmthree-studio/meta-asn-filter";
function applyRateLimit(ip: string) {
if (isMetaIP(ip)) {
// Apply special rate limits for Meta services
return { limit: 1000, window: "1h" };
}
return { limit: 100, window: "1h" };
}import express from "express";
import { isMetaIP } from "@palmthree-studio/meta-asn-filter";
const app = express();
app.use((req, res, next) => {
const clientIP = req.ip;
if (isMetaIP(clientIP)) {
req.isMeta = true;
}
next();
});- ~0.001ms average lookup time
- 972 CIDR ranges covered (as of latest update)
- Memory efficient - Optimized CIDR matching
- No network calls - All data bundled
The IP ranges are automatically updated monthly from the RADB (Routing Assets Database) to ensure accuracy. The package includes:
- All IPv4 and IPv6 ranges assigned to ASN 32934 (Meta)
- Deduplicated and optimized CIDR blocks
- Verified against official routing tables
# Clone the repository
git clone https://github.com/palmthree-studio/meta-asn-filter.git
cd meta-asn-filter
# Install dependencies
npm install
# Refresh Meta IP data from RADB
npm run refresh
# Build the package
npm run build
# Run tests
npm testnpm run build- Build ESM, CommonJS, and TypeScript definitionsnpm run refresh- Update Meta IP ranges from RADBnpm test- Run Jest test suitenpm run dev- Watch mode for development
The package includes comprehensive tests covering:
- IPv4 address detection
- IPv6 address detection
- Edge cases and invalid inputs
- Performance benchmarks
npm testDetermines if an IP address belongs to Meta (ASN 32934).
Parameters:
ip: string- IPv4 or IPv6 address to check
Returns:
boolean-trueif the IP belongs to Meta,falseotherwise
Throws:
- No exceptions - Invalid IPs return
false
IP filtering, Meta Facebook IP ranges, ASN 32934, IPv4 IPv6 detection, TypeScript IP library, network security, bot detection, web crawlers, social media filtering, CIDR matching, Node.js IP utilities
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Created and maintained by Younès ELAB Palmthree Studio - Building developer tools that just work.
If this package helps you, please consider:
- β Starring this repository
- π Reporting bugs or requesting features
- π Contributing to the codebase
- π’ Sharing with your network
β Star this repository now! - It helps others discover this tool!
Made with β€οΈ by Palmthree Studio
Report Bug β’ Request Feature β’ Documentation