ip-white-list.js 385 Bytes
const co = Promise.coroutine;
const logger = global.yoho.logger;
const cache = global.yoho.cache.master;
const WHITE_LIST_KEY = 'whitelist:ip:';

module.exports = (remoteIp) => {
    let key = `${WHITE_LIST_KEY}${remoteIp}`;

    return co(function* () {
        let result = Boolean(yield cache.getAsync(key));

        logger.debug(key, result);

        return result;
    })();
};