@@ -117,13 +117,15 @@ def write(self, **kw):
117
117
elif self .part_json ['protocol' ] == 'socks' :
118
118
origin_protocol = StreamType .SOCKS
119
119
elif self .part_json ['protocol' ] == 'vless' :
120
- origin_protocol = StreamType .VLESS
120
+ if self .part_json ["streamSettings" ]["security" ] == "xtls" :
121
+ origin_protocol = StreamType .VLESS_XTLS
122
+ elif self .part_json ["streamSettings" ]["security" ] == "tls" :
123
+ origin_protocol = StreamType .VLESS_TLS
124
+ else :
125
+ origin_protocol = StreamType .VLESS_TCP
121
126
elif self .part_json ['protocol' ] == 'trojan' :
122
127
origin_protocol = StreamType .TROJAN
123
128
124
- if origin_protocol == StreamType .VLESS and self .part_json ["streamSettings" ]["security" ] == "xtls" :
125
- origin_protocol = StreamType .VLESS_XTLS
126
-
127
129
if origin_protocol != StreamType .MTPROTO and origin_protocol != StreamType .SS :
128
130
security_backup = self .part_json ["streamSettings" ]["security" ]
129
131
if origin_protocol == StreamType .VLESS_XTLS :
@@ -138,7 +140,7 @@ def write(self, **kw):
138
140
clean_mtproto_tag (self .config , self .group_index )
139
141
140
142
#原来是socks/mtproto/shadowsocks/vless/trojan/xtls协议 则先切换为标准的inbound
141
- if origin_protocol in (StreamType .MTPROTO , StreamType .SOCKS , StreamType .SS , StreamType .VLESS , StreamType .TROJAN , StreamType .VLESS_XTLS ):
143
+ if origin_protocol in (StreamType .MTPROTO , StreamType .SOCKS , StreamType .SS , StreamType .VLESS_TLS , StreamType . VLESS_TCP , StreamType .TROJAN , StreamType .VLESS_XTLS ):
142
144
vmess = self .load_template ('server.json' )
143
145
vmess ["inbounds" ][0 ]["port" ] = self .part_json ["port" ]
144
146
if "allocate" in self .part_json :
@@ -213,7 +215,7 @@ def write(self, **kw):
213
215
ws ["wsSettings" ]["headers" ]["Host" ] = kw ['host' ]
214
216
self .part_json ["streamSettings" ] = ws
215
217
216
- elif self .stream_type in (StreamType .VLESS , StreamType .VLESS_XTLS , StreamType .VLESS_WS ):
218
+ elif self .stream_type in (StreamType .VLESS_TCP , StreamType . VLESS_TLS , StreamType .VLESS_XTLS , StreamType .VLESS_WS ):
217
219
vless = self .load_template ('vless.json' )
218
220
vless ["clients" ][0 ]["id" ] = str (uuid .uuid1 ())
219
221
if self .stream_type == StreamType .VLESS_XTLS :
@@ -233,16 +235,17 @@ def write(self, **kw):
233
235
self .save ()
234
236
alpn = ["http/1.1" ]
235
237
# tls的设置
236
- if not "certificates" in tls_settings_backup :
237
- from ..config_modify .tls import TLSModifier
238
- if self .stream_type == StreamType .VLESS_XTLS :
239
- tm = TLSModifier (self .group_tag , self .group_index , alpn = alpn , xtls = True )
240
- else :
241
- tm = TLSModifier (self .group_tag , self .group_index , alpn = alpn )
242
- tm .turn_on (False )
243
- return
244
- elif not "alpn" in tls_settings_backup :
245
- tls_settings_backup ["alpn" ] = alpn
238
+ if self .stream_type != StreamType .VLESS_TCP :
239
+ if not "certificates" in tls_settings_backup :
240
+ from ..config_modify .tls import TLSModifier
241
+ if self .stream_type == StreamType .VLESS_XTLS :
242
+ tm = TLSModifier (self .group_tag , self .group_index , alpn = alpn , xtls = True )
243
+ else :
244
+ tm = TLSModifier (self .group_tag , self .group_index , alpn = alpn )
245
+ tm .turn_on (False )
246
+ return
247
+ elif not "alpn" in tls_settings_backup :
248
+ tls_settings_backup ["alpn" ] = alpn
246
249
247
250
elif self .stream_type == StreamType .TROJAN :
248
251
self .part_json ['protocol' ] = "trojan"
@@ -296,7 +299,8 @@ def write(self, **kw):
296
299
if domain :
297
300
self .part_json ["domain" ] = domain
298
301
299
- if origin_protocol in (StreamType .VLESS , StreamType .TROJAN , StreamType .VLESS_XTLS ) and self .stream_type not in (StreamType .VLESS , StreamType .TROJAN , StreamType .VLESS_XTLS ):
302
+ apln_list = (StreamType .VLESS_TLS , StreamType .VLESS_TCP , StreamType .TROJAN , StreamType .VLESS_XTLS )
303
+ if origin_protocol in apln_list and self .stream_type not in apln_list :
300
304
if "alpn" in self .part_json ["streamSettings" ]["tlsSettings" ]:
301
305
del self .part_json ["streamSettings" ]["tlsSettings" ]["alpn" ]
302
306
0 commit comments