Skip to content

Commit

Permalink
优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrohy committed Mar 12, 2021
1 parent eb68344 commit 72b704b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions v2ray_util/config_modify/multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ..util_core.v2ray import restart
from ..util_core.loader import Loader
from ..util_core.writer import NodeWriter
from ..util_core.group import Vmess, Socks, Mtproto, SS, Vless, Trojan, Xtls
from ..util_core.group import Vmess, Socks, Mtproto, SS, Vless, Trojan
from ..util_core.selector import GroupSelector, ClientSelector, CommonSelector
from ..util_core.utils import is_email, clean_iptables, random_email, ColorStr, readchar, random_port, port_is_use, xtls_flow, StreamType

Expand Down Expand Up @@ -53,7 +53,7 @@ def new_user():
pass
else:
email = ""
if type(group.node_list[0]) in (Vmess, Vless, Trojan, Xtls):
if type(group.node_list[0]) in (Vmess, Vless, Trojan):
while True:
is_duplicate_email=False
remail = random_email()
Expand Down Expand Up @@ -85,7 +85,7 @@ def new_user():
if password == "":
password = random_pass
info['password'] = password
elif type(group.node_list[0]) == Xtls:
elif type(group.node_list[0]) == Vless and group.tls == "xtls":
flow_list = xtls_flow()
print("")
flow = CommonSelector(flow_list, _("please select xtls flow type: ")).select()
Expand Down
6 changes: 3 additions & 3 deletions v2ray_util/util_core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json

from .config import Config
from .group import Vmess, Vless, Socks, SS, Mtproto, Trojan, Xtls
from .group import Vmess, Vless, Socks, SS, Mtproto, Trojan
from .selector import ClientSelector

class ClientWriter:
Expand Down Expand Up @@ -34,14 +34,14 @@ def transform(self):
user_json["users"][0]["id"] = self.node.password
user_json["users"][0]["alterId"] = self.node.alter_id

elif type(self.node) in (Vless, Xtls):
elif type(self.node) == Vless:
self.client_config = self.load_template('client.json')
user_json = self.client_config["outbounds"][0]["settings"]["vnext"][0]
user_json["users"][0]["id"] = self.node.password
del user_json["users"][0]["alterId"]
del user_json["users"][0]["security"]
user_json["users"][0]["encryption"] = self.node.encryption
if type(self.node) == Xtls:
if self.node.tls == "xtls":
user_json["users"][0]["flow"] = self.node.flow
self.client_config["outbounds"][0]["protocol"] = "vless"

Expand Down
4 changes: 2 additions & 2 deletions v2ray_util/util_core/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from .config import Config
from .utils import StreamType, random_port
from .group import Mtproto, Vmess, Socks, Vless, Trojan, Xtls
from .group import Mtproto, Vmess, Socks, Vless, Trojan

def clean_mtproto_tag(config, group_index):
'''
Expand Down Expand Up @@ -589,7 +589,7 @@ def del_user(self, group, client_index):
if type(node) == Mtproto:
clean_mtproto_tag(self.config, group.index)
del self.config["inbounds"][group.index]
elif type(node) in (Vmess, Socks, Vless, Trojan, Xtls):
elif type(node) in (Vmess, Socks, Vless, Trojan):
client_str = 'accounts' if type(node) == Socks else 'clients'
del self.config["inbounds"][group.index]["settings"][client_str][client_index]

Expand Down

0 comments on commit 72b704b

Please sign in to comment.