🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

is-github

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-github

A small library which checks if the provided IP address belongs to GitHub.

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

npm version

is-github

A small JavaScript library which checks if the provided IP address belongs to GitHub. Works in Node and the browser.

It uses GitHub's meta endpoint to get the valid IP ranges. The response is cached for the duration GitHub provides in the Cache-Control header.

Usage

$ npm i is-github

or "https://cdn.jsdelivr.net/npm/is-github@1".

import { isGitHub } from 'is-github';

if (await isGitHub('1.2.3.4')) {
  console.log('Request came from GitHub!');
} else {
  console.log('Request was not from GitHub.');
}

Options

It is possible to provide the following options in an object as the second argument:

  • service: The service to check. One of: 'hooks', 'web', 'api', 'git', 'pages', 'importer' (Default: 'hooks')
  • userAgent: The user agent to use for the request to GitHub. This might not work in the browser. (Default: 'is-github')
  • timeout: The timeout in ms. (Default: 5000)

Requirements

The following API's are required when running in the browser.

Keywords

github

FAQs

Package last updated on 13 Mar 2020

Did you know?

Socket

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.

Install

Related posts