Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrohy committed Nov 27, 2020
1 parent d6cf5c4 commit 05bd2e5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion v2ray_util/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '3.8.5'
__version__ = '3.8.6'

from .util_core.trans import _
2 changes: 1 addition & 1 deletion v2ray_util/config_modify/multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@restart(True)
def new_port(new_stream=None):
if new_stream not in StreamType._value2member_map_:
if new_stream != None and new_stream not in StreamType._value2member_map_:
print(ColorStr.red("{} not support!".format(new_stream)))
return
new_port = ""
Expand Down
16 changes: 11 additions & 5 deletions v2ray_util/config_modify/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,14 @@ def select(self, sType):
def random_kcp(self):
kcp_list = (StreamType.KCP_SRTP, StreamType.KCP_UTP, StreamType.KCP_WECHAT, StreamType.KCP_DTLS, StreamType.KCP_WG)
choice = random.randint(0, 4)
print("{}: {} \n".format(_("random generate (srtp | wechat-video | utp | dtls | wireguard) fake header, new protocol"), ColorStr.green(kcp_list[choice])))
print("{}: {} \n".format(_("random generate (srtp | wechat-video | utp | dtls | wireguard) fake header, new protocol"), ColorStr.green(kcp_list[choice].value)))
self.select(kcp_list[choice])

@restart()
def modify(group=None, sType=None):
need_restart = False
if group == None:
need_restart = True
gs = GroupSelector(_('modify protocol'))
group = gs.group

Expand All @@ -114,11 +116,14 @@ def modify(group=None, sType=None):
sm = StreamModifier(group.tag, group.index)

if sType != None:
sm.select(sType)
sm.select([v for v in StreamType if v.value == sType][0])
print(_("modify protocol success"))
return True
return

if need_restart:
print("")
print("{}: {}".format(_("group protocol"), group.node_list[0].stream()))

print("{}: {}".format(_("group protocol"), group.node_list[0].stream()))
print("")
for index, stream_type in enumerate(sm.stream_type):
print("{0}.{1}".format(index + 1, stream_type[1]))
Expand All @@ -135,4 +140,5 @@ def modify(group=None, sType=None):
print(_("V2ray MTProto/Shadowsocks not support https, close tls success!"))
sm.select(sm.stream_type[choice - 1][0])
print(_("modify protocol success"))
return True
if need_restart:
return True

0 comments on commit 05bd2e5

Please sign in to comment.