{"id":13420667,"url":"https://github.com/lkarsten/libvmod-ipcast","last_synced_at":"2025-03-15T07:31:21.653Z","repository":{"id":9601212,"uuid":"11522722","full_name":"lkarsten/libvmod-ipcast","owner":"lkarsten","description":"Convert strings to IP adresses for ACL checks in Varnish VCL.","archived":false,"fork":false,"pushed_at":"2016-04-29T06:52:12.000Z","size":51,"stargazers_count":22,"open_issues_count":0,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-20T04:11:50.582Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"M4","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/lkarsten.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-19T07:39:48.000Z","updated_at":"2023-03-10T11:52:09.000Z","dependencies_parsed_at":"2022-08-25T22:12:33.857Z","dependency_job_id":null,"html_url":"https://github.com/lkarsten/libvmod-ipcast","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkarsten%2Flibvmod-ipcast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkarsten%2Flibvmod-ipcast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkarsten%2Flibvmod-ipcast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkarsten%2Flibvmod-ipcast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lkarsten","download_url":"https://codeload.github.com/lkarsten/libvmod-ipcast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243701052,"owners_count":20333614,"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-07-30T22:01:38.638Z","updated_at":"2025-03-15T07:31:21.333Z","avatar_url":"https://github.com/lkarsten.png","language":"M4","funding_links":[],"categories":["TODO scan for Android support in followings"],"sub_categories":[],"readme":"============\nvmod_ipcast\n============\n\n----------------------\nVarnish ipcast Module\n----------------------\n\n:Author: Lasse Karstensen\n:Date: 2016-04-29\n:Version: 1.3\n:Manual section: 3\n\nSYNOPSIS\n========\n\nimport ipcast;\n\nDESCRIPTION\n===========\n\nThis is a Varnish 3.0 VMOD for converting a string into an IP type\nin VCL.\n\nNote that previously this VMOD overwrote the ``client.ip`` internal\nvariable. This was an inherently flawed method and has since been abandoned.\n\nFor Varnish 4 use the built-in ``std.ip()`` function.\n\nThis VMOD is tested on Varnish 3.0.7.\n\nFUNCTIONS\n=========\n\nip\n--\n\nPrototype\n        ::\n\n                ip(STRING S, STRING fallback)\nReturn value\n\tIP\n\nDescription\n\tParse the IPv4/IPv6 address in S and return that. If not successful, parse\n\tthe string in fallback and return that.\n\n\tWhen parsing fails the getaddrinfo() error output will be logged to\n\tvarnishlog.\n\n\tCaveat: If the fallback address is unparseable Varnish will crash.\n\n\n        ::\n\n                set req.http.xff = regsub(req.http.X-Forwarded-For, \"^(^[^,]+),?.*$\", \"\\1\");\n                if (ipcast.ip(req.http.xff, \"198.51.100.255\") == \"198.51.100.255\") { error 400 \"Bad request\"; }\n\n                set resp.http.x-parsed-ip = ipcast.ip(\"2001:db8::1\", \"198.51.100.255\");\n\n\n\nINSTALLATION\n============\n\nThe source tree is based on autotools to configure the building, and\ndoes also have the necessary bits in place to do functional unit tests\nusing the varnishtest tool.\n\nUsage::\n\n # only if you are building from a git clone.\n ./autogen.sh\n ./configure VARNISHSRC=DIR [VMODDIR=DIR]\n\n`VARNISHSRC` is the directory of the Varnish source tree for which to\ncompile your vmod. Both the `VARNISHSRC` and `VARNISHSRC/include`\nwill be added to the include search paths for your module.\n\nOptionally you can also set the vmod install directory by adding\n`VMODDIR=DIR` (defaults to the pkg-config discovered directory from your\nVarnish installation).\n\nMake targets:\n\n* make - builds the vmod\n* make install - installs your vmod in `VMODDIR`\n* make check - runs the unit tests in ``src/tests/*.vtc``\n\nIn your VCL you could then use this vmod along the following lines::\n\n        import ipcast;\n        acl friendly_network {\n            \"192.0.2.0\"/24;\n        }\n        sub vcl_recv {\n            set req.http.xff = regsub(req.http.X-Forwarded-For, \"^(^[^,]+),?.*$\", \"\\1\");\n            if (ipcast.ip(req.http.xff, \"198.51.100.255\") == \"198.51.100.255\") {\n                error 400 \"Bad request\";\n            }\n\n            if (ipcast.ip(req.http.xff, \"198.51.100.255\") !~ friendly_network) {\n                    error 403 \"Forbidden\";\n            }\n        }\nCOPYRIGHT\n=========\n\nThis document is licensed under the same license as the\nlibvmod-ipcast project. See LICENSE for details.\n\n* Copyright (c) 2011-2016 Varnish Software\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkarsten%2Flibvmod-ipcast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flkarsten%2Flibvmod-ipcast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkarsten%2Flibvmod-ipcast/lists"}