1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-23 17:34:17 +03:00

Added user agent

This commit is contained in:
Adolfo Gómez García 2021-07-01 21:46:00 +02:00
parent 43b785eb73
commit e38cd73f30
2 changed files with 3 additions and 1 deletions

View File

@ -51,6 +51,8 @@ BANDWIDTH_TIME = 10
# Commands LENGTH (all same length) # Commands LENGTH (all same length)
COMMAND_LENGTH = 4 COMMAND_LENGTH = 4
VERSION = 'v1.0'
# Valid commands # Valid commands
COMMAND_OPEN = b'OPEN' COMMAND_OPEN = b'OPEN'
COMMAND_TEST = b'TEST' COMMAND_TEST = b'TEST'

View File

@ -56,7 +56,7 @@ class Proxy:
def _getUdsUrl(cfg: config.ConfigurationType, ticket: bytes, msg: str) -> typing.MutableMapping[str, typing.Any]: def _getUdsUrl(cfg: config.ConfigurationType, ticket: bytes, msg: str) -> typing.MutableMapping[str, typing.Any]:
try: try:
url = cfg.uds_server + '/' + ticket.decode() + '/' + msg + '/' + cfg.uds_token url = cfg.uds_server + '/' + ticket.decode() + '/' + msg + '/' + cfg.uds_token
r = requests.get(url, headers={'content-type': 'application/json'}) r = requests.get(url, headers={'content-type': 'application/json', 'User-Agent': f'UDSTunnel-{consts.VERSION}'})
if not r.ok: if not r.ok:
raise Exception(r.content) raise Exception(r.content)