Skip to content

Commit 93d8d87

Browse files
committed
优化V2rayPool代理池
1 parent 84f1a30 commit 93d8d87

File tree

9 files changed

+267
-317
lines changed

9 files changed

+267
-317
lines changed

002-V2rayPool/core/conf.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
class Config:
99
__v2ray_core_path = None
10+
__v2ray_node_path = None
1011

1112
def __init__(self):
1213
self.config = configparser.ConfigParser()
@@ -35,3 +36,13 @@ def set_v2ray_core_path(dir: str):
3536
def get_v2ray_core_path():
3637
"""获取当前v2ray_core程序的目录"""
3738
return Config.__v2ray_core_path
39+
40+
@staticmethod
41+
def set_v2ray_node_path(dir: str):
42+
"""设置当前v2ray保存节点的目录"""
43+
Config.__v2ray_node_path = dir
44+
45+
@staticmethod
46+
def get_v2ray_node_path():
47+
"""获取当前v2ray保存节点的目录"""
48+
return Config.__v2ray_node_path

002-V2rayPool/core/config.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
"settings": {
2525
"vnext": [
2626
{
27-
"address": "a0b88095bc56fa123.awsglobalaccelerator.com",
28-
"port": 80,
27+
"address": "api.ssfree.ru",
28+
"port": 443,
2929
"users": [
3030
{
31-
"id": "d6bb0999-fa0a-3f92-b27a-3817dd8bfca3",
32-
"alterId": 2,
31+
"id": "8a94a54e-6e40-11ec-bb14-000017022008",
32+
"alterId": 64,
3333
"security": "aes-128-gcm"
3434
}
3535
]

002-V2rayPool/core/utils.py

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -189,38 +189,21 @@ def readchar(prompt=""):
189189
return ch.strip()
190190

191191

192+
def kill_all_v2ray():
193+
pids = os.popen("ps aux |grep v2ray |awk '{print $2}'").read().split('\n')
194+
for pid in pids:
195+
try:
196+
import subprocess
197+
# subprocess.check_output("kill %d" % int(pid))
198+
a = os.popen("kill %d" % int(pid)).read()
199+
except Exception as e:
200+
pass
201+
202+
192203
# netstat -nlp | grep :1080 | awk '{print $7}' | awk -F\" / \" '{ print $1 }'
193204
def kill_process_by_port(port):
194205
try:
195-
# kill -9 `ps -ef |grep act1 |awk 'NR==1{print $3}'`
196-
# pids = os.popen("pgrep -f v2ray|xargs -n1 kill -9").read().split('\n')
197206
pids = os.popen("pgrep -f v2ray|xargs kill -9").read().split('\n')
198207
print(pids)
199-
# a = os.kill(int(pid), 0)
200-
# a = os.popen("kill %d" % int(pid)).read()
201-
# print('已杀死port为%d,pid为%s的进程, 返回值是:%s' % (port, pid, a))
202208
except:
203209
pass
204-
pid_all = []
205-
# ps aux | grep 'v2ray' | awk '{print $2}
206-
# pids = os.popen("lsof -i:%d | awk '{print $2}'" % (port)).read().split('\n')
207-
208-
209-
# pids = os.popen("ps aux |grep v2ray |awk '{print $2}'").read().split('\n')
210-
# # pids = os.popen("ps aux | grep 'v2ray' | awk '{print $2}'").read().split('\n')
211-
# print(pids)
212-
# for pid in pids:
213-
# temp = pid.strip()
214-
# if len(temp) > 1 and temp != 'PID' and temp != '0' and temp not in pid_all:
215-
# pid_all.append(temp)
216-
# for pid in pid_all:
217-
# # a = os.kill(int(pid), 0)
218-
# # a = os.popen("kill -9 %d" % int(pid)).read()
219-
# try:
220-
# process = subprocess.Popen("kill %d" % int(pid), shell=True)
221-
# os.killpg(os.getpgid(process.pid), signal.SIGTERM)
222-
# # a = os.kill(int(pid), 0)
223-
# # a = os.popen("kill %d" % int(pid)).read()
224-
# print('已杀死port为%d,pid为%s的进程, 返回值是:%s' % (port, pid, a))
225-
# except:
226-
# pass

002-V2rayPool/db/_db-checked.txt

Lines changed: 0 additions & 47 deletions
This file was deleted.

002-V2rayPool/db/_db-uncheck.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)