{"id":24915540,"url":"https://github.com/thewaterfall/ip4j","last_synced_at":"2025-06-21T20:04:53.860Z","repository":{"id":275332362,"uuid":"925650564","full_name":"thewaterfall/ip4j","owner":"thewaterfall","description":"Ip4J is a small, simple and zero dependencies Java 11+ library for retrieving a request IP address from an HttpServletRequest. It supports various headers commonly used in web applications to forward client IP addresses.","archived":false,"fork":false,"pushed_at":"2025-02-07T09:19:58.000Z","size":74,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T06:31:25.493Z","etag":null,"topics":["client-ip","ip","ip-address-lookup","java"],"latest_commit_sha":null,"homepage":"","language":"Java","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/thewaterfall.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,"publiccode":null,"codemeta":null}},"created_at":"2025-02-01T11:57:11.000Z","updated_at":"2025-02-07T09:20:01.000Z","dependencies_parsed_at":"2025-02-01T19:33:20.157Z","dependency_job_id":null,"html_url":"https://github.com/thewaterfall/ip4j","commit_stats":null,"previous_names":["thewaterfall/ip4j"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/thewaterfall/ip4j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thewaterfall%2Fip4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thewaterfall%2Fip4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thewaterfall%2Fip4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thewaterfall%2Fip4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thewaterfall","download_url":"https://codeload.github.com/thewaterfall/ip4j/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thewaterfall%2Fip4j/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261186768,"owners_count":23121942,"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":["client-ip","ip","ip-address-lookup","java"],"created_at":"2025-02-02T07:18:06.856Z","updated_at":"2025-06-21T20:04:48.848Z","avatar_url":"https://github.com/thewaterfall.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ip4j\n\n[![](https://jitpack.io/v/thewaterfall/ip4j.svg)](https://jitpack.io/#thewaterfall/ip4j)\n\nIp4j is a small, simple and zero dependencies Java 11+ library for retrieving a request IP address from an\n`HttpServletRequest`. It supports various headers commonly used in web applications to forward client IP addresses.\n\n## Features\n\nExtracts IP address from multiple sources by the following order (higher to lower priority):\n- `Custom user headers` (optional user-provided headers)\n- `X-Client-IP header`\n- `X-Forwarded-For header` (if multiple comma-separated IPs found - first one is returned)\n- `CF-Connecting-IP header` (Cloudflare)\n- `Fastly-Client-Ip header` (Fastly CDN)\n- `True-Client-Ip header` (Akamai, Cloudflare)\n- `X-Real-IP header` (Nginx, FastCGI)\n- `X-Cluster-Client-IP header` (Rackspace, Riverbed Stingray)\n- `X-Forwarded header` (if multiple comma-separated IPs found - first one is returned)\n- `Forwarded-For header` (if multiple comma-separated IPs found - first one is returned)\n- `Forwarded header` (first \"for\" directive is used, if multiple comma-separated IPs found - first one is returned)\n- `appengine-user-ip header` (Google App Engine)\n- `Cf-Pseudo-IPv4 header` (Cloudflare fallback)\n- `request.getRemoteAddr()`\n\n## Installation\nIp4j can be easily installed using JitPack, see Gradle and Maven examples below.\n\n### Gradle\nAdd the following to your build.gradle file:\n\n```\nrepositories {\n    mavenCentral()\n    maven { url \"https://jitpack.io\" }\n}\n\ndependencies {\n    implementation 'com.github.thewaterfall:ip4j:1.0.0'\n}\n```\n\n### Maven\nAdd the following to your pom.xml file:\n\n```\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack.io\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.github.thewaterfall\u003c/groupId\u003e\n        \u003cartifactId\u003eip4j\u003c/artifactId\u003e\n        \u003cversion\u003e1.0.0\u003c/version\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n## Usage \n\n```\nString ip = Ip4j.getIp(request); \n\n// With custom headers\nString ip = Ip4j.getIp(request, \"X-Ip\");\nString ip = Ip4j.getIp(request, \"X-Ip\", \"My-Ip\", \"IPs\"); \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthewaterfall%2Fip4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthewaterfall%2Fip4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthewaterfall%2Fip4j/lists"}