Skip to content

Commit

Permalink
fix: quic transmission
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintShit committed Jan 4, 2024
1 parent 08e6139 commit 7bd4b10
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
22 changes: 15 additions & 7 deletions app/utils/share.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,20 @@ def vless(cls,
payload = {
"security": tls,
"type": net,
"host": host,
"headerType": type
}
if flow and (tls in ('tls', 'reality') and net in ('tcp', 'kcp') and type != 'http'):
payload['flow'] = flow

if net == 'grpc':
payload['serviceName'] = path
payload["host"] = host
elif net == 'quic':
payload['key'] = path
payload["quicSecurity"] = host
else:
payload["path"] = path
payload["host"] = host

if tls == "tls":
payload["sni"] = sni
Expand Down Expand Up @@ -164,16 +168,20 @@ def trojan(cls,
payload = {
"security": tls,
"type": net,
"host": host,
"headerType": type
}
if flow and (tls in ('tls', 'reality') and net in ('tcp', 'kcp') and type != 'http'):
payload['flow'] = flow

if net == 'grpc':
payload['serviceName'] = path
payload["host"] = host
elif net == 'quic':
payload['key'] = path
payload["quicSecurity"] = host
else:
payload["path"] = path
payload["host"] = host

if tls == "tls":
payload["sni"] = sni
Expand Down Expand Up @@ -255,7 +263,7 @@ def make_node(self,
sni: str,
host: str,
path: str,
headers: str ='',
headers: str = '',
udp: bool = True,
alpn: str = '',
ais: bool = ''):
Expand Down Expand Up @@ -373,7 +381,7 @@ def make_node(self,
sni: str,
host: str,
path: str,
headers: str ='',
headers: str = '',
udp: bool = True,
alpn: str = '',
fp: str = '',
Expand Down Expand Up @@ -635,7 +643,7 @@ def transport_config(transport_type='',

if transport_type:
transport_config['type'] = transport_type

if transport_type == "http":
transport_config['host'] = []
if path:
Expand Down Expand Up @@ -954,9 +962,9 @@ def process_inbounds_and_tags(
salt = secrets.token_hex(8)
address = host['address'].replace('*', salt)
if host["path"] is not None:
path=host["path"].format_map(format_variables)
path = host["path"].format_map(format_variables)
else:
path=inbound.get("path", "").format_map(format_variables)
path = inbound.get("path", "").format_map(format_variables)

host_inbound.update(
{
Expand Down
5 changes: 5 additions & 0 deletions app/xray/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ def _resolve_inbounds(self):
settings['path'] = net_settings.get('serviceName', '')
settings['host'] = []

elif net == 'quic':
settings['header_type'] = net_settings.get('header', {}).get('type', '')
settings['path'] = net_settings.get('key', '')
settings['host'] = [net_settings.get('security', '')]

else:
settings['path'] = net_settings.get('path', '')
host = net_settings.get(
Expand Down

0 comments on commit 7bd4b10

Please sign in to comment.