Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
添加检查更新、vmess中优化websocket,增加mkcp,修复若干bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangxufeng committed Sep 4, 2019
1 parent 68e8c47 commit 043ec26
Show file tree
Hide file tree
Showing 6 changed files with 327 additions and 120 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ V2Ray 项目地址:https://github.com/v2ray/v2ray-core

# v2rayL

![v2rayL](http://cloud.thinker.ink/images/v2rayLlogo.png)
![v2rayL](http://cloud.thinker.ink/images/857633d396d9f89cc606c0666194f45f.png)

v2ray linux 客户端,使用pyqt5编写GUI界面,核心基于v2ray-core

Expand All @@ -19,31 +19,33 @@ v2ray linux 客户端,使用pyqt5编写GUI界面,核心基于v2ray-core
- 通过`vmess://``ss://`分享链接添加配置,通过二维码添加配置
- 导出配置、生成配置分享链接、生成分享二维码
- 最小化至托盘、测试延时、右键菜单
- 检查更新
- ......

其中vmess支持websocket、mKcp
目前程序可能存在一些bug但是没有测试出,若在使用过程中发现bug,请在issue中提交,以便改进。

# Usage

## 安装
## install
```
① 在release中下载最新版本的install.sh
```
```
② 运行 ./install.sh
```

## 更新
## update
```
① 在release中下载最新版本的update.sh
```
```
② 运行 ./update.sh
```

# 首页展示
# Home page

![首页](http://cloud.thinker.ink/images/0bbd5564f4c123f24089d9134bcd6fe0.png)
![首页](http://cloud.thinker.ink/images/f366165b6daced76427a6f8a89cc4168.png)

# License

Expand Down
110 changes: 70 additions & 40 deletions v2rayL-GUI/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,81 @@
# Date: 2019-08-13

conf_template = {
"log":{},
"dns":{},
"stats":{},
"inbounds":[
{
"port":"1080",
"protocol":"socks",
"settings":{
"auth":"noauth",
"udp": True
},
"tag":"in-0"
}
],
"outbounds":[
{
"protocol":"",
"settings":{},
"tag":"out-0",
"streamSettings":{}
},
{
"tag":"direct",
"protocol":"freedom",
"settings":{}
"dns": {
"servers": [
"1.1.1.1"
]
},
"inbounds": [{
"port": 1080,
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": True,
"userLevel": 8
},
"sniffing": {
"destOverride": [
"http",
"tls"
],
"enabled": True
},
"tag": "socks"
},
{
"tag":"blocked",
"protocol":"blackhole",
"settings":{}
"port": 1081,
"protocol": "http",
"settings": {
"userLevel": 8
},
"tag": "http"
}
],
"routing":{
"domainStrategy":"IPOnDemand",
"rules":[
"log": {
"loglevel": "warning"
},
"outbounds": [{
"mux": {
"enabled": False
},
"protocol": "",
"settings": {},
"streamSettings": {},
"tag": "proxy"
},
{
"protocol": "freedom",
"settings": {},
"tag": "direct"
},
{
"type":"field",
"ip":[
"geoip:private"
],
"outboundTag":"direct"
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
},
"tag": "block"
}
]
],
"policy": {
"levels": {
"8": {
"connIdle": 300,
"downlinkOnly": 1,
"handshake": 4,
"uplinkOnly": 1
}
},
"system": {
"statsInboundUplink": True,
"statsInboundDownlink": True
}
},
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": []
},
"policy":{},
"reverse":{},
"transport":{}
"stats": {}
}
53 changes: 40 additions & 13 deletions v2rayL-GUI/sub2conf_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def b642conf(self, prot, tp, b64str):
ret = eval(base64.b64decode(b64str).decode())
region = ret['ps']

elif prot == "ss":
elif prot == "shadowsocks":
string = b64str.split("#")
cf = string[0].split("@")
if len(cf) == 1:
Expand Down Expand Up @@ -75,22 +75,49 @@ def setconf(self, region):
"users": [
{
"id": use_conf["id"],
"alterId": use_conf["aid"]
"alterId": int(use_conf["aid"]),
"security": "auto",
"level": 8,
}
]
})

conf['outbounds'][0]["streamSettings"] = {
"network": use_conf["net"],
"wsSettings": {
"path": use_conf["path"],
"headers": {
"Host": use_conf['host']
# webSocket 协议
if use_conf["net"] == "ws":
conf['outbounds'][0]["streamSettings"] = {
"network": use_conf["net"],
"security": "tls" if use_conf["tls"] else "",
"tlssettings": {
"allowInsecure": True,
"serverName": use_conf["tls"]
},
"wssettings": {
"connectionReuse": True,
"headers": {
"Host": use_conf['host']
},
"path": use_conf["path"]
}
}
}
# mKcp协议
elif use_conf["net"] == "kcp":
conf['outbounds'][0]["streamSettings"] = {
"network": use_conf["net"],
"kcpsettings": {
"congestion": False,
"downlinkCapacity": 100,
"header": {
"type": use_conf["type"] if use_conf["type"] else "none"
},
"mtu": 1350,
"readBufferSize": 1,
"tti": 50,
"uplinkCapacity": 12,
"writeBufferSize": 1
},
"security": ""
}

elif use_conf['prot'] == "ss":
elif use_conf['prot'] == "shadowsocks":
conf['outbounds'][0]["protocol"] = "shadowsocks"
conf['outbounds'][0]["settings"]["servers"] = list()
conf['outbounds'][0]["settings"]["servers"].append({
Expand Down Expand Up @@ -143,7 +170,7 @@ def update(self):
if ori[0] == "vmess":
self.b642conf("vmess", 1, ori[1])
elif ori[0] == "ss":
self.b642conf("ss", 1, ori[1])
self.b642conf("shadowsocks", 1, ori[1])

self.conf = dict(self.saved_conf['local'], **self.saved_conf['subs'])

Expand All @@ -159,7 +186,7 @@ def add_conf_by_uri(self):
if op[0] == "vmess":
self.b642conf("vmess", 0, op[1])
elif op[0] == "ss":
self.b642conf("ss", 0, op[1])
self.b642conf("shadowsocks", 0, op[1])
else:
raise MyException("无法解析的链接格式")
except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion v2rayL-GUI/v2rayL_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def disconnect(self):
else:
raise MyException("服务未开启,无需断开连接.")
except Exception as e:
raise MyException(e)
raise MyException(e.args[0])

def update(self, url):
if url: # 如果存在订阅地址
Expand Down
73 changes: 71 additions & 2 deletions v2rayL-GUI/v2rayL_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
# Date: 2019-08-13

from PyQt5.QtCore import QThread, pyqtSignal
from PyQt5.QtWidgets import QMessageBox
from sub2conf_api import MyException
import subprocess
import requests



class ConnectThread(QThread):
Expand All @@ -23,7 +27,7 @@ def run(self):
try:
row = self.tableView.currentIndex().row()
region = self.tableView.model().item(row, 0).text()
except Exception as e:
except AttributeError:
self.sinOut.emit(("conn", "@@Fail@@", "未选中配置无法连接,请导入配置后再次连接", None))
else:
try:
Expand Down Expand Up @@ -115,5 +119,70 @@ def run(self):
ret = self.v2rayL.ping(addr)
except MyException as e:
self.sinOut.emit(("ping", "@@Fail@@", e.args[0], None))
except AttributeError:
self.sinOut.emit(("ping", "@@Fail@@", "请选择需要测试的配置.", None))
else:
self.sinOut.emit(("ping", "@@OK@@", ret.strip(), None))
self.sinOut.emit(("ping", "@@OK@@", ret.strip(), None))


class CheckUpdateThread(QThread):
"""
测试延时线程
"""
sinOut = pyqtSignal(tuple)

def __init__(self, version=None, parent=None):
super(CheckUpdateThread, self).__init__(parent)
self.version = version

def __del__(self):
# 线程状态改变与线程终止
self.wait()

def run(self):
update_url = "https://api.github.com/repos/jiangxufeng/v2rayL/releases/latest"
try:
req = requests.get(update_url)
if req.status_code != 200:
self.sinOut.emit(("ckud", "@@Fail@@", "网络错误,请检查网络连接或稍后再试.", None))
else:
latest = req.json()['tag_name']
if latest == self.version:
self.sinOut.emit(("ckud", "@@OK@@", "当前版本已是最新版本.", None))
else:
self.sinOut.emit(("ckud", "@@OK@@", "正在后台进行更新..", req))
except Exception as e:
self.sinOut.emit(("ckud", "@@Fail@@", "网络错误,请检查网络连接或稍后再试."+e.args[0], None))


class VersionUpdateThread(QThread):
"""
测试延时线程
"""
sinOut = pyqtSignal(tuple)

def __init__(self, update_url=None, parent=None):
super(VersionUpdateThread, self).__init__(parent)
self.url = update_url

def __del__(self):
# 线程状态改变与线程终止
self.wait()

def run(self):
try:
req = requests.get(self.url)
if req.status_code != 200:
self.sinOut.emit(("vrud", "@@Fail@@", "网络错误,请检查网络连接或稍后再试.", None))
else:
print(1)
with open("/etc/v2rayL/update.sh", 'w') as f:
f.write(req.text)

subprocess.call(["chmod +x /etc/v2rayL/update.sh && /etc/v2rayL/update.sh"], shell=True)

self.sinOut.emit(("vrud", "@@OK@@", "更新完成, 重启程序生效.", None))

except Exception as e:
self.sinOut.emit(("vrud", "@@Fail@@", "网络错误,请检查网络连接或稍后再试."+e.args[0], None))

Loading

0 comments on commit 043ec26

Please sign in to comment.