Skip to content

Commit 6603ff4

Browse files
committed
add no headers in tcp stream and fix tcp settings in xray full
1 parent 6ad08da commit 6603ff4

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

hiddifypanel/hutils/proxy/xray.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,12 @@ def to_link(proxy: dict) -> str | dict:
151151
q['core']='xray'
152152
_add_xhttp_extra(q,proxy)
153153
if proxy['l3'] != 'quic':
154-
if proxy.get('l3') != ProxyL3.reality and (proxy.get('transport') in {ProxyTransport.tcp, ProxyTransport.httpupgrade, ProxyTransport.xhttp}) and proxy['proto'] in [ProxyProto.vless, ProxyProto.trojan]:
155-
q['headerType']='http'
156-
else:
154+
if proxy.get('params',{}).get('headers',{}).get("type",'')=='none' or proxy['l3'] != ProxyL3.http:
157155
q['headerType']='none'
158-
156+
else:
157+
# if proxy.get('l3') != ProxyL3.reality and (proxy.get('transport') in {ProxyTransport.tcp, ProxyTransport.httpupgrade, ProxyTransport.xhttp}) and proxy['proto'] in [ProxyProto.vless, ProxyProto.trojan]:
158+
q['headerType']='http'
159+
159160
if proxy['mode'] == 'Fake' or proxy['allow_insecure']:
160161
q['allowInsecure']='true'
161162
q['insecure']='true'

hiddifypanel/hutils/proxy/xrayjson.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -291,32 +291,31 @@ def add_stream_settings(base: dict, proxy: dict):
291291

292292

293293
def add_tcp_stream(ss: dict, proxy: dict):
294-
if proxy['l3'] == ProxyL3.http:
294+
295+
if proxy.get('params',{}).get('headers',{}).get("type",'')=='none' or proxy['l3'] != ProxyL3.http:
296+
ss['tcpSettings'] = {
297+
'header':{'type':'none'}
298+
}
299+
else:
295300
ss['tcpSettings'] = {
296301
'header': {
297302
'type': 'http',
298303
'request': {
299304
'path': [proxy['path']],
300305
'method': 'GET',
301306
"headers": {
302-
"Host": proxy.get('host'),
303-
"User-Agent": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.6478.122 Mobile Safari/537.36",
304-
"Accept-Encoding": "gzip, deflate",
305-
"Connection": "keep-alive",
306-
"Pragma": "no-cache"
307+
"Host": [proxy.get('host')],
308+
"User-Agent": [proxy.get('params',{}).get('headers',{}).get('User-Agent')],
309+
"Accept-Encoding": ["gzip, deflate"],
310+
"Connection": ["keep-alive"],
311+
"Pragma": proxy.get('params',{}).get('headers',{}).get('Pragma')
307312
},
308313

309314
}
310315
}
311316
}
312-
# ss['tcpSettings']['header']['request']['headers']
313-
else:
314-
ss['tcpSettings'] = {
315-
'header': {
316-
'type': 'none'
317-
}
318-
# 'acceptProxyProtocol': False
319-
}
317+
# ss['tcpSettings']['header']['request']['headers']
318+
320319

321320

322321
def add_http_stream(ss: dict, proxy: dict):

0 commit comments

Comments
 (0)