def get_lcs_name(): date = vps_util.todaystr() if redis_shell.get(CM + ':lcsserial:date') == date: serial = redis_shell.incr(CM + ':lcsserial') else: pipe = redis_shell.pipeline() pipe.set(CM + ':lcsserial:date', date) pipe.set(CM + ':lcsserial', 1) pipe.execute() serial = 1 return 'fp-%s-%s-%03d' % (CM, date, serial)
def get_lcs_name(req): date = vps_util.todaystr() if redis_shell.get(CM + ':lcsserial:date') == date: serial = redis_shell.incr(CM + ':lcsserial') else: pipe = redis_shell.pipeline() pipe.set(CM + ':lcsserial:date', date) pipe.set(CM + ':lcsserial', 1) pipe.execute() serial = 1 type_prefix = 'obfs4' if 'obfs4_port' in req else 'https' return 'fp-%s-%s-%s-%03d' % (type_prefix, CM, date, serial)
def today(cm): """The number of servers launched today.""" todaystr = vps_util.todaystr() return sum(1 for x in r().lrange(cm + ':vpss', 0, -1) if ('-%s-' % todaystr) in x)