<div dir="ltr">Nice!<div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Nov 30, 2018 at 12:14 AM kokoniimasu <<a href="mailto:kokoniimasu@gmail.com">kokoniimasu@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, All.<br>
<br>
I created a vmod_xcounter that can easily add counters.<br>
I think it can use in various situations.<br>
<br>
I'm using vsthrottle together.<br>
<br>
- vcl<br>
<br>
  vcl 4.0;<br>
  import xcounter;<br>
  import vsthrottle;<br>
<br>
  sub vcl_init {<br>
    new atk_login   = xcounter.vsc(hidevclname=1, groupname="attack.");<br>
    ...<br>
  }<br>
<br>
  sub vcl_recv {<br>
  ...<br>
    if(req.method == "POST" &&  req.url ~ ****){<br>
      if(vsthrottle.is_denied("LOGIN:" + req.http.****, **, 60s)) {<br>
        atk_login.incr(1);<br>
        return (synth(429, "Too Many Requests"));<br>
      }<br>
  ...<br>
    }<br>
  ...<br>
  }<br>
<br>
- output<br>
  <a href="https://raw.githubusercontent.com/xcir/libvmod-xcounter/master/res/varnishstat.png" rel="noreferrer" target="_blank">https://raw.githubusercontent.com/xcir/libvmod-xcounter/master/res/varnishstat.png</a><br>
<br>
<br>
<a href="https://github.com/xcir/libvmod-xcounter" rel="noreferrer" target="_blank">https://github.com/xcir/libvmod-xcounter</a><br>
<br>
I hope that this vmod is of help to you.<br>
<br>
--<br>
Shohei Tanaka(@xcir)<br>
<a href="http://blog.xcir.net/" rel="noreferrer" target="_blank">http://blog.xcir.net/</a> (JP)<br>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>