{"id":21878348,"url":"https://github.com/pepabo/mruby-ipfilter","last_synced_at":"2025-04-15T03:04:33.679Z","repository":{"id":146415869,"uuid":"92142359","full_name":"pepabo/mruby-ipfilter","owner":"pepabo","description":null,"archived":false,"fork":false,"pushed_at":"2018-03-28T07:03:18.000Z","size":12,"stargazers_count":3,"open_issues_count":1,"forks_count":4,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-15T03:04:28.008Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pepabo.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":"2017-05-23T07:23:51.000Z","updated_at":"2020-01-23T05:36:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"272fa155-5c3d-48f7-8080-8670f647212d","html_url":"https://github.com/pepabo/mruby-ipfilter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pepabo%2Fmruby-ipfilter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pepabo%2Fmruby-ipfilter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pepabo%2Fmruby-ipfilter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pepabo%2Fmruby-ipfilter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pepabo","download_url":"https://codeload.github.com/pepabo/mruby-ipfilter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997083,"owners_count":21195798,"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":"2024-11-28T08:12:23.126Z","updated_at":"2025-04-15T03:04:33.673Z","avatar_url":"https://github.com/pepabo.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mruby-ipfilter   [![Build Status](https://travis-ci.org/pepabo/mruby-ipfilter.svg?branch=master)](https://travis-ci.org/pepabo/mruby-ipfilter)\nIPFilter class\n## install by mrbgems\n- add conf.gem line to `build_config.rb`\n\n```ruby\nMRuby::Build.new do |conf|\n\n    # ... (snip) ...\n\n    conf.gem :github =\u003e 'tahira/mruby-ipfilter'\nend\n```\n## example\n```ruby\n# CountryFromIP sample\ncip = IPFilter::CountryFromIP.new('/tmp/GeoLite2-City.mmdb')\ncip.permit = ['JP']\n\ntarget_ip = '8.8.8.8'\nif cip.permit?(target_ip)\n  p \"#{target_ip} is permit\"\nelse\n  p \"#{target_ip} is deny\"\nend\n\n# Path sample\npath = IPFilter::Path.new()\npath.deny = ['wp-login.php', 'xmlrpc.php']\ntarget_path = '/blog/wp-login.php'\nif path.deny?(target_path)\n  p \"#{target_path} is deny\"\nelse\n  p \"#{target_path} is permit\"\nend\n\n# UserAgent sample\nua = IPFilter::UserAgent.new()\nua.permit = ['Googlebot', 'Twitterbot']\ntarget_ua='Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'\nif ua.permit?(target_ua)\n  p \"#{target_ua} is permit\"\nelse\n  p \"#{target_ua} is permit\"\nend\n```\n\n```sh\n❯ mruby/bin/mruby example/example.rb                                                                  1h 37m 24s 309ms\n\"8.8.8.8 is deny\"\n\"/blog/wp-login.php is deny\"\n\"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) is permit\"\n```\n\n## License\nunder the MIT License:\n- see LICENSE file\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpepabo%2Fmruby-ipfilter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpepabo%2Fmruby-ipfilter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpepabo%2Fmruby-ipfilter/lists"}