{"id":28396302,"url":"https://github.com/ssbc/non-private-ip","last_synced_at":"2025-06-23T06:31:34.588Z","repository":{"id":25082190,"uuid":"28502827","full_name":"ssbc/non-private-ip","owner":"ssbc","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-07T04:17:39.000Z","size":58,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-11T16:36:01.034Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ssbc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2014-12-26T06:56:38.000Z","updated_at":"2022-01-24T12:26:28.000Z","dependencies_parsed_at":"2024-03-17T02:05:45.214Z","dependency_job_id":"d266a549-edb9-4ac0-9b46-7cd92e081671","html_url":"https://github.com/ssbc/non-private-ip","commit_stats":null,"previous_names":["dominictarr/non-private-ip"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ssbc/non-private-ip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fnon-private-ip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fnon-private-ip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fnon-private-ip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fnon-private-ip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssbc","download_url":"https://codeload.github.com/ssbc/non-private-ip/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fnon-private-ip/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260951355,"owners_count":23087672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-31T21:37:52.150Z","updated_at":"2025-06-23T06:31:34.579Z","avatar_url":"https://github.com/ssbc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# non-private-ip\n\nPicks the first reasonable looking IP address from network interfaces.\nThis should _just work_ when running on a VPS, but also provides `private` APIs\nso that when running in LAN you get the first reasonable looking LAN IP address.\n\nMore info: http://en.wikipedia.org/wiki/Private_network\n\nYour laptop probably does not have a non-local IP address, but your VPS server\nprobably does. This just returns the first address, which will probably be IPv4.\n\nThis module is based on the [\"ip\" module](https://www.npmjs.com/package/ip).\n\n## API\n\nThe main export is a function `nonPrivateIP(interfaces, filter, details)` where:\n\n- `interfaces` is either `null` or a mock of `os.networkInterfaces()`, typically\n  **this should be `null`**\n- `filter` is a **function** of the shape `(address, details) =\u003e boolean` where\n  `address` is the IP address as a string, and `details` is the whole object\n  with additional fields, e.g. `address`, `netmask`, `family`, `mac`, `cidr`,\n  etc\n- `details` is a boolean that controls whether you want the return of the\n  function to be just the IP address as a string (`false`, this is the\n  **default**) or the whole object with additional fields (`true`)\n\n```js\n// On a VPS:\nconst nonPrivateIP = require('non-private-ip')\nnonPrivateIP() // 80.78.25.153\n```\n\n```js\n// In a LAN:\nconst nonPrivateIP = require('non-private-ip')\nnonPrivateIP.private() // 192.168.0.101\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssbc%2Fnon-private-ip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssbc%2Fnon-private-ip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssbc%2Fnon-private-ip/lists"}