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.
100 lines
2.6 KiB
100 lines
2.6 KiB
#!/usr/bin/python
|
|
# -*- coding:utf-8 -*-
|
|
|
|
import copy
|
|
|
|
from ProxyFilter import baseFunc
|
|
from ProxyFilter import V2ray
|
|
|
|
xrayFlowList = [
|
|
'xtls-origin',
|
|
'xtls-direct',
|
|
'xtls-splice',
|
|
]
|
|
|
|
xrayStreamRules = copy.deepcopy(V2ray.v2rayStreamRules)
|
|
xrayStreamRules.pop('secureObject')
|
|
xrayStreamRules['tcpObject']['secure']['type'] = ['tlsObject', 'xtlsObject']
|
|
xrayStreamRules['kcpObject']['secure']['type'] = ['tlsObject', 'xtlsObject']
|
|
xrayStreamRules['wsObject']['secure']['type'] = 'tlsObject'
|
|
xrayStreamRules['h2Object']['secure']['type'] = 'tlsObject'
|
|
xrayStreamRules['quicObject']['secure']['type'] = 'tlsObject'
|
|
xrayStreamRules['grpcObject']['secure']['type'] = 'tlsObject'
|
|
|
|
xrayStreamRules['tlsObject'] = {
|
|
'type': {
|
|
'optional': True,
|
|
'type': str,
|
|
'indexKey': True,
|
|
'format': baseFunc.toStrTidy,
|
|
'filter': lambda secureType: secureType == 'tls',
|
|
'errMsg': 'Unexpected secure type'
|
|
},
|
|
'sni': {
|
|
'optional': False,
|
|
'default': '',
|
|
'type': str,
|
|
'format': baseFunc.toStr
|
|
},
|
|
'alpn': {
|
|
'optional': False,
|
|
'default': None,
|
|
'allowNone': True,
|
|
'type': str,
|
|
'format': baseFunc.toStrTidy,
|
|
'filter': lambda alpn: alpn in ['h2', 'http/1.1', 'h2,http/1.1'],
|
|
'errMsg': 'Illegal alpn option'
|
|
},
|
|
'verify': {
|
|
'optional': False,
|
|
'default': True,
|
|
'type': bool,
|
|
'format': baseFunc.toBool
|
|
}
|
|
}
|
|
|
|
xrayStreamRules['xtlsObject'] = {
|
|
'type': {
|
|
'optional': True,
|
|
'type': str,
|
|
'indexKey': True,
|
|
'format': baseFunc.toStrTidy,
|
|
'filter': lambda secureType: secureType == 'xtls',
|
|
'errMsg': 'Unexpected secure type'
|
|
},
|
|
'sni': {
|
|
'optional': False,
|
|
'default': '',
|
|
'type': str,
|
|
'format': baseFunc.toStr
|
|
},
|
|
'alpn': {
|
|
'optional': False,
|
|
'default': None,
|
|
'allowNone': True,
|
|
'type': str,
|
|
'format': baseFunc.toStrTidy,
|
|
'filter': lambda alpn: alpn in ['h2', 'http/1.1', 'h2,http/1.1'],
|
|
'errMsg': 'Illegal alpn option'
|
|
},
|
|
'verify': {
|
|
'optional': False,
|
|
'default': True,
|
|
'type': bool,
|
|
'format': baseFunc.toBool
|
|
},
|
|
'flow': {
|
|
'optional': False,
|
|
'default': 'xtls-direct',
|
|
'type': str,
|
|
'format': lambda s: baseFunc.toStrTidy(s).replace('_', '-'),
|
|
'filter': lambda flow: flow in xrayFlowList,
|
|
'errMsg': 'Unknown XTLS flow method'
|
|
},
|
|
'udp443': {
|
|
'optional': False,
|
|
'default': False,
|
|
'type': bool,
|
|
'format': baseFunc.toBool
|
|
}
|
|
}
|
|
|