mirror of https://github.com/dnomd343/ProxyC
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1012 B
28 lines
1012 B
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import json
|
|
from Builder import Xray
|
|
from Basis.Exception import buildException
|
|
|
|
|
|
def load(proxyInfo: dict, socksInfo: dict, configFile: str) -> tuple[list, str, dict]:
|
|
if proxyInfo['method'] != 'none':
|
|
raise buildException('Unknown VLESS method')
|
|
outboundConfig = {
|
|
'protocol': 'vless',
|
|
'settings': {
|
|
'vnext': [{
|
|
'address': proxyInfo['server'],
|
|
'port': proxyInfo['port'],
|
|
'users': [{
|
|
'id': proxyInfo['id'],
|
|
'encryption': proxyInfo['method'],
|
|
**Xray.xtlsFlow(proxyInfo['stream']) # add xtls flow option
|
|
}]
|
|
}]
|
|
},
|
|
'streamSettings': Xray.loadStream(proxyInfo['stream'])
|
|
}
|
|
vlessConfig = Xray.loadConfig(socksInfo, outboundConfig) # load config file for xray-core
|
|
return ['xray', '-c', configFile], json.dumps(vlessConfig), {} # command, fileContent, envVar
|
|
|