This file contains 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 balancer = require 'ngx.balancer' | |
local upstream = require 'ngx.upstream' | |
local dyupcl = require 'dyupcl' | |
balancer.set_timeouts(1, 1, 60) | |
local name = balancer.get_last_failure() | |
if not name then | |
local ok, err = balancer.set_more_tries(1) | |
if not ok then | |
ngx.log(ngx.ERR, err) |
This file contains 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 limit = require 'limit' | |
local ignoreIps = {} | |
local ignoreKeys = {} | |
local headers = ngx.req.get_headers() | |
local key = headers['api-key'] or '' | |
local ip = string.match(headers['x-forwarded-for'] or ngx.var.remote_addr, '%d+.%d+.%d+.%d+') | |
for i, v in ipairs(ignoreKeys) do | |
if v == key then |
This file contains 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
const C = require('../constant'); | |
const nUrl = require('url'); | |
const uuid = require('uuid'); | |
const ws = require('ws'); | |
const lib = require(process.env.lib); | |
const logger = lib.logger.createLogger('tunnel-service-ws'); | |
const fw = require(process.env.fw); | |
let id2Socket = {}; // 信道id与socket映射,用于sendMessage | |
let id2Notify = {}; // 信道id的回调信息,暂时使用内部的http rpc方式 |
This file contains 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
const Promise = require('bluebird'); | |
const _ = require('lodash'); | |
const uuid = require('uuid'); | |
const C = require('../constant'); | |
const proxy = require('../proxy'); | |
const lib = require(process.env.lib); | |
const redis = lib.redis.createClient(C.QUEUE.REDIS); | |
const logger = lib.logger.createLogger('common-service-queue'); | |
exports.pushTask = pushTask; |