hiddifypanel 10.11.0__py3-none-any.whl → 10.12.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hiddifypanel/VERSION +1 -1
- hiddifypanel/VERSION.py +2 -2
- hiddifypanel/auth.py +15 -5
- hiddifypanel/hutils/encode.py +0 -1
- hiddifypanel/hutils/proxy/__init__.py +1 -0
- hiddifypanel/hutils/proxy/shared.py +20 -10
- hiddifypanel/hutils/proxy/singbox.py +47 -46
- hiddifypanel/hutils/proxy/xray.py +39 -23
- hiddifypanel/hutils/proxy/xrayjson.py +391 -0
- hiddifypanel/hutils/random.py +4 -0
- hiddifypanel/models/config.py +7 -2
- hiddifypanel/models/config_enum.py +9 -5
- hiddifypanel/panel/admin/DomainAdmin.py +3 -2
- hiddifypanel/panel/admin/SettingAdmin.py +22 -11
- hiddifypanel/panel/admin/templates/model/user_list.html +44 -20
- hiddifypanel/panel/commercial/restapi/v1/tgmsg.py +14 -10
- hiddifypanel/panel/commercial/restapi/v2/user/apps_api.py +17 -23
- hiddifypanel/panel/common_bp/login.py +2 -2
- hiddifypanel/panel/init_db.py +1 -1
- hiddifypanel/panel/user/templates/base_xray_config.json.j2 +125 -0
- hiddifypanel/panel/user/user.py +9 -1
- hiddifypanel/static/images/hiddify.png +0 -0
- hiddifypanel/static/images/hiddify1.png +0 -0
- hiddifypanel/static/new/assets/hiddify-logo-7617d937.png +0 -0
- hiddifypanel/static/new/assets/hiddify-logo-7617d937_old.png +0 -0
- hiddifypanel/templates/admin-layout.html +22 -11
- hiddifypanel/templates/master.html +48 -25
- hiddifypanel/translations/en/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/en/LC_MESSAGES/messages.po +28 -22
- hiddifypanel/translations/fa/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/fa/LC_MESSAGES/messages.po +15 -11
- hiddifypanel/translations/pt/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/pt/LC_MESSAGES/messages.po +8 -8
- hiddifypanel/translations/ru/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/ru/LC_MESSAGES/messages.po +111 -53
- hiddifypanel/translations/zh/LC_MESSAGES/messages.mo +0 -0
- hiddifypanel/translations/zh/LC_MESSAGES/messages.po +108 -58
- hiddifypanel/translations.i18n/en.json +18 -17
- hiddifypanel/translations.i18n/fa.json +7 -6
- hiddifypanel/translations.i18n/pt.json +3 -2
- hiddifypanel/translations.i18n/ru.json +53 -52
- hiddifypanel/translations.i18n/zh.json +58 -57
- {hiddifypanel-10.11.0.dist-info → hiddifypanel-10.12.0.dist-info}/METADATA +1 -1
- {hiddifypanel-10.11.0.dist-info → hiddifypanel-10.12.0.dist-info}/RECORD +48 -44
- {hiddifypanel-10.11.0.dist-info → hiddifypanel-10.12.0.dist-info}/LICENSE.md +0 -0
- {hiddifypanel-10.11.0.dist-info → hiddifypanel-10.12.0.dist-info}/WHEEL +0 -0
- {hiddifypanel-10.11.0.dist-info → hiddifypanel-10.12.0.dist-info}/entry_points.txt +0 -0
- {hiddifypanel-10.11.0.dist-info → hiddifypanel-10.12.0.dist-info}/top_level.txt +0 -0
hiddifypanel/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
10.
|
1
|
+
10.12.0
|
hiddifypanel/VERSION.py
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
__version__='10.
|
1
|
+
__version__='10.12.0'
|
2
2
|
from datetime import datetime
|
3
|
-
__release_date__= datetime.strptime('2024-03-
|
3
|
+
__release_date__= datetime.strptime('2024-03-19','%Y-%m-%d')
|
hiddifypanel/auth.py
CHANGED
@@ -143,9 +143,11 @@ def auth_before_request():
|
|
143
143
|
# print(account)
|
144
144
|
if not account:
|
145
145
|
return logout_redirect()
|
146
|
-
|
147
|
-
|
148
|
-
|
146
|
+
if is_admin_path:
|
147
|
+
next_url = request.url
|
148
|
+
next_url = next_url.replace(f'/{g.uuid}/', '/admin/')
|
149
|
+
next_url = next_url.replace("/admin/admin/", '/admin/')
|
150
|
+
next_url = next_url.replace("http://", "https://")
|
149
151
|
|
150
152
|
elif apikey := request.headers.get("Hiddify-API-Key"):
|
151
153
|
account = get_account_by_api_key(apikey, is_admin_path)
|
@@ -180,8 +182,16 @@ def auth_before_request():
|
|
180
182
|
g.is_admin = hutils.flask.is_admin_role(account.role) # type: ignore
|
181
183
|
login_user(account, force=True)
|
182
184
|
# print("loggining in")
|
183
|
-
if
|
184
|
-
return
|
185
|
+
if not g.is_admin:
|
186
|
+
return
|
187
|
+
if next_url is None:
|
188
|
+
return
|
189
|
+
if not g.user_agent['is_browser']:
|
190
|
+
return
|
191
|
+
if ".webmanifest" in request.path:
|
192
|
+
return
|
193
|
+
|
194
|
+
return redirect(next_url)
|
185
195
|
|
186
196
|
|
187
197
|
def logout_redirect():
|
hiddifypanel/hutils/encode.py
CHANGED
@@ -259,6 +259,11 @@ def make_proxy(hconfigs: dict, proxy: Proxy, domain_db: Domain, phttp=80, ptls=4
|
|
259
259
|
}
|
260
260
|
if proxy.proto in ['tuic', 'hysteria2']:
|
261
261
|
base['alpn'] = "h3"
|
262
|
+
if proxy.proto == 'hysteria2':
|
263
|
+
base['hysteria_up_mbps'] = hconfigs.get(ConfigEnum.hysteria_up_mbps)
|
264
|
+
base['hysteria_down_mbps'] = hconfigs.get(ConfigEnum.hysteria_down_mbps)
|
265
|
+
base['hysteria_obfs_enable'] = hconfigs.get(ConfigEnum.hysteria_obfs_enable)
|
266
|
+
base['hysteria_obfs_password'] = hconfigs.get(ConfigEnum.proxy_path) # TODO: it should not be correct
|
262
267
|
return base
|
263
268
|
if proxy.proto in ['wireguard']:
|
264
269
|
base['wg_pub'] = g.account.wg_pub
|
@@ -317,6 +322,8 @@ def make_proxy(hconfigs: dict, proxy: Proxy, domain_db: Domain, phttp=80, ptls=4
|
|
317
322
|
base['cipher'] = hconfigs[ConfigEnum.shadowsocks2022_method]
|
318
323
|
base['password'] = f'{hutils.encode.do_base_64(hconfigs[ConfigEnum.shared_secret].replace("-",""))}:{hutils.encode.do_base_64(g.account.uuid.replace("-",""))}'
|
319
324
|
|
325
|
+
if base['proto'] == 'trojan':
|
326
|
+
base['password'] = base['uuid']
|
320
327
|
if base["proto"] == "ssr":
|
321
328
|
base["ssr-obfs"] = "tls1.2_ticket_auth"
|
322
329
|
base["ssr-protocol"] = "auth_sha1_v4"
|
@@ -341,20 +348,18 @@ def make_proxy(hconfigs: dict, proxy: Proxy, domain_db: Domain, phttp=80, ptls=4
|
|
341
348
|
|
342
349
|
if proxy.proto in {'vless', 'trojan', 'vmess'} and hconfigs.get(ConfigEnum.mux_enable):
|
343
350
|
if hconfigs[ConfigEnum.mux_enable]:
|
344
|
-
base['mux_enable'] =
|
345
|
-
base['mux_protocol'] = hconfigs[ConfigEnum.mux_protocol]
|
346
|
-
base['mux_max_connections'] = hconfigs[ConfigEnum.mux_max_connections]
|
347
|
-
base['mux_min_streams'] = hconfigs[ConfigEnum.mux_min_streams]
|
348
|
-
base['mux_max_streams'] = hconfigs[ConfigEnum.mux_max_streams]
|
349
|
-
base['mux_padding_enable'] = hconfigs[ConfigEnum.mux_padding_enable]
|
351
|
+
base['mux_enable'] = hconfigs[ConfigEnum.core_type]
|
350
352
|
|
351
|
-
|
352
|
-
base['
|
353
|
+
base['mux_protocol'] = hconfigs.get(ConfigEnum.mux_protocol, "h2mux")
|
354
|
+
base['mux_max_connections'] = hconfigs.get(ConfigEnum.mux_max_connections, 0)
|
355
|
+
base['mux_min_streams'] = hconfigs.get(ConfigEnum.mux_min_streams, 0)
|
356
|
+
base['mux_max_streams'] = hconfigs.get(ConfigEnum.mux_max_streams, 0)
|
357
|
+
base['mux_padding_enable'] = hconfigs.get(ConfigEnum.mux_padding_enable)
|
353
358
|
|
354
359
|
if hconfigs[ConfigEnum.mux_brutal_enable]:
|
355
360
|
base['mux_brutal_enable'] = True
|
356
|
-
base['mux_brutal_up_mbps'] = hconfigs
|
357
|
-
base['mux_brutal_down_mbps'] = hconfigs
|
361
|
+
base['mux_brutal_up_mbps'] = hconfigs.get(ConfigEnum.mux_brutal_up_mbps, 10)
|
362
|
+
base['mux_brutal_down_mbps'] = hconfigs.get(ConfigEnum.mux_brutal_down_mbps, 10)
|
358
363
|
|
359
364
|
if is_cdn and proxy.proto in {'vless', 'trojan', "vmess"}:
|
360
365
|
if hconfigs[ConfigEnum.tls_fragment_enable]:
|
@@ -364,6 +369,11 @@ def make_proxy(hconfigs: dict, proxy: Proxy, domain_db: Domain, phttp=80, ptls=4
|
|
364
369
|
|
365
370
|
if hconfigs[ConfigEnum.tls_mixed_case]:
|
366
371
|
base["tls_mixed_case"] = hconfigs[ConfigEnum.tls_mixed_case]
|
372
|
+
base['host'] = hutils.random.random_case(base['host'])
|
373
|
+
base['sni'] = hutils.random.random_case(base['sni'])
|
374
|
+
base['server'] = hutils.random.random_case(base['server'])
|
375
|
+
if base.get('fakedomain'):
|
376
|
+
base['fakedomain'] = hutils.random.random_case(base['fakedomain'])
|
367
377
|
|
368
378
|
if hconfigs[ConfigEnum.tls_padding_enable]:
|
369
379
|
base["tls_padding_enable"] = hconfigs[ConfigEnum.tls_padding_enable]
|
@@ -2,11 +2,11 @@ from flask import render_template, request, g
|
|
2
2
|
import json
|
3
3
|
|
4
4
|
from hiddifypanel import hutils
|
5
|
-
from hiddifypanel.models import ProxyProto, ProxyTransport, Domain, ConfigEnum
|
5
|
+
from hiddifypanel.models import ProxyProto, ProxyTransport, Domain, ConfigEnum
|
6
6
|
from hiddifypanel.panel.hiddify import is_hiddify_next_version
|
7
7
|
|
8
8
|
|
9
|
-
def
|
9
|
+
def configs_as_json(domains: list[Domain], **kwargs) -> str:
|
10
10
|
ua = hutils.flask.get_user_agent()
|
11
11
|
base_config = json.loads(render_template('base_singbox_config.json.j2'))
|
12
12
|
allphttp = [p for p in request.args.get("phttp", "").split(',') if p]
|
@@ -60,32 +60,32 @@ def to_singbox(proxy: dict) -> list[dict] | dict:
|
|
60
60
|
base["server_port"] = int(proxy["port"])
|
61
61
|
# base['alpn'] = proxy['alpn'].split(',')
|
62
62
|
if proxy["proto"] == "ssr":
|
63
|
-
|
63
|
+
add_ssr(base, proxy)
|
64
64
|
return all_base
|
65
65
|
if proxy["proto"] == ProxyProto.wireguard:
|
66
|
-
|
66
|
+
add_wireguard(base, proxy)
|
67
67
|
return all_base
|
68
68
|
|
69
69
|
if proxy["proto"] in ["ss", "v2ray"]:
|
70
|
-
|
70
|
+
add_shadowsocks_base(all_base, proxy)
|
71
71
|
return all_base
|
72
72
|
if proxy["proto"] == "ssh":
|
73
|
-
|
73
|
+
add_ssh(all_base, proxy)
|
74
74
|
return all_base
|
75
75
|
|
76
76
|
if proxy["proto"] == "trojan":
|
77
|
-
base["password"] = proxy["
|
77
|
+
base["password"] = proxy["password"]
|
78
78
|
|
79
79
|
if proxy['proto'] in ['vmess', 'vless']:
|
80
80
|
base["uuid"] = proxy["uuid"]
|
81
81
|
|
82
82
|
if proxy['proto'] in ['vmess', 'vless', 'trojan']:
|
83
|
-
|
83
|
+
add_multiplex(base, proxy)
|
84
84
|
|
85
|
-
|
85
|
+
add_tls(base, proxy)
|
86
86
|
|
87
87
|
if g.user_agent.get('is_hiddify'):
|
88
|
-
|
88
|
+
add_tls_tricks(base, proxy)
|
89
89
|
|
90
90
|
if proxy.get('flow'):
|
91
91
|
base["flow"] = proxy['flow']
|
@@ -100,51 +100,52 @@ def to_singbox(proxy: dict) -> list[dict] | dict:
|
|
100
100
|
base["packet_encoding"] = "xudp" # udp packet encoding
|
101
101
|
|
102
102
|
if proxy["proto"] == "tuic":
|
103
|
-
|
103
|
+
add_tuic(base, proxy)
|
104
104
|
elif proxy["proto"] == "hysteria2":
|
105
|
-
|
105
|
+
add_hysteria(base, proxy)
|
106
106
|
else:
|
107
|
-
|
107
|
+
add_transport(base, proxy)
|
108
108
|
|
109
109
|
return all_base
|
110
110
|
|
111
111
|
|
112
|
-
def
|
113
|
-
if
|
112
|
+
def add_multiplex(base: dict, proxy: dict):
|
113
|
+
if proxy.get('mux_enable') != "singbox":
|
114
114
|
return
|
115
115
|
base['multiplex'] = {
|
116
116
|
"enabled": True,
|
117
|
-
"protocol":
|
118
|
-
"padding":
|
117
|
+
"protocol": proxy['mux_protocol'],
|
118
|
+
"padding": proxy['mux_padding_enable']
|
119
119
|
}
|
120
120
|
# Conflicts: max_streams with max_connections and min_streams
|
121
|
-
mux_max_streams =
|
121
|
+
mux_max_streams = proxy.get('mux_max_streams', 0)
|
122
122
|
if mux_max_streams and mux_max_streams != 0:
|
123
123
|
base['multiplex']['max_streams'] = mux_max_streams
|
124
124
|
else:
|
125
|
-
base['multiplex']['max_connections'] =
|
126
|
-
base['multiplex']['min_streams'] =
|
125
|
+
base['multiplex']['max_connections'] = proxy.get('mux_max_connections', 0)
|
126
|
+
base['multiplex']['min_streams'] = proxy.get('mux_min_streams', 0)
|
127
127
|
|
128
|
-
|
128
|
+
add_tcp_brutal(base,proxy)
|
129
129
|
|
130
130
|
|
131
|
-
def
|
131
|
+
def add_tcp_brutal(base: dict, proxy: dict):
|
132
132
|
if 'multiplex' in base:
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
133
|
+
if proxy.get('mux_brutal_enable'):
|
134
|
+
base['multiplex']['brutal'] = {
|
135
|
+
"enabled": proxy.get('mux_brutal_enable', False),
|
136
|
+
"up_mbps": proxy.get('mux_brutal_up_mbps', 10),
|
137
|
+
"down_mbps": proxy.get('mux_brutal_down_mbps', 10)
|
138
|
+
}
|
138
139
|
|
139
140
|
|
140
|
-
def
|
141
|
+
def add_udp_over_tcp(base: dict):
|
141
142
|
base['udp_over_tcp'] = {
|
142
143
|
"enabled": True,
|
143
144
|
"version": 2
|
144
145
|
}
|
145
146
|
|
146
147
|
|
147
|
-
def
|
148
|
+
def add_tls(base: dict, proxy: dict):
|
148
149
|
if not ("tls" in proxy["l3"] or "reality" in proxy["l3"]):
|
149
150
|
return
|
150
151
|
base["tls"] = {
|
@@ -170,7 +171,7 @@ def add_singbox_tls(base: dict, proxy: dict):
|
|
170
171
|
# }
|
171
172
|
|
172
173
|
|
173
|
-
def
|
174
|
+
def add_tls_tricks(base: dict, proxy: dict):
|
174
175
|
if proxy.get('tls_fragment_enable'):
|
175
176
|
base['tls_fragment'] = {
|
176
177
|
'enabled': True,
|
@@ -188,7 +189,7 @@ def add_singbox_tls_tricks(base: dict, proxy: dict):
|
|
188
189
|
base['tls']['tls_tricks']['mixedcase_sni'] = True
|
189
190
|
|
190
191
|
|
191
|
-
def
|
192
|
+
def add_transport(base: dict, proxy: dict):
|
192
193
|
if proxy['l3'] == 'reality' and proxy['transport'] not in ["grpc"]:
|
193
194
|
return
|
194
195
|
base["transport"] = {}
|
@@ -213,10 +214,10 @@ def add_singbox_transport(base: dict, proxy: dict):
|
|
213
214
|
base["transport"] = {
|
214
215
|
"type": "http",
|
215
216
|
"path": proxy.get("path", ""),
|
216
|
-
# "method": "",
|
217
|
-
# "headers": {},
|
218
217
|
"idle_timeout": "15s",
|
219
218
|
"ping_timeout": "15s"
|
219
|
+
# "method": "",
|
220
|
+
# "headers": {},
|
220
221
|
}
|
221
222
|
|
222
223
|
if 'host' in proxy:
|
@@ -232,7 +233,7 @@ def add_singbox_transport(base: dict, proxy: dict):
|
|
232
233
|
}
|
233
234
|
|
234
235
|
|
235
|
-
def
|
236
|
+
def add_ssr(base: dict, proxy: dict):
|
236
237
|
|
237
238
|
base["method"] = proxy["cipher"]
|
238
239
|
base["password"] = proxy["uuid"]
|
@@ -242,7 +243,7 @@ def add_singbox_ssr(base: dict, proxy: dict):
|
|
242
243
|
base["protocol-param"] = proxy["fakedomain"]
|
243
244
|
|
244
245
|
|
245
|
-
def
|
246
|
+
def add_wireguard(base: dict, proxy: dict):
|
246
247
|
|
247
248
|
base["local_address"] = f'{proxy["wg_ipv4"]}/32'
|
248
249
|
base["private_key"] = proxy["wg_pk"]
|
@@ -255,13 +256,13 @@ def add_singbox_wireguard(base: dict, proxy: dict):
|
|
255
256
|
base["fake_packets"] = proxy["wg_noise_trick"]
|
256
257
|
|
257
258
|
|
258
|
-
def
|
259
|
+
def add_shadowsocks_base(all_base: list[dict], proxy: dict):
|
259
260
|
base = all_base[0]
|
260
261
|
base["type"] = "shadowsocks"
|
261
262
|
base["method"] = proxy["cipher"]
|
262
263
|
base["password"] = proxy["password"]
|
263
|
-
|
264
|
-
|
264
|
+
add_udp_over_tcp(base)
|
265
|
+
add_multiplex(base, proxy)
|
265
266
|
if proxy["transport"] == "faketls":
|
266
267
|
base["plugin"] = "obfs-local"
|
267
268
|
base["plugin_opts"] = f'obfs=tls;obfs-host={proxy["fakedomain"]}'
|
@@ -290,13 +291,13 @@ def add_singbox_shadowsocks_base(all_base: list[dict], proxy: dict):
|
|
290
291
|
# "alpn": proxy['alpn'].split(',')
|
291
292
|
}
|
292
293
|
}
|
293
|
-
#
|
294
|
+
# add_utls(shadowtls_base)
|
294
295
|
del base['server']
|
295
296
|
del base['server_port']
|
296
297
|
all_base.append(shadowtls_base)
|
297
298
|
|
298
299
|
|
299
|
-
def
|
300
|
+
def add_ssh(all_base: list[dict], proxy: dict):
|
300
301
|
base = all_base[0]
|
301
302
|
# base["client_version"]= "{{ssh_client_version}}"
|
302
303
|
base["user"] = proxy['uuid']
|
@@ -317,7 +318,7 @@ def add_singbox_ssh(all_base: list[dict], proxy: dict):
|
|
317
318
|
all_base.append(socks_front)
|
318
319
|
|
319
320
|
|
320
|
-
def
|
321
|
+
def add_tuic(base: dict, proxy: dict):
|
321
322
|
base['congestion_control'] = "cubic"
|
322
323
|
base['udp_relay_mode'] = 'native'
|
323
324
|
base['zero_rtt_handshake'] = True
|
@@ -326,13 +327,13 @@ def add_singbox_tuic(base: dict, proxy: dict):
|
|
326
327
|
base['uuid'] = proxy['uuid']
|
327
328
|
|
328
329
|
|
329
|
-
def
|
330
|
-
base['up_mbps'] =
|
331
|
-
base['down_mbps'] =
|
330
|
+
def add_hysteria(base: dict, proxy: dict):
|
331
|
+
base['up_mbps'] = proxy.get(ConfigEnum.hysteria_up_mbps)
|
332
|
+
base['down_mbps'] = proxy.get(ConfigEnum.hysteria_down_mbps)
|
332
333
|
# TODO: check the obfs should be empty or not exists at all
|
333
|
-
if
|
334
|
+
if proxy.get('hysteria_obfs_enable'):
|
334
335
|
base['obfs'] = {
|
335
336
|
"type": "salamander",
|
336
|
-
"password":
|
337
|
+
"password": proxy.get('hysteria_obfs_password')
|
337
338
|
}
|
338
339
|
base['password'] = proxy['uuid']
|
@@ -1,10 +1,23 @@
|
|
1
1
|
import datetime
|
2
2
|
import json
|
3
|
-
|
3
|
+
import copy
|
4
|
+
from flask import render_template, request, g
|
4
5
|
from hiddifypanel import hutils
|
5
|
-
from hiddifypanel.models import Proxy, ProxyTransport, ProxyL3, ProxyCDN, ProxyProto, Domain,
|
6
|
+
from hiddifypanel.models import Proxy, ProxyTransport, ProxyL3, ProxyCDN, ProxyProto, Domain, ConfigEnum, DomainType, hconfig
|
6
7
|
from flask_babel import gettext as _
|
7
8
|
|
9
|
+
OUTBOUND_LEVEL = 8
|
10
|
+
|
11
|
+
|
12
|
+
def is_muxable_agent(proxy: dict) -> bool:
|
13
|
+
if not proxy.get('mux_enable'):
|
14
|
+
return False
|
15
|
+
if proxy.get('mux_enable') == "xray" and g.user_agent.get('is_singbox'):
|
16
|
+
return False
|
17
|
+
if proxy.get('mux_enable') == "singbox" and not g.user_agent.get('is_singbox'):
|
18
|
+
return False
|
19
|
+
return True
|
20
|
+
|
8
21
|
|
9
22
|
def to_link(proxy: dict) -> str | dict:
|
10
23
|
if 'error' in proxy:
|
@@ -35,6 +48,7 @@ def to_link(proxy: dict) -> str | dict:
|
|
35
48
|
"sni": proxy["sni"],
|
36
49
|
"fp": proxy["fingerprint"]
|
37
50
|
}
|
51
|
+
|
38
52
|
if 'reality' in proxy["l3"]:
|
39
53
|
vmess_data['tls'] = "reality"
|
40
54
|
vmess_data['pbk'] = proxy['reality_pbk']
|
@@ -74,7 +88,7 @@ def to_link(proxy: dict) -> str | dict:
|
|
74
88
|
baseurl += "&allow_insecure=1"
|
75
89
|
return f"{baseurl}#{name_link}"
|
76
90
|
if proxy['proto'] == 'hysteria2':
|
77
|
-
baseurl = f'hysteria2://{proxy["uuid"]}@{proxy["server"]}:{proxy["port"]}?hiddify=1&obfs=salamander&obfs-password={
|
91
|
+
baseurl = f'hysteria2://{proxy["uuid"]}@{proxy["server"]}:{proxy["port"]}?hiddify=1&obfs=salamander&obfs-password={proxy["hysteria_obfs_password"]}&sni={proxy["sni"]}'
|
78
92
|
if proxy['mode'] == 'Fake' or proxy['allow_insecure']:
|
79
93
|
baseurl += "&insecure=1"
|
80
94
|
return f"{baseurl}#{name_link}"
|
@@ -180,12 +194,6 @@ def make_v2ray_configs(user, user_activate, domains: list[Domain], expire_days,
|
|
180
194
|
return "\n".join(res)
|
181
195
|
|
182
196
|
|
183
|
-
def add_tls_tricks_to_link(proxy: dict) -> str:
|
184
|
-
out = {}
|
185
|
-
add_tls_tricks_to_dict(out, proxy)
|
186
|
-
return hutils.encode.convert_dict_to_url(out)
|
187
|
-
|
188
|
-
|
189
197
|
def add_tls_tricks_to_dict(d: dict, proxy: dict):
|
190
198
|
if proxy.get('tls_fragment_enable'):
|
191
199
|
if g.user_agent.get('is_shadowrocket'):
|
@@ -199,21 +207,29 @@ def add_tls_tricks_to_dict(d: dict, proxy: dict):
|
|
199
207
|
d['padsize'] = proxy["tls_padding_length"]
|
200
208
|
|
201
209
|
|
202
|
-
def
|
210
|
+
def add_mux_to_dict(d: dict, proxy):
|
211
|
+
if not is_muxable_agent(proxy):
|
212
|
+
return
|
213
|
+
|
214
|
+
# according to github.com/hiddify/ray2sing/
|
215
|
+
d['muxtype'] = proxy["mux_protocol"]
|
216
|
+
d['muxmaxc'] = proxy["mux_max_connections"]
|
217
|
+
d['mux'] = proxy['mux_min_streams']
|
218
|
+
d['muxsmax'] = proxy["mux_max_streams"]
|
219
|
+
d['muxpad'] = proxy["mux_padding_enable"]
|
220
|
+
|
221
|
+
if proxy.get('mux_brutal_enable'):
|
222
|
+
d['muxup'] = proxy["mux_brutal_up_mbps"]
|
223
|
+
d['muxdown'] = proxy["mux_brutal_down_mbps"]
|
224
|
+
|
225
|
+
|
226
|
+
def add_tls_tricks_to_link(proxy: dict) -> str:
|
203
227
|
out = {}
|
204
|
-
|
228
|
+
add_tls_tricks_to_dict(out, proxy)
|
205
229
|
return hutils.encode.convert_dict_to_url(out)
|
206
230
|
|
207
231
|
|
208
|
-
def
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
d['muxmaxc'] = proxy["mux_max_connections"]
|
213
|
-
d['mux'] = proxy['mux_min_streams']
|
214
|
-
d['muxsmax'] = proxy["mux_max_streams"]
|
215
|
-
d['muxpad'] = proxy["mux_padding_enable"]
|
216
|
-
|
217
|
-
if proxy.get('mux_brutal_enable'):
|
218
|
-
d['muxup'] = proxy["mux_brutal_up_mbps"]
|
219
|
-
d['muxdown'] = proxy["mux_brutal_down_mbps"]
|
232
|
+
def add_mux_to_link(proxy: dict) -> str:
|
233
|
+
out = {}
|
234
|
+
add_mux_to_dict(out, proxy)
|
235
|
+
return hutils.encode.convert_dict_to_url(out)
|