This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "thirdparty/glog/logging.h" | |
#include <string.h> | |
namespace chaoaero | |
{ | |
// ecb mode with no padding | |
// no need to append '\0' when the length of input text is not multiple of the block size | |
Aes128::Aes128(const std::string& key_data) | |
{ | |
int key_len = key_data.size(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- People can call this module by the following methods: | |
[==[ | |
local req = require "path.token_bucket" | |
local ok = req.limit{ key = ngx.var.remote_addr, zone = "ip", | |
rate = "2r/s", capacity = 10, log_level = ngx.ERROR, | |
rds = { host = "127.0.0.1", port = 6379 }} | |
if not ok then | |
return ngx.exit(503) | |
end | |
]==] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require "ffi" | |
local ffi_new = ffi.new | |
local ffi_str = ffi.string | |
local C = ffi.C | |
local setmetatable = setmetatable | |
local error = error | |
local _M = {_VERSION = '0.01' } |