mirror of https://github.com/dnomd343/ProxyC
Dnomd343
3 years ago
6 changed files with 57 additions and 17 deletions
@ -0,0 +1,41 @@ |
|||
#!/usr/bin/python |
|||
# -*- coding:utf-8 -*- |
|||
|
|||
import time |
|||
import redis |
|||
import subprocess |
|||
|
|||
maxThread = 32 |
|||
|
|||
redisPort = 6379 |
|||
redisHost = 'localhost' |
|||
redisPrefix = 'proxyc-' |
|||
|
|||
redisObject = redis.StrictRedis( |
|||
db = 0, |
|||
host = redisHost, |
|||
port = redisPort |
|||
) |
|||
|
|||
processList = [] |
|||
while True: |
|||
spareNum = min( |
|||
maxThread - len(processList), # 空余进程数 |
|||
len(redisObject.keys(redisPrefix + 'check-*')) # 待检测个数 |
|||
) |
|||
if spareNum < 0: |
|||
spareNum = 0 |
|||
print("spareNum = " + str(spareNum)) |
|||
|
|||
for i in range(spareNum): # 运行检测进程 |
|||
processList.append( |
|||
subprocess.Popen(['python','Run.py']) |
|||
) |
|||
time.sleep(0.2) |
|||
|
|||
for process in processList: # 遍历子进程 |
|||
if process.poll() != None: # 进程已退出 |
|||
print("remove subprocess") |
|||
processList.remove(process) |
|||
|
|||
time.sleep(0.5) |
@ -1,11 +0,0 @@ |
|||
import redis |
|||
|
|||
redisPrefix = 'proxyc-' |
|||
redisHost = 'localhost' |
|||
redisPort = 6379 |
|||
|
|||
ssInfo = '{"tag": "f43c9bae21ae8693", "check": ["http"], "info": {"type": "ss", "server": "127.0.0.1", "port": 12345, "password": "dnomd343", "method": "aes-256-ctr", "plugin": "", "pluginParam": ""}}' |
|||
ssrInfo = '{"tag": "54cd9ba3a8e86f93", "check": ["http"], "info": {"type": "ssr", "server": "127.0.0.1", "port": 23456, "password": "dnomd343", "method": "table", "protocol": "auth_aes128_md5", "protocolParam": "", "obfs": "tls1.2_ticket_auth", "obfsParam": ""}}' |
|||
redisObject = redis.StrictRedis(host = redisHost, port = redisPort, db = 0) |
|||
redisObject.set(redisPrefix + 'check-a-f43c9bae21ae8693', ssInfo) |
|||
redisObject.set(redisPrefix + 'check-c-54cd9ba3a8e86f93', ssrInfo) |
Loading…
Reference in new issue