MyIP

repository·main·Indexed 27 days ago

https://github.com/jason5ng32/myip

A comprehensive IP and network diagnostic toolbox (version 7.0.0) providing tools for IP discovery, geolocation, ASN history, network connectivity testing, and security checks. Features include WebRTC and DNS leak tests, MTR tests, browser fingerprinting, and service availability monitoring for platforms like OpenAI and Cloudflare. Supports deployment via Docker, Docker Compose, PM2, or Node.js with pnpm, and integrates with MaxMind GeoLite2 databases for IP information.

Tokens
3K
Snippets
11
Records
16
Agent score
95%

What's inside myip

  1. Overview of MyIP features

    main

    MyIP is an IP toolbox designed for network diagnostics and information gathering. Key capabilities include:

    • IP Discovery: Detects local IPv4 and IPv6 addresses using multiple sources.
    • IP Information: Provides detailed data on any IP, including country, region, ASN, and geolocation.
    • Network Diagnostics:
      • ASN History & Topology: Visualizes AS announcement history and paths to Tier 1 networks.
      • Availability Checks: Tests access to sites like Google, GitHub, YouTube, and ChatGPT.
      • Service Status: Monitors availability of services like Claude, OpenAI, and Cloudflare via official status pages.
      • WebRTC & DNS Leak Tests: Identifies WebRTC IP usage and evaluates DNS leak risks.
      • Speed & Latency: Performs network speed tests and global latency measurements.
      • MTR Tests: Executes MTR tests from various global regions.
      • DNS Resolver: Resolves domain names through multiple sources to detect DNS spoofing.
    • Security & Privacy:
      • Censorship Check: Verifies if a site is blocked in specific countries.
      • Whois & MAC Lookup: Retrieves domain registration and physical address info.
      • Browser Fingerprinting: Calculates browser fingerprints using multiple methods.
      • Cybersecurity Checklist: Provides 258 recommendations for digital protection.
  2. Deploy MyIP in a Node.js Environment

    main

    To deploy in a Node.js environment, create a .env file from the provided example and configure your required variables (especially MaxMind and Google Analytics).

    # Create the .env file
    cp .env.example .env
    
    # Edit .env with your configuration
    # Example content:
    BACKEND_PORT=11966
    FRONTEND_PORT=18966
    MAXMIND_ACCOUNT_ID="YOUR_ACCOUNT_ID"
    MAXMIND_LICENSE_KEY="YOUR_LICENSE_KEY"
    MAXMIND_AUTO_UPDATE="true"
    GOOGLE_MAP_API_KEY="YOUR_KEY_HERE"
    ALLOWED_DOMAINS="example.com,example.org"
  3. Configure proxy rules for IP testing

    main

    If you are using a proxy to access the internet, you can configure your proxy client to allow testing both your real IP address and the address used through the proxy. Add rules to your proxy configuration to direct specific IP ranges or domains through the proxy or directly (DIRECT).

    To test IP addresses, use IP-CIDR or IP-CIDR6 rules. To test rule routing, use DOMAIN rules pointing to specific test endpoints.

    # IP Testing
    IP-CIDR,1.0.0.2/32,Proxy,no-resolve
    IP-CIDR6,2606:4700:4700::1111/128,Proxy,no-resolve
    DOMAIN,4.ipcheck.ing,DIRECT
    DOMAIN,6.ipcheck.ing,DIRECT
    
    # Rule Testing
    DOMAIN,ptest-1.ipcheck.ing,Proxy1
    DOMAIN,ptest-2.ipcheck.ing,Proxy2
    DOMAIN,ptest-3.ipcheck.ing,Proxy3
    DOMAIN,ptest-4.ipcheck.ing,Proxy4
    DOMAIN,ptest-5.ipcheck.ing,Proxy5
    DOMAIN,ptest-6.ipcheck.ing,Proxy6
    DOMAIN,ptest-7.ipcheck.ing,Proxy7
    DOMAIN,ptest-8.ipcheck.ing,Proxy8
  4. Set up environment variables in Node.js

    main

    To use environment variables in a local Node.js environment, copy the example file and modify it with your specific credentials and configuration.

    1. Create your .env file:
      cp .env.example .env
    2. Edit the .env file with your values (e.g., BACKEND_PORT, MAXMIND_ACCOUNT_ID, etc.).
    3. Restart the backend service to apply changes.
    cp .env.example .env
  5. Run MyIP using Docker

    main

    When running MyIP via Docker, you must pass the required MaxMind credentials and other configurations as environment variables using the -e flag. Note that MAXMIND_AUTO_UPDATE must be set to "true" for the container to function correctly.

    docker run -d -p 18966:18966 \
      -e MAXMIND_ACCOUNT_ID="YOUR_ACCOUNT_ID" \
      -e MAXMIND_LICENSE_KEY="YOUR_LICENSE_KEY" \
      -e MAXMIND_AUTO_UPDATE="true" \
      -e GOOGLE_MAP_API_KEY="YOUR_KEY_HERE" \
      -e ALLOWED_DOMAINS="example.com,example.org" \
      --name myip \
      jason5ng32/myip:latest
  6. Configure MaxMind GeoLite2 Databases

    main

    MyIP requires MaxMind GeoLite2 databases (City + ASN) for IP geolocation, ASN/organization lookups, and country flag displays. Since .mmdb files are not included in the repository due to licensing, you must provide them using one of two methods:

    1. Sign up for a free account at maxmind.com/en/geolite2/signup.
    2. Generate a license key in the 'Manage License Keys' section of your account.
    3. Set the following environment variables:
      • MAXMIND_ACCOUNT_ID: Your MaxMind account ID.
      • MAXMIND_LICENSE_KEY: Your MaxMind license key.
      • MAXMIND_AUTO_UPDATE: Set to "true".
    4. Start the server. The module will download the databases approximately 60 seconds after the first launch and update them every 24 hours.

    Note for Docker users: You MUST use Option A. Docker containers start with an empty common/maxmind-db/ directory. Without these variables, IP data and WebRTC country flags will not function, and the logs will show MaxMind API will return 503... errors.

    Option B: Manual Installation (For isolated environments or non-Docker installs)

    1. Download GeoLite2-City.mmdb and GeoLite2-ASN.mmdb from your MaxMind account.
    2. Place these files in the common/maxmind-db/ directory before starting the server.
    3. Set MAXMIND_AUTO_UPDATE to "false". You will need to manually replace these files when new versions are released.
    MAXMIND_ACCOUNT_ID="your-account-id"
    MAXMIND_LICENSE_KEY="your-license-key"
    MAXMIND_AUTO_UPDATE="true"
  7. Deploy MyIP using Docker

    main

    When running via Docker, you must pass the MaxMind configuration variables as environment flags to ensure the database is automatically downloaded and the backend functions correctly.

    docker run -d -p 18966:18966 \
      -e MAXMIND_ACCOUNT_ID="YOUR_ACCOUNT_ID" \
      -e MAXMIND_LICENSE_KEY="YOUR_LICENSE_KEY" \
      -e MAXMIND_AUTO_UPDATE="true" \
      -e GOOGLE_MAP_API_KEY="YOUR_KEY_HERE" \
      -e ALLOWED_DOMAINS="example.com,example.org" \
      --name myip \
      jason5ng32/myip:latest
  8. Deploy MyIP in a Node.js environment

    main

    To run MyIP locally using Node.js, ensure Node.js is installed on your system. This project uses pnpm for dependency management.

    1. Clone the repository:
      git clone https://github.com/jason5ng32/MyIP.git
    2. Install pnpm if you haven't already:
      npm install -g pnpm
    3. Install dependencies and build the project:
      pnpm install && pnpm run build
    4. Start the application:
      pnpm start

    Once started, the application will be available on port 18966.

    git clone https://github.com/jason5ng32/MyIP.git
    npm install -g pnpm
    pnpm install && pnpm run build
    pnpm start
  9. Deploy MyIP using Docker

    main

    You can quickly deploy MyIP using Docker by running the following command. This will start the container in detached mode, map port 18966, and ensure the container restarts automatically if the system reboots.

    docker run -d -p 18966:18966 --name myip --restart always jason5ng32/myip:latest
  10. Run MyIP with PM2 using ecosystem.config.cjs

    main

    To deploy MyIP in a production environment using PM2, use the provided ecosystem.config.cjs file. This configuration ensures the backend correctly loads Sentry's ESM auto-instrumentation via the --import flag before the Express server starts.

    Note: If you are not using Sentry (i.e., SENTRY_DSN_BACKEND is not set), the Sentry instrumentation acts as a no-op and the configuration remains valid.

    pm2 start ecosystem.config.cjs
  11. Deploy MyIP using Docker Compose

    main

    You can deploy the MyIP service using Docker Compose. This configuration sets up the myip container, maps the service port to the host, and ensures the container restarts automatically.

    To deploy, save the configuration to a docker-compose.yml file and run: docker-compose up -d

    # docker-compose up -d
    version: '3'
    services:
        myip:
            container_name: myip
            image: jason5ng32/myip:latest # my-app: x.x.x
            stdin_open: true # docker run -i interactive mode
            tty: true        # docker run -t terminal mode
            restart: always # restart policy / on-failure:5 restart 5 times / always restart forever / unless-stopped unless stopped / no never restart
            ports:
                - "18966:18966"