Connection string support for XRay protocol (#777)
* Connection string support for XRay protocol
This commit is contained in:
parent
d8020878d5
commit
e6ee9085a2
39 changed files with 20709 additions and 11 deletions
|
@ -72,6 +72,8 @@ QMap<amnezia::Proto, QString> ProtocolProps::protocolHumanNames()
|
|||
{ Proto::Ikev2, "IKEv2" },
|
||||
{ Proto::L2tp, "L2TP" },
|
||||
{ Proto::Xray, "XRay" },
|
||||
{ Proto::SSXray, "ShadowSocks"},
|
||||
|
||||
|
||||
{ Proto::TorWebSite, "Website in Tor network" },
|
||||
{ Proto::Dns, "DNS Service" },
|
||||
|
@ -87,6 +89,8 @@ amnezia::ServiceType ProtocolProps::protocolService(Proto p)
|
|||
{
|
||||
switch (p) {
|
||||
case Proto::Any: return ServiceType::None;
|
||||
case Proto::SSXray: return ServiceType::None;
|
||||
|
||||
case Proto::OpenVpn: return ServiceType::Vpn;
|
||||
case Proto::Cloak: return ServiceType::Vpn;
|
||||
case Proto::ShadowSocks: return ServiceType::Vpn;
|
||||
|
@ -160,7 +164,7 @@ TransportProto ProtocolProps::defaultTransportProto(Proto p)
|
|||
case Proto::Any: return TransportProto::Udp;
|
||||
case Proto::OpenVpn: return TransportProto::Udp;
|
||||
case Proto::Cloak: return TransportProto::Tcp;
|
||||
case Proto::ShadowSocks: return TransportProto::Tcp;
|
||||
case Proto::ShadowSocks: return TransportProto::TcpAndUdp;
|
||||
case Proto::WireGuard: return TransportProto::Udp;
|
||||
case Proto::Awg: return TransportProto::Udp;
|
||||
case Proto::Ikev2: return TransportProto::Udp;
|
||||
|
|
|
@ -83,6 +83,7 @@ namespace amnezia
|
|||
constexpr char sftp[] = "sftp";
|
||||
constexpr char awg[] = "awg";
|
||||
constexpr char xray[] = "xray";
|
||||
constexpr char ssxray[] = "ssxray";
|
||||
|
||||
constexpr char configVersion[] = "config_version";
|
||||
|
||||
|
@ -223,7 +224,8 @@ namespace amnezia
|
|||
|
||||
enum TransportProto {
|
||||
Udp,
|
||||
Tcp
|
||||
Tcp,
|
||||
TcpAndUdp
|
||||
};
|
||||
Q_ENUM_NS(TransportProto)
|
||||
|
||||
|
@ -237,6 +239,7 @@ namespace amnezia
|
|||
Ikev2,
|
||||
L2tp,
|
||||
Xray,
|
||||
SSXray,
|
||||
|
||||
// non-vpn
|
||||
TorWebSite,
|
||||
|
|
|
@ -116,6 +116,7 @@ VpnProtocol *VpnProtocol::factory(DockerContainer container, const QJsonObject &
|
|||
case DockerContainer::WireGuard: return new WireguardProtocol(configuration);
|
||||
case DockerContainer::Awg: return new WireguardProtocol(configuration);
|
||||
case DockerContainer::Xray: return new XrayProtocol(configuration);
|
||||
case DockerContainer::SSXray: return new XrayProtocol(configuration);
|
||||
#endif
|
||||
default: return nullptr;
|
||||
}
|
||||
|
|
|
@ -233,6 +233,9 @@ void XrayProtocol::readXrayConfiguration(const QJsonObject &configuration)
|
|||
{
|
||||
m_configData = configuration;
|
||||
QJsonObject xrayConfiguration = configuration.value(ProtocolProps::key_proto_config_data(Proto::Xray)).toObject();
|
||||
if (xrayConfiguration.isEmpty()) {
|
||||
xrayConfiguration = configuration.value(ProtocolProps::key_proto_config_data(Proto::SSXray)).toObject();
|
||||
}
|
||||
m_xrayConfig = xrayConfiguration;
|
||||
m_localPort = QString(amnezia::protocols::xray::defaultLocalProxyPort).toInt();
|
||||
m_remoteAddress = configuration.value(amnezia::config_key::hostName).toString();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue