当前位置: 首页 > news >正文

vps除了做网站还能做什么短视频培训机构排名

vps除了做网站还能做什么,短视频培训机构排名,旅游做攻略网站,南京网站设计公司哪儿济南兴田德润怎么联系Rate Limiting限流插件 https://docs.konghq.com/hub/kong-inc/rate-limiting/ 它可以针对consumer ,credential ,ip ,service,path,header 等多种维度来进行限流.流量控制的精准度也有多种方式可以参考,比如可以做到秒级,分钟级,小时级等限流控制. 基于IP限流 源码地址&…

Rate Limiting限流插件

https://docs.konghq.com/hub/kong-inc/rate-limiting/

它可以针对consumer ,credential ,ip ,service,path,header 等多种维度来进行限流.流量控制的精准度也有多种方式可以参考,比如可以做到秒级,分钟级,小时级等限流控制.

基于IP限流

源码地址: kong/kong/plugins/ip-restriction/handler.lua at master · Kong/kong · GitHub

local lrucache = require "resty.lrucache"
local ipmatcher = require "resty.ipmatcher"
local kong_meta = require "kong.meta"local error = error
local kong = kong
local log = kong.log
local ngx_var = ngx.varlocal IPMATCHER_COUNT = 512
local IPMATCHER_TTL   = 3600
local cache = lrucache.new(IPMATCHER_COUNT)local IpRestrictionHandler = {PRIORITY = 990,VERSION = kong_meta.version,
}local isempty
dolocal tb_isempty = require "table.isempty"isempty = function(t)return t == nil or tb_isempty(t)end
endlocal function do_exit(status, message)status = status or 403message = message orstring.format("IP address not allowed: %s", ngx_var.remote_addr)log.warn(message)return kong.response.error(status, message)
endlocal function match_bin(list, binary_remote_addr)local matcher, errmatcher = cache:get(list)if not matcher thenmatcher, err = ipmatcher.new(list)if err thenreturn error("failed to create a new ipmatcher instance: " .. err)endcache:set(list, matcher, IPMATCHER_TTL)endlocal is_matchis_match, err = matcher:match_bin(binary_remote_addr)if err thenreturn error("invalid binary ip address: " .. err)endreturn is_match
endlocal function do_restrict(conf)local binary_remote_addr = ngx_var.binary_remote_addrif not binary_remote_addr thenreturn do_exit(403,"Cannot identify the client IP address, " .."unix domain sockets are not supported.")endlocal deny = conf.denyif not isempty(deny) thenlocal blocked = match_bin(deny, binary_remote_addr)if blocked thenreturn do_exit(conf.status, conf.message)endendlocal allow = conf.allowif not isempty(allow) thenlocal allowed = match_bin(allow, binary_remote_addr)if not allowed thenreturn do_exit(conf.status, conf.message)endend
endfunction IpRestrictionHandler:access(conf)return do_restrict(conf)
endfunction IpRestrictionHandler:preread(conf)return do_restrict(conf)
endreturn IpRestrictionHandler

http://www.dt0577.cn/news/41490.html

相关文章:

  • 网站可以做315认证吗百度seo排名推广
  • 唐山专门做网站福州短视频seo公司
  • 徐州网站制作方法网络营销案例分析
  • 有织梦后台系统怎么做网站seo网站关键词优化排名
  • 网站后台做图片尺寸是多大行业关键词词库
  • 强的网站建设公免费html网页模板
  • 大江网站建设怎么制作网页广告
  • 手机网页设计网站建设网站推广优化排名教程
  • wordpress网站打开很卡百度关键词推广条件
  • win7版本的wordpress郑州网站seo技术
  • 做面食专业网站晨阳seo
  • 找合伙人的网站做淘宝什么叫seo优化
  • 云图书馆平台网站建设渠道网
  • p2p做网站“跨年”等关键词搜索达年内峰值
  • 怎么发布php网站长沙网站制作主要公司
  • 外贸专业网站制作想要导航推广网页怎么做
  • 男女做羞羞视频网站东莞seo网络营销
  • 自己免费做网站(二)百度推广页面投放
  • 15年做哪些网站能致富专业网站优化
  • 湖州网站建设公司百度号码认证平台
  • 虎门做网站的公司google代理
  • 如何建立自己的网络销售慈溪seo排名
  • 有哪些网站用java做的营销策划方案模板
  • 在淘宝做网站可以退货退款么网站收录查询代码
  • 火车头采集wordpress发布说明泰安seo
  • 用java做网站云搜索引擎
  • 手机站点cn八爪鱼磁力搜索引擎
  • 手机app界面怎么做安卓手机优化
  • 怎么在网站底部做备案号哈尔滨优化网站公司
  • 谷城网站制作好的搜索引擎推荐