[Added] Added more v2ray config structs and added x2struct JSON lib.

This commit is contained in:
Leroy.H.Y 2019-07-03 23:10:24 +08:00
parent 09eed2704d
commit dfcbd64329
No known key found for this signature in database
GPG Key ID: 6AC1673B587DC37D
22 changed files with 1091 additions and 868 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "3rdparty/jsoncons"]
path = 3rdparty/jsoncons
url = https://github.com/danielaparker/jsoncons
[submodule "3rdparty/x2struct"]
path = 3rdparty/x2struct
url = git@github.com:xyz347/x2struct.git

1
3rdparty/x2struct vendored Submodule

@ -0,0 +1 @@
Subproject commit 084c3cd183ae2450473befa53e987a0ed347a6ff

View File

@ -25,7 +25,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
CONFIG += c++11
SOURCES += \
src/Hutils.cpp \
src/HUtils.cpp \
src/w_MainWindow.cpp \
src/w_ConnectionEditWindow.cpp \
src/w_ImportConfig.cpp \
@ -35,14 +35,15 @@ SOURCES += \
src/runguard.cpp
HEADERS += \
src/HUtils.h \
src/Hv2ConfigObject.h \
src/HConfigObjects.hpp \
src/HUtils.hpp \
src/V2ConfigObjects.hpp \
src/runguard.hpp \
src/vinteract.hpp \
src/w_MainWindow.h \
src/w_ConnectionEditWindow.h \
src/w_ImportConfig.h \
src/w_PrefrencesWindow.h \
src/vinteract.h \
src/runguard.h
src/w_PrefrencesWindow.h
FORMS += \
src/w_MainWindow.ui \

76
src/HConfigObjects.hpp Normal file
View File

@ -0,0 +1,76 @@
#ifndef HCONFIGOBJECTS_HPP
#define HCONFIGOBJECTS_HPP
#include <QDir>
#include <map>
#include "V2ConfigObjects.hpp"
#include "vinteract.hpp"
// Macros
#define HV2RAY_CONFIG_DIR_NAME "/.hv2ray/"
using namespace std;
namespace Hv2ray
{
namespace HConfigModels
{
struct HInbondSetting {
bool enabled;
string ip;
int port;
bool useAuthentication;
string authUsername;
string authPassword;
HInbondSetting(): enabled(), ip(), port(), useAuthentication(), authUsername(), authPassword() {}
HInbondSetting(bool _e, string _ip, int _p): HInbondSetting()
{
enabled = _e;
port = _p;
ip = _ip;
}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(enabled, ip, port, useAuthentication, authUsername, authPassword))
#endif
};
struct HvConfigList {
string alias;
string fileName;
int index;
HvConfigList(): alias(), fileName(), index() {}
XTOSTRUCT(O(alias, fileName, index))
};
struct Hv2Config {
string language;
bool runAsRoot;
string logLevel;
//Hv2ray::V2ConfigModels::MuxObject muxSetting;
HInbondSetting httpSetting;
HInbondSetting socksSetting;
list<HvConfigList> configs;
Hv2Config(): language(), runAsRoot(), logLevel(), httpSetting(), socksSetting(), configs() { }
Hv2Config(string lang, string log, HInbondSetting httpIn, HInbondSetting socksIN): Hv2Config()
{
language = lang;
logLevel = log;
httpSetting = httpIn;
socksSetting = socksIN;
runAsRoot = false;
}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(language, runAsRoot, logLevel, httpSetting, socksSetting, configs))
#endif
};
}
/// ConfigGlobalConfig is platform-independent as it's solved to be in the best
/// place at first in main.cpp
static QDir ConfigDir;
}
#if USE_TODO_FEATURES
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::HConfigModels::Hv2Config, language, runAsRoot, logLevel, httpSetting, socksSetting)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::HConfigModels::HInbondSetting, enabled, ip, port, useAuthentication, authUsername, authPassword)
#endif
#endif // HCONFIGOBJECTS_HPP

61
src/HUtils.cpp Normal file
View File

@ -0,0 +1,61 @@
#include "HUtils.hpp"
#include <QTextStream>
namespace Hv2ray
{
namespace Utils
{
static HConfigModels::Hv2Config GlobalConfig;
void SetGlobalConfig(HConfigModels::Hv2Config conf)
{
GlobalConfig = conf;
}
HConfigModels::Hv2Config GetGlobalConfig()
{
return GlobalConfig;
}
void SaveConfig(QFile *configFile)
{
configFile->open(QFile::WriteOnly);
QString jsonConfig = StructToJSON(GetGlobalConfig());
QTextStream stream(configFile);
stream << jsonConfig << endl;
stream.flush();
configFile->close();
}
void LoadConfig(QFile *configFile)
{
using namespace Hv2ray::HConfigModels;
configFile->open(QFile::ReadOnly);
QTextStream stream(configFile);
auto str = stream.readAll();
auto config = StructFromJSON<Hv2Config>(str.toStdString());
SetGlobalConfig(config);
configFile->close();
}
QStringList getAllFilesList(QDir *dir)
{
return dir->entryList(QStringList() << "*" << "*.*", QDir::Hidden | QDir::Files);
}
QTranslator *getTranslator(string lang)
{
QTranslator *translator = new QTranslator();
translator->load(QString::fromStdString(lang + ".qm"), ":/translations");
return translator;
}
bool hasFile(QDir *dir, QString fileName)
{
return getAllFilesList(dir).indexOf(fileName) >= 0;
}
void showWarnMessageBox(QWidget *parent, QString title, QString text)
{
QMessageBox::warning(parent, title, text, QMessageBox::Ok | QMessageBox::Default, 0);
}
}
}

View File

@ -1,32 +1,30 @@
#ifndef UTILS_H
#define UTILS_H
#include <QDir>
#include <QFile>
#include <QMap>
#include <QFileInfo>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QMessageBox>
#include <QWidget>
#include <assert.h>
#include <QTranslator>
#include <QApplication>
#include "Hv2ConfigObject.h"
#include <iostream>
#ifndef UTILS_H
#define UTILS_H
#include "HConfigObjects.hpp"
namespace Hv2ray
{
namespace Utils
{
QJsonObject switchJsonArrayObject(QJsonObject objest, QString value);
QJsonObject findValueFromJsonArray(QJsonArray arr, QString key, QString val);
QJsonObject loadRootObjFromConf();
QJsonArray getInbounds();
void showWarnMessageBox(QWidget *parent, QString title, QString text);
void overrideInbounds(QString path);
int getIndexByValue(QJsonArray array, QString key, QString val);
QTranslator *getTranslator(string lang);
void SetGlobalConfig(HConfigModels::Hv2Config conf);
HConfigModels::Hv2Config GetGlobalConfig();
void SaveConfig(QFile *configFile);
void LoadConfig(QFile *configFile);
/// Get file list in a Dir
QStringList getAllFilesList(QDir *dir);
bool hasFile(QDir *dir, QString fileName);
@ -34,14 +32,24 @@ namespace Hv2ray
QString StructToJSON(const TYPE &t)
{
string s;
#if USE_TODO_FEATURES
encode_json<TYPE>(t, s, indenting::indent);
#else
s = X::tojson(t, "", 4, ' ');
#endif
cout << s << endl;
return QString::fromStdString(s);
}
template <typename TYPE>
TYPE StructFromJSON(const std::string &str)
TYPE StructFromJSON(const string &str)
{
TYPE v = decode_json<TYPE>(str);
TYPE v;
#if USE_TODO_FEATURES
v = decode_json<TYPE>(str);
#else
X::loadjson(str, v, false);
#endif
return v;
}
}

View File

@ -1,92 +0,0 @@
#include "HUtils.h"
using namespace Hv2ray;
QJsonObject Utils::switchJsonArrayObject(QJsonObject obj, QString value)
{
QJsonObject returnObj = obj.value(value).isNull()
? obj.value(value).toObject()
: obj.value(value).toArray().first().toObject();
return returnObj;
}
QJsonObject Utils::findValueFromJsonArray(QJsonArray arr, QString key, QString val)
{
for (const auto obj : arr) {
if (obj.toObject().value(key).toString() == val) {
return obj.toObject();
}
}
return QJsonObject();
}
QJsonObject Utils::loadRootObjFromConf()
{
QFile globalConfigFile("Hv2ray.conf");
globalConfigFile.open(QIODevice::ReadOnly);
QByteArray conf = globalConfigFile.readAll();
globalConfigFile.close();
QJsonDocument v2conf(QJsonDocument::fromJson(conf));
QJsonObject rootObj = v2conf.object();
return rootObj;
}
QJsonArray Utils::getInbounds()
{
QJsonArray inbounds;
inbounds = loadRootObjFromConf().value("inbounds").toArray();
return inbounds;
}
void Utils::showWarnMessageBox(QWidget *parent, QString title, QString text)
{
QMessageBox::warning(parent, title, text, QMessageBox::Ok | QMessageBox::Default, 0);
}
void Utils::overrideInbounds(QString path)
{
QFile confFile(path);
confFile.open(QIODevice::ReadOnly);
QByteArray conf = confFile.readAll();
confFile.close();
QJsonDocument v2conf(QJsonDocument::fromJson(conf));
QJsonObject rootObj = v2conf.object();
QJsonArray modifiedIn = getInbounds();
rootObj.remove("inbounds");
rootObj.remove("inbound");
rootObj.remove("inboundDetour");
rootObj.insert("inbounds", QJsonValue(modifiedIn));
v2conf.setObject(rootObj);
conf = v2conf.toJson(QJsonDocument::Indented);
confFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
confFile.write(conf);
confFile.close();
}
int Utils::getIndexByValue(QJsonArray array, QString key, QString val)
{
QJsonArray::iterator it;
int index = 0;
for (it = array.begin(); it != array.end(); it++) {
if (it->toObject().value(key) == val) {
return index;
}
index++;
}
return -1;
}
/// Get file list in a Dir
QStringList Utils::getAllFilesList(QDir *dir)
{
return dir->entryList(QStringList() << "*" << "*.*", QDir::Hidden | QDir::Files);
}
bool Utils::hasFile(QDir *dir, QString fileName)
{
return getAllFilesList(dir).indexOf(fileName) >= 0;
}

View File

@ -1,392 +0,0 @@
#include <QDir>
#include <list>
#include <string>
#include <jsoncons/json.hpp>
#include <string>
#define USE_JSON_CONS
#ifdef USE_JSON_CONS
#include <jsoncons/json.hpp>
#else
#include <x2struct/x2struct.hpp>
using namespace x2struct;
#endif
#ifndef V2CONFIG_H
#define V2CONFIG_H
// Macros
#define HV2RAY_CONFIG_DIR_NAME "/.hv2ray"
using namespace std;
using namespace jsoncons; // for convenience
/*------------------------------------------------------------------------------------------------------------*/
namespace Hv2ray
{
namespace V2ConfigModels
{
struct LogObject {
string access;
string error;
string loglevel;
LogObject(): access(), error(), loglevel() {}
//XTOSTRUCT(O(access, error, loglevel))
};
struct ApiObject {
string tag;
list<string> services;
ApiObject() : tag(), services() {}
//XTOSTRUCT(O(tag, services))
};
struct ServerObject {
string address;
int port;
list<string> domains;
ServerObject(): address(), port(), domains() {}
//XTOSTRUCT(O(address, port, domains))
};
struct DnsObject {
map<string, string> hosts;
tuple<string, string, list<ServerObject>> servers;
DnsObject(): hosts(), servers() {}
//XTOSTRUCT(O(hosts, servers))
};
struct RuleObject {
string type = "field";
list<string> domain;
list<string> ip;
string port;
string network;
list<string> source;
list<string> user;
string inboundTag;
string protocol;
string attrs;
RuleObject() : type(), domain(), ip(), port(), network(), source(), user(), inboundTag(), protocol(), attrs() {}
//XTOSTRUCT(O(type, domain, ip, port, network, source, user, inboundTag, protocol, attrs))
};
struct BalancerObject {
string tag ;
list<string> selector;
BalancerObject() : tag(), selector() {}
//XTOSTRUCT(O(tag, selector))
};
struct RoutingObject {
string domainStrategy;
list<RuleObject> rules;
list<BalancerObject> balancers;
RoutingObject() : domainStrategy(), rules(), balancers() {}
//XTOSTRUCT(O(domainStrategy, rules, balancers))
};
struct SystemPolicyObject {
bool statsInboundUplink;
bool statsInboundDownlink;
SystemPolicyObject() : statsInboundUplink(), statsInboundDownlink() {}
//XTOSTRUCT(O(statsInboundUplink, statsInboundDownlink))
};
struct LevelPolicyObject {
int handshake;
int connIdle;
int uplinkOnly;
int downlinkOnly;
bool statsUserUplink;
bool statsUserDownlink;
int bufferSize;
LevelPolicyObject(): handshake(), connIdle(), uplinkOnly(), downlinkOnly(), statsUserUplink(), statsUserDownlink(), bufferSize() {}
//XTOSTRUCT(O(handshake, connIdle, uplinkOnly, downlinkOnly, statsUserUplink, statsUserDownlink, bufferSize))
};
struct PolicyObject {
map<int, LevelPolicyObject> level;
list<SystemPolicyObject> system;
PolicyObject(): level(), system() {}
//XTOSTRUCT(O(level, system))
};
struct HTTPRequestObject {
string version;
string method;
list<string> path;
map<string, list<string>> headers;
HTTPRequestObject(): version(), method(), path(), headers() {}
//XTOSTRUCT(O(version, method, path, headers))
};
struct HTTPResponseObject {
string version;
string status;
string reason;
map<string, list<string>> headers;
HTTPResponseObject(): version(), status(), reason(), headers() {}
//XTOSTRUCT(O(version, status, reason, headers))
};
struct TCPHeader_M_Object {
string type;
HTTPRequestObject request;
HTTPResponseObject response;
TCPHeader_M_Object(): type(), request(), response() {}
//XTOSTRUCT(O(type, request, response))
};
struct TCPObject {
TCPHeader_M_Object header;
TCPObject(): header() {}
//XTOSTRUCT(O(header))
};
struct HeaderObject {
string type;
HeaderObject(): type() {}
//XTOSTRUCT(O(type))
};
struct KCPObject {
int mtu;
int tti;
int uplinkCapacity;
int downlinkCapacity;
bool congestion;
int readBufferSize;
int writeBufferSize;
HeaderObject header;
KCPObject(): mtu(), tti(), uplinkCapacity(), downlinkCapacity(), congestion(), readBufferSize(), writeBufferSize(), header() {}
//XTOSTRUCT(O(mtu, tti, uplinkCapacity, downlinkCapacity, congestion, readBufferSize, writeBufferSize, header))
};
struct WebSocketObject {
string path;
map<string, string> headers;
WebSocketObject(): path(), headers() {}
//XTOSTRUCT(O(path, headers))
};
struct HttpObject {
list<string> host;
string path;
HttpObject() : host(), path() {}
//XTOSTRUCT(O(host, path))
};
struct DomainSocketObject {
string path;
DomainSocketObject(): path() {}
//XTOSTRUCT(O(path))
};
struct QuicObject {
string security;
string key;
HeaderObject header;
QuicObject(): security(), key(), header() {}
//XTOSTRUCT(O(security, key, header))
};
struct TransportObject {
TCPObject tcpSettings;
KCPObject kcpSettings;
WebSocketObject wsSettings;
HttpObject httpSettings;
DomainSocketObject dsSettings;
QuicObject quicSettings;
TransportObject(): tcpSettings(), kcpSettings(), wsSettings(), httpSettings(), dsSettings(), quicSettings() {}
//XTOSTRUCT(O(tcpSettings, kcpSettings, wsSettings, httpSettings, dsSettings, quicSettings))
};
struct SniffingObject {
bool enabled;
string destOverride;
SniffingObject(): enabled(), destOverride() {}
//XTOSTRUCT(O(enabled, destOverride))
};
struct AllocateObject {
string strategy;
int refresh;
int concurrency;
AllocateObject(): strategy(), refresh(), concurrency() {}
//XTOSTRUCT(O(strategy, refresh, concurrency))
};
struct InboundObject {
int port;
string listen;
string protocol;
string settings;
TransportObject streamSettings;
string tag;
SniffingObject sniffing;
AllocateObject allocate;
InboundObject(): port(), listen(), protocol(), settings(), streamSettings(), tag(), sniffing(), allocate() {}
//XTOSTRUCT(O(port, listen, protocol, settings, streamSettings, tag, sniffing, allocate))
};
struct ProxySettingsObject {
string tag;
ProxySettingsObject(): tag() {}
//XTOSTRUCT(O(tag))
};
struct MuxObject {
bool enabled;
int concurrency;
MuxObject(): enabled(), concurrency() {}
//XTOSTRUCT(O(enabled, concurrency))
};
struct OutboundObject {
string sendThrough;
string protocol;
string settings;
string tag;
TransportObject streamSettings;
ProxySettingsObject proxySettings;
MuxObject mux;
OutboundObject(): sendThrough(), protocol(), settings(), tag(), streamSettings(), proxySettings(), mux() {}
//XTOSTRUCT(O(sendThrough, protocol, settings, tag, streamSettings, proxySettings, mux))
};
struct StatsObject {
bool _; // Placeholder...
StatsObject(): _() {}
};
struct BridgeObject {
string tag;
string domain;
BridgeObject() : tag(), domain() {}
//XTOSTRUCT(O(tag, domain))
};
struct PortalObject {
string tag;
string domain;
PortalObject() : tag(), domain() {}
//XTOSTRUCT(O(tag, domain))
};
struct ReverseObject {
list<BridgeObject> bridges;
list<PortalObject> portals;
ReverseObject() : bridges(), portals() {}
//XTOSTRUCT(O(bridges, portals))
};
struct RootObject {
LogObject log;
ApiObject api;
DnsObject dns;
RoutingObject routing;
list<InboundObject> inbounds;
list<OutboundObject> outbounds;
TransportObject transport;
StatsObject stats;
ReverseObject reverse;
RootObject(): log(), api(), dns(), routing(), inbounds(), outbounds(), transport(), stats(), reverse() {}
//XTOSTRUCT(O(log, api, dns, routing, inbounds, outbounds, transport, stats, reverse))
};
}
}
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::LogObject, access, error, loglevel)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::ApiObject, tag, services)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::ServerObject, address, port, domains)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::DnsObject, hosts, servers)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::RuleObject, type, domain, ip, port, network, source, user, inboundTag, protocol, attrs)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::BalancerObject, tag, selector)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::RoutingObject, domainStrategy, rules, balancers)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::SystemPolicyObject, statsInboundUplink, statsInboundDownlink)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::LevelPolicyObject, handshake, connIdle, uplinkOnly, downlinkOnly, statsUserUplink, statsUserDownlink, bufferSize)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::PolicyObject, level, system)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::HTTPRequestObject, version, method, path, headers)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::HTTPResponseObject, version, status, reason, headers)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::TCPHeader_M_Object, type, request, response)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::TCPObject, header)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::HeaderObject, type)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::KCPObject, mtu, tti, uplinkCapacity, downlinkCapacity, congestion, readBufferSize, writeBufferSize, header)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::WebSocketObject, path, headers)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::HttpObject, host, path)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::DomainSocketObject, path)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::QuicObject, security, key, header)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::TransportObject, tcpSettings, kcpSettings, wsSettings, httpSettings, dsSettings, quicSettings)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::SniffingObject, enabled, destOverride)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::AllocateObject, strategy, refresh, concurrency)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::InboundObject, port, listen, protocol, settings, streamSettings, tag, sniffing, allocate)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::ProxySettingsObject, tag)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::MuxObject, enabled, concurrency)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::OutboundObject, sendThrough, protocol, settings, tag, streamSettings, proxySettings, mux)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::StatsObject, _)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::BridgeObject, tag, domain)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::PortalObject, tag, domain)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::ReverseObject, bridges, portals)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::V2ConfigModels::RootObject, log, api, dns, routing, inbounds, outbounds, transport, stats, reverse)
namespace Hv2ray
{
namespace HConfigModels
{
struct HInbondSetting {
bool enabled;
string ip;
int port;
bool useAuthentication;
string authUsername;
string authPassword;
HInbondSetting() {}
HInbondSetting(bool _enabled, string _ip, int _port)
: ip(_ip), authUsername(""), authPassword("")
{
enabled = _enabled;
port = _port;
useAuthentication = false;
}
HInbondSetting(bool _enabled, string _ip, int _port, string _username, string _password)
: ip(_ip), authUsername(_username), authPassword(_password)
{
enabled = _enabled;
port = _port;
useAuthentication = true;
}
//XTOSTRUCT(O(enabled, ip, port, useAuthentication, authUsername, authPassword))
};
struct Hv2Config {
string language;
bool runAsRoot;
string logLevel;
//Hv2ray::V2ConfigModels::MuxObject muxSetting;
HInbondSetting httpSetting;
HInbondSetting socksSetting;
Hv2Config() {}
Hv2Config(string lang, const bool _runAsRoot, const string _loglevel, HInbondSetting _http, HInbondSetting _socks)
: httpSetting(_http),
socksSetting(_socks)
{
language = lang;
runAsRoot = _runAsRoot;
logLevel = _loglevel;
}
//XTOSTRUCT(O(language, runAsRoot, logLevel, httpSetting, socksSetting))
};
}
}
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::HConfigModels::Hv2Config, language, runAsRoot, logLevel, httpSetting, socksSetting)
JSONCONS_MEMBER_TRAITS_DECL(Hv2ray::HConfigModels::HInbondSetting, enabled, ip, port, useAuthentication, authUsername, authPassword)
namespace Hv2ray
{
/// ConfigGlobalConfigthis is platform-independent as it's solved to be in the best
/// place at first in main.cpp
static QDir ConfigDir;
static HConfigModels::Hv2Config GlobalConfig;
}
#endif // V2CONFIG_H

638
src/V2ConfigObjects.hpp Normal file
View File

@ -0,0 +1,638 @@
#include <list>
#include <string>
// TODO Features
#define USE_TODO_FEATURES false
#if USE_TODO_FEATURES
#include <jsoncons/json.hpp>
using namespace jsoncons;
#else
#include <x2struct/x2struct.hpp>
using namespace x2struct;
#endif
#ifndef V2CONFIG_H
#define V2CONFIG_H
using namespace std;
/*------------------------------------------------------------------------------------------------------------*/
namespace Hv2ray
{
namespace V2ConfigModels
{
// Two struct defining TYPE parameter to be passed into inbound configs and outbound configs.
struct XOutBoundsType {
};
struct XInBoundsType {
};
struct LogObject {
string access;
string error;
string loglevel;
LogObject(): access(), error(), loglevel() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(access, error, loglevel))
#endif
};
struct ApiObject {
string tag;
list<string> services;
ApiObject() : tag(), services() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(tag, services))
#endif
};
namespace DNSObjects
{
struct ServerObject {
string address;
int port;
list<string> domains;
ServerObject(): address(), port(), domains() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(address, port, domains))
#endif
};
}
struct DnsObject {
map<string, string> hosts;
#if USE_TODO_FEATURES
tuple<string, string, list<DNSObjects::ServerObject>> servers;
#else
// Currently does not support ServerObject as tuple is.... quite complicated...
list<string> servers;
#endif
DnsObject(): hosts(), servers() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(hosts, servers))
#endif
};
namespace ROUTINGObjects
{
struct RuleObject {
string type = "field";
list<string> domain;
list<string> ip;
string port;
string network;
list<string> source;
list<string> user;
string inboundTag;
string protocol;
string attrs;
RuleObject() : type(), domain(), ip(), port(), network(), source(), user(), inboundTag(), protocol(), attrs() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(type, domain, ip, port, network, source, user, inboundTag, protocol, attrs))
#endif
};
struct BalancerObject {
string tag ;
list<string> selector;
BalancerObject() : tag(), selector() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(tag, selector))
#endif
};
}
struct RoutingObject {
string domainStrategy;
list<ROUTINGObjects::RuleObject> rules;
list<ROUTINGObjects::BalancerObject> balancers;
RoutingObject() : domainStrategy(), rules(), balancers() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(domainStrategy, rules, balancers))
#endif
};
namespace POLICYObjects
{
struct SystemPolicyObject {
bool statsInboundUplink;
bool statsInboundDownlink;
SystemPolicyObject() : statsInboundUplink(), statsInboundDownlink() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(statsInboundUplink, statsInboundDownlink))
#endif
};
struct LevelPolicyObject {
int handshake;
int connIdle;
int uplinkOnly;
int downlinkOnly;
bool statsUserUplink;
bool statsUserDownlink;
int bufferSize;
LevelPolicyObject(): handshake(), connIdle(), uplinkOnly(), downlinkOnly(), statsUserUplink(), statsUserDownlink(), bufferSize() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(handshake, connIdle, uplinkOnly, downlinkOnly, statsUserUplink, statsUserDownlink, bufferSize))
#endif
};
}
struct PolicyObject {
map<int, POLICYObjects::LevelPolicyObject> level;
list<POLICYObjects::SystemPolicyObject> system;
PolicyObject(): level(), system() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(level, system))
#endif
};
namespace TRANSFERObjects
{
namespace TRANSFERObjectsInternal
{
struct HTTPRequestObject {
string version;
string method;
list<string> path;
map<string, list<string>> headers;
HTTPRequestObject(): version(), method(), path(), headers() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(version, method, path, headers))
#endif
};
struct HTTPResponseObject {
string version;
string status;
string reason;
map<string, list<string>> headers;
HTTPResponseObject(): version(), status(), reason(), headers() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(version, status, reason, headers))
#endif
};
struct TCPHeader_M_Object {
string type;
HTTPRequestObject request;
HTTPResponseObject response;
TCPHeader_M_Object(): type(), request(), response() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(type, request, response))
#endif
};
struct HeaderObject {
string type;
HeaderObject(): type() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(type))
#endif
};
}
struct TCPObject {
TRANSFERObjectsInternal:: TCPHeader_M_Object header;
TCPObject(): header() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(header))
#endif
};
struct KCPObject {
int mtu;
int tti;
int uplinkCapacity;
int downlinkCapacity;
bool congestion;
int readBufferSize;
int writeBufferSize;
TRANSFERObjectsInternal:: HeaderObject header;
KCPObject(): mtu(), tti(), uplinkCapacity(), downlinkCapacity(), congestion(), readBufferSize(), writeBufferSize(), header() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(mtu, tti, uplinkCapacity, downlinkCapacity, congestion, readBufferSize, writeBufferSize, header))
#endif
};
struct WebSocketObject {
string path;
map<string, string> headers;
WebSocketObject(): path(), headers() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(path, headers))
#endif
};
struct HttpObject {
list<string> host;
string path;
HttpObject() : host(), path() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(host, path))
#endif
};
struct DomainSocketObject {
string path;
DomainSocketObject(): path() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(path))
#endif
};
struct QuicObject {
string security;
string key;
TRANSFERObjectsInternal::HeaderObject header;
QuicObject(): security(), key(), header() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(security, key, header))
#endif
};
}
struct TransportObject {
TRANSFERObjects::TCPObject tcpSettings;
TRANSFERObjects::KCPObject kcpSettings;
TRANSFERObjects::WebSocketObject wsSettings;
TRANSFERObjects::HttpObject httpSettings;
TRANSFERObjects::DomainSocketObject dsSettings;
TRANSFERObjects::QuicObject quicSettings;
TransportObject(): tcpSettings(), kcpSettings(), wsSettings(), httpSettings(), dsSettings(), quicSettings() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(tcpSettings, kcpSettings, wsSettings, httpSettings, dsSettings, quicSettings))
#endif
};
namespace INBOUNDObjects
{
struct SniffingObject {
bool enabled;
string destOverride;
SniffingObject(): enabled(), destOverride() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(enabled, destOverride))
#endif
};
struct AllocateObject {
string strategy;
int refresh;
int concurrency;
AllocateObject(): strategy(), refresh(), concurrency() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(strategy, refresh, concurrency))
#endif
};
}
namespace STREAMSETTINGSObjects
{
struct SockoptObject {
int mark;
bool tcpFastOpen;
string tproxy;
SockoptObject(): mark(), tcpFastOpen(), tproxy() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(mark, tcpFastOpen, tproxy))
#endif
};
struct CertificateObject {
string usage;
string certificateFile;
string keyFile;
list<string> certificate;
list<string> key;
CertificateObject(): usage(), certificateFile(), keyFile(), certificate(), key() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(usage, certificateFile, keyFile, certificate, key))
#endif
};
struct TLSObject {
string serverName;
bool allowInsecure;
list<string> alpn;
list<CertificateObject> certificates;
bool disableSystemRoot;
TLSObject(): serverName(), allowInsecure(), certificates(), disableSystemRoot() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(serverName, allowInsecure, alpn, certificates, disableSystemRoot))
#endif
};
}
struct StreamSettingsObject {
string network;
string security;
STREAMSETTINGSObjects::SockoptObject sockopt;
STREAMSETTINGSObjects::TLSObject tlsSettings;
TRANSFERObjects::TCPObject tcpSettings;
TRANSFERObjects::KCPObject kcpSettings;
TRANSFERObjects::WebSocketObject wsSettings;
TRANSFERObjects::HttpObject httpSettings;
TRANSFERObjects::DomainSocketObject dsSettings;
TRANSFERObjects::QuicObject quicSettings;
StreamSettingsObject(): network(), security(), sockopt(), tlsSettings(), tcpSettings(), kcpSettings(), wsSettings(), httpSettings(), dsSettings(), quicSettings() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(network, security, sockopt, tcpSettings, tlsSettings, kcpSettings, wsSettings, httpSettings, dsSettings, quicSettings))
#endif
};
template<typename XINBOUNDSETTINGOBJECT>
struct InboundObject {
static_assert(std::is_base_of<XInBoundsType, XINBOUNDSETTINGOBJECT>::value, "XINBOUNDSETTINGOBJECT must extend XInBoundsType");
int port;
string listen;
string protocol;
XINBOUNDSETTINGOBJECT settings;
StreamSettingsObject streamSettings;
string tag;
INBOUNDObjects::SniffingObject sniffing;
INBOUNDObjects::AllocateObject allocate;
InboundObject(): port(), listen(), protocol(), settings(), streamSettings(), tag(), sniffing(), allocate() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(port, listen, protocol, settings, streamSettings, tag, sniffing, allocate))
#endif
};
namespace OUTBOUNDObjects
{
struct ProxySettingsObject {
string tag;
ProxySettingsObject(): tag() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(tag))
#endif
};
struct MuxObject {
bool enabled;
int concurrency;
MuxObject(): enabled(), concurrency() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(enabled, concurrency))
#endif
};
}
template <typename XOUTBOUNDSETTINGOBJECT>
struct OutboundObject {
static_assert(std::is_base_of<XOutBoundsType, XOUTBOUNDSETTINGOBJECT>::value, "XOUTBOUNDSETTINGOBJECT must extend XOutBoundsType");
string sendThrough;
string protocol;
XOUTBOUNDSETTINGOBJECT settings;
string tag;
StreamSettingsObject streamSettings;
OUTBOUNDObjects::ProxySettingsObject proxySettings;
OUTBOUNDObjects::MuxObject mux;
OutboundObject(): sendThrough(), protocol(), settings(), tag(), streamSettings(), proxySettings(), mux() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(sendThrough, protocol, settings, tag, streamSettings, proxySettings, mux))
#endif
};
struct StatsObject {
bool _; // Placeholder...
StatsObject(): _() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(_))
#endif
};
namespace REVERSEObjects
{
struct BridgeObject {
string tag;
string domain;
BridgeObject() : tag(), domain() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(tag, domain))
#endif
};
struct PortalObject {
string tag;
string domain;
PortalObject() : tag(), domain() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(tag, domain))
#endif
};
}
struct ReverseObject {
list<REVERSEObjects::BridgeObject> bridges;
list<REVERSEObjects::PortalObject> portals;
ReverseObject() : bridges(), portals() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(bridges, portals))
#endif
};
#if USE_TODO_FEATURES
template<typename XIN1, typename XIN2, typename XIN3, typename XIN4, typename XIN5, typename XOUT1, typename XOUT2, typename XOUT3, typename XOUT4, typename XOUT5>
#else
template <typename XInBound_T, typename XOutBound_T>
#endif
struct RootObject {
LogObject log;
ApiObject api;
DnsObject dns;
RoutingObject routing;
#if USE_TODO_FEATURES
// Default support 5 inBounds and 5 outBounds
tuple<InboundObject<XIN1>, InboundObject<XIN2>, InboundObject<XIN3>, InboundObject<XIN4>, InboundObject<XIN5>> inbounds;
tuple<OutboundObject<XIN1>, OutboundObject<XIN2>, OutboundObject<XIN3>, OutboundObject<XIN4>, OutboundObject<XIN5>> outbounds;
#else
list<InboundObject<XInBound_T>> inbounds;
list<OutboundObject<XOutBound_T>> outbounds;
#endif
TransportObject transport;
StatsObject stats;
ReverseObject reverse;
PolicyObject policy;
RootObject(): log(), api(), dns(), routing(), inbounds(), outbounds(), transport(), stats(), reverse(), policy() {}
#if USE_TODO_FEATURES == false
XTOSTRUCT(O(log, api, dns, routing, inbounds, outbounds, transport, stats, reverse, policy))
#endif
};
}
}
namespace Hv2ray
{
namespace V2ConfigModels
{
/// Some protocols from: https://v2ray.com/chapter_02/02_protocols.html
namespace Protocols
{
/// BlackHole Protocol, OutBound
struct BlackHole : XOutBoundsType {
struct ResponseObject {
string type;
};
ResponseObject response;
};
/// DNS, OutBound
struct DNS: XOutBoundsType {
string network;
string address;
int port;
};
/// Dokodemo-door, InBound
struct Dokodemo_door : XInBoundsType {
string address;
int port;
string network;
int timeout;
bool followRedirect;
int userLevel;
};
/// Freedom, OutBound
struct Freedom: XOutBoundsType {
string domainStrategy;
string redirect;
int userLevel;
};
struct AccountObject {
string user;
string pass;
XTOSTRUCT(O(user, pass))
};
/// HTTP, InBound
struct HTTP: XInBoundsType {
int timeout;
list<AccountObject> accounts;
bool allowTransparent;
int userLevel;
XTOSTRUCT(O(timeout, accounts, allowTransparent, userLevel))
};
/// MTProto, InBound || OutBound
struct MTProto: XInBoundsType, XOutBoundsType {
struct UserObject {
string email;
int level;
string secret;
};
list<UserObject> users;
};
// We don't add shadowsocks, (As it's quite complex and I'm quite lazy...)
/// Socks, InBound, OutBound
struct Socks: XInBoundsType, XOutBoundsType {
struct UserObject {
};
struct ServerObject {
string address;
int port;
list<UserObject> users;
};
list<ServerObject> servers;
string auth;
list<AccountObject> accounts;
bool udp;
string ip;
int userLevel;
};
struct VMess: XInBoundsType, XOutBoundsType {
struct ServerObject {
struct UserObject {
string id;
int alterId;
string security;
int level;
XTOSTRUCT(O(id, alterId, security, level))
};
// OUTBound;
string address;
int port;
list<UserObject> users;
XTOSTRUCT(O(address, port, users))
};
list<ServerObject> vnext;
// INBound;
struct ClientObject {
string id;
int level;
int alterId;
string email;
XTOSTRUCT(O(id, level, alterId, email))
};
list<ClientObject> clients;
// detour and default will not be implemented as it's complicated...
bool disableInsecureEncryption;
XTOSTRUCT(O(vnext, clients, disableInsecureEncryption))
};
}
}
}
#if USE_TODO_FEATURES
using namespace Hv2ray;
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::LogObject, access, error, loglevel)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::ApiObject, tag, services)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::DNSObjects::ServerObject, address, port, domains)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::DnsObject, hosts, servers)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::ROUTINGObjects::RuleObject, type, domain, ip, port, network, source, user, inboundTag, protocol, attrs)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::ROUTINGObjects::BalancerObject, tag, selector)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::RoutingObject, domainStrategy, rules, balancers)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::POLICYObjects::SystemPolicyObject, statsInboundUplink, statsInboundDownlink)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::POLICYObjects::LevelPolicyObject, handshake, connIdle, uplinkOnly, downlinkOnly, statsUserUplink, statsUserDownlink, bufferSize)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::PolicyObject, level, system)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::TRANSFERObjects::TRANSFERObjectsInternal::HTTPRequestObject, version, method, path, headers)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::TRANSFERObjects::TRANSFERObjectsInternal::HTTPResponseObject, version, status, reason, headers)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::TRANSFERObjects::TRANSFERObjectsInternal::TCPHeader_M_Object, type, request, response)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::TRANSFERObjects::TRANSFERObjectsInternal::HeaderObject, type)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::TRANSFERObjects::TCPObject, header)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::TRANSFERObjects::KCPObject, mtu, tti, uplinkCapacity, downlinkCapacity, congestion, readBufferSize, writeBufferSize, header)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::TRANSFERObjects::WebSocketObject, path, headers)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::TRANSFERObjects::HttpObject, host, path)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::TRANSFERObjects::DomainSocketObject, path)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::TRANSFERObjects::QuicObject, security, key, header)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::TransportObject, tcpSettings, kcpSettings, wsSettings, httpSettings, dsSettings, quicSettings)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::INBOUNDObjects::SniffingObject, enabled, destOverride)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::INBOUNDObjects::AllocateObject, strategy, refresh, concurrency)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::OUTBOUNDObjects::ProxySettingsObject, tag)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::OUTBOUNDObjects::MuxObject, enabled, concurrency)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::REVERSEObjects::BridgeObject, tag, domain)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::REVERSEObjects::PortalObject, tag, domain)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::ReverseObject, bridges, portals)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::StatsObject, _)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::StreamSettingsObject, tcpSettings, kcpSettings, wsSettings, httpSettings, dsSettings, quicSettings, tlsSettings, sockopt, network, security)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::STREAMSETTINGSObjects::TLSObject, serverName, allowInsecure, alpn, certificates, disableSystemRoot)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::STREAMSETTINGSObjects::CertificateObject, usage, certificateFile, keyFile, certificate, key)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::STREAMSETTINGSObjects::SockoptObject, mark, tcpFastOpen, tproxy)
// These 3 are used as templates.
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::RootObject, log, api, dns, routing, inbounds, outbounds, transport, stats, reverse, policy)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::InboundObject, port, listen, protocol, settings, streamSettings, tag, sniffing, allocate)
JSONCONS_MEMBER_TRAITS_DECL(V2ConfigModels::OutboundObject, sendThrough, protocol, settings, tag, streamSettings, proxySettings, mux)
#endif
/// Code above has passed these tests.
//using namespace Hv2ray::V2ConfigModels;
//RootObject<Protocols::HTTP, Protocols::VMess> x;
//InboundObject<Protocols::HTTP> inH;
//x.inbounds.insert(x.inbounds.end(), inH);
//OutboundObject<Protocols::VMess> inV;
//x.outbounds.insert(x.outbounds.end(), inV);
//QString jsonConfig = Utils::StructToJSON(x);
//cout << jsonConfig.toStdString() << endl;
///
#endif

View File

@ -1,27 +1,22 @@
#include <QApplication>
#include <QDebug>
#include <QDir>
#include <QFileInfo>
#include <QJsonArray>
#include <QJsonDocument>
#include <QStandardPaths>
#include <QTranslator>
#include <iostream>
#include <jsoncons/json.hpp>
#include "runguard.h"
#include "HUtils.h"
#include "Hv2ConfigObject.h"
#include "w_ConnectionEditWindow.h"
#include "HUtils.hpp"
#include "HConfigObjects.hpp"
#include "runguard.hpp"
#include "w_MainWindow.h"
using namespace std;
using namespace Hv2ray;
using namespace Hv2ray::Utils;
using namespace Hv2ray::HConfigModels;
bool firstRunCheck()
bool initializeHv()
{
/// Hv2ray Config Path.
/// Hv2ray Config Path and ends with "/"
QString configPath = "";
#if defined(__WIN32) || defined(__APPLE__)
// For Windows and MacOS, there's no such 'installation' of a software
@ -48,28 +43,22 @@ bool firstRunCheck()
}
}
QFile configFile(configPath + "hv2ray.conf");
if (!Utils::hasFile(&ConfigDir, ".initialised")) {
// This is first run!
// These below genenrated very basic global config.
HInbondSetting inHttp = HInbondSetting(true, "127.0.0.1", 8080);
HInbondSetting inSocks = HInbondSetting(true, "127.0.0.1", 1080);
GlobalConfig = Hv2Config("zh-CN", false, "info", inHttp, inSocks);
QString jsonConfig = Utils::StructToJSON(GlobalConfig);
QFile configFile(configPath + "/hv2ray.conf");
if (!configFile.open(QIODevice::WriteOnly)) {
qDebug() << "Failed to create main config file.";
return false;
}
QTextStream stream(&configFile);
stream << jsonConfig;
stream.flush();
configFile.close();
Hv2Config conf = Hv2Config("zh-CN", "info", inHttp, inSocks);
SetGlobalConfig(conf);
SaveConfig(&configFile);
// Create Placeholder for initialise indicator.
QFile initPlaceHolder(configPath + "/.initialised");
QFile initPlaceHolder(configPath + ".initialised");
initPlaceHolder.open(QFile::WriteOnly);
initPlaceHolder.close();
} else {
LoadConfig(&configFile);
}
return true;
@ -78,21 +67,6 @@ bool firstRunCheck()
int main(int argc, char *argv[])
{
QApplication _qApp(argc, argv);
QTranslator translator;
//
if (translator.load(":/translations/zh-CN.qm", "translations")) {
cout << "Loaded zh-CN translations" << endl;
} else if (translator.load(":/translations/en-US.qm", "translations")) {
cout << "Loaded en-US translations" << endl;
} else {
Utils::showWarnMessageBox(
nullptr, "Failed to load translations 无法加载语言文件",
"Failed to load translations, user experience may be downgraded. \r\n"
"无法加载语言文件,用户体验可能会降级.");
}
_qApp.installTranslator(&translator);
RunGuard guard("Hv2ray-Instance-Identifier");
if (!guard.isSingleInstance()) {
@ -100,11 +74,23 @@ int main(int argc, char *argv[])
return -1;
}
// GlobalConfig = StructFromJSON("");
// Set file startup path as Path
// WARNING: This may be changed in the future.
QDir::setCurrent(QFileInfo(QCoreApplication::applicationFilePath()).path());
firstRunCheck();
// Hv2ray Initialize
initializeHv();
if (_qApp.installTranslator(getTranslator(GetGlobalConfig().language))) {
cout << "Loaded translations " << GetGlobalConfig().language << endl;
} else if (_qApp.installTranslator(getTranslator("en-US"))) {
cout << "Loaded default translations" << endl;
} else {
showWarnMessageBox(
nullptr, "Failed to load translations 无法加载语言文件",
"Failed to load translations, user experience may be downgraded. \r\n"
"无法加载语言文件,用户体验可能会降级.");
}
// Show MainWindow
Ui::MainWindow w;
w.show();

View File

@ -1,6 +1,6 @@
#include <QCryptographicHash>
#include "runguard.h"
#include "runguard.hpp"
namespace Hv2ray
{

View File

@ -2,8 +2,8 @@
#include <QDir>
#include <QProcess>
#include "HUtils.h"
#include "vinteract.h"
#include "HUtils.hpp"
#include "vinteract.hpp"
#include "w_MainWindow.h"
namespace Hv2ray

View File

@ -10,8 +10,8 @@
#include "Python.h"
#pragma pop_macro("slots")
#include "HUtils.h"
#include "vinteract.h"
#include "HUtils.hpp"
#include "vinteract.hpp"
#include "w_ConnectionEditWindow.h"
#include "w_ImportConfig.h"

View File

@ -8,8 +8,8 @@
#include <QMenu>
#include <QStandardItemModel>
#include "HUtils.h"
#include "vinteract.h"
#include "HUtils.hpp"
#include "vinteract.hpp"
#include "w_ConnectionEditWindow.h"
#include "w_ImportConfig.h"
#include "w_MainWindow.h"

View File

@ -7,8 +7,8 @@
#include <QSystemTrayIcon>
#include "ui_w_MainWindow.h"
#include "vinteract.h"
#include "Hv2ConfigObject.h"
#include "vinteract.hpp"
#include "V2ConfigObjects.hpp"
namespace Hv2ray
{

View File

@ -202,6 +202,13 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>#ConnectionSettings</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="pushButton">
<property name="sizePolicy">
@ -215,13 +222,6 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>#ConnectionSettings</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -294,7 +294,6 @@
<tabstop>restartButton</tabstop>
<tabstop>clearlogButton</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>pushButton</tabstop>
<tabstop>logText</tabstop>
</tabstops>
<resources/>

View File

@ -8,10 +8,13 @@
#include <QJsonValue>
#include <QProcess>
#include "HUtils.h"
#include "vinteract.h"
#include "HUtils.hpp"
#include "vinteract.hpp"
#include "w_PrefrencesWindow.h"
#ifndef _WIN32
#include <unistd.h>
#endif
using namespace Hv2ray;
using namespace Utils;
@ -20,33 +23,27 @@ namespace Hv2ray
{
namespace Ui
{
PrefrencesWindow::PrefrencesWindow(QWidget *parent)
: QDialog(parent)
, ui(new Ui_PrefrencesWindow)
PrefrencesWindow::PrefrencesWindow(QWidget *parent) : QDialog(parent), CurrentConfig(), ui(new Ui_PrefrencesWindow)
{
ui->setupUi(this);
rootObj = loadRootObjFromConf();
QJsonObject http = findValueFromJsonArray(rootObj.value("inbounds").toArray(), "tag", "http-in");
QJsonObject socks = findValueFromJsonArray(rootObj.value("inbounds").toArray(), "tag", "socks-in");
if (rootObj.value("v2suidEnabled").toBool()) {
ui->runAsRootCheckBox->setCheckState(Qt::Checked);
}
if (!http.isEmpty()) {
ui->httpPortLE->setText(http.value("port").toString());
ui->httpCB->setCheckState(Qt::Checked);
} else {
ui->httpPortLE->setDisabled(true);
}
if (!socks.isEmpty()) {
ui->socksPortLE->setText(socks.value("port").toString());
ui->socksCB->setCheckState(Qt::Checked);
} else {
ui->socksPortLE->setDisabled(true);
}
CurrentConfig = GetGlobalConfig();
ui->languageComboBox->setCurrentText(QString::fromStdString(CurrentConfig.language));
ui->runAsRootCheckBox->setChecked(CurrentConfig.runAsRoot);
ui->logLevelCheckBox->setCurrentText(QString::fromStdString(CurrentConfig.logLevel));
//
ui->httpCB->setChecked(CurrentConfig.httpSetting.enabled);
ui->httpPortLE->setText(QString::fromStdString(to_string(CurrentConfig.httpSetting.port)));
ui->httpAuthCB->setChecked(CurrentConfig.httpSetting.useAuthentication);
ui->httpAuthUsernameTxt->setText(QString::fromStdString(CurrentConfig.httpSetting.authUsername));
ui->httpAuthPasswordTxt->setText(QString::fromStdString(CurrentConfig.httpSetting.authPassword));
ui->httpPortLE->setValidator(new QIntValidator());
//
ui->socksCB->setChecked(CurrentConfig.socksSetting.enabled);
ui->socksPortLE->setText(QString::fromStdString(to_string(CurrentConfig.socksSetting.port)));
ui->socksAuthCB->setChecked(CurrentConfig.socksSetting.useAuthentication);
ui->socksAuthUsernameTxt->setText(QString::fromStdString(CurrentConfig.socksSetting.authUsername));
ui->socksAuthPasswordTxt->setText(QString::fromStdString(CurrentConfig.socksSetting.authPassword));
//
ui->httpPortLE->setValidator(new QIntValidator());
ui->socksPortLE->setValidator(new QIntValidator());
parentMW = parent;
@ -61,55 +58,9 @@ namespace Hv2ray
{
if (v2Instance::checkVCoreExes()) {
if (ui->httpPortLE->text().toInt() != ui->socksPortLE->text().toInt()) {
QJsonArray inbounds;
QJsonDocument modifiedDoc;
inbounds = rootObj.value("inbounds").toArray();
int socksId = getIndexByValue(inbounds, "tag", "socks-in");
if (socksId != -1) {
inbounds.removeAt(socksId);
}
int httpId = getIndexByValue(inbounds, "tag", "http-in");
if (httpId != -1) {
inbounds.removeAt(httpId);
}
rootObj.remove("inbounds");
rootObj.remove("v2suidEnabled");
if (ui->socksCB->isChecked()) {
QJsonObject socks;
QJsonObject settings;
socks.insert("tag", "socks-in");
socks.insert("port", ui->socksPortLE->text().toInt());
socks.insert("listen", "127.0.0.1");
socks.insert("protocol", "socks");
settings.insert("auth", "noauth");
settings.insert("udp", true);
settings.insert("ip", "127.0.0.1");
socks.insert("settings", QJsonValue(settings));
inbounds.append(socks);
}
if (ui->httpCB->isChecked()) {
QJsonObject http;
QJsonObject settings;
http.insert("tag", "http-in");
http.insert("port", ui->httpPortLE->text().toInt());
http.insert("listen", "127.0.0.1");
http.insert("protocol", "http");
settings.insert("auth", "noauth");
settings.insert("udp", true);
settings.insert("ip", "127.0.0.1");
http.insert("settings", QJsonValue(settings));
inbounds.append(http);
}
rootObj.insert("inbounds", QJsonValue(inbounds));
#ifndef _WIN32
// Set UID and GID in *nix
// The file is actually not here
QFileInfo v2rayCoreExeFile("v2ray");
if (ui->runAsRootCheckBox->isChecked() && v2rayCoreExeFile.ownerId() != 0) {
@ -123,21 +74,10 @@ namespace Hv2ray
}
v2rayCoreExeFile.refresh();
rootObj.insert("v2suidEnabled", v2rayCoreExeFile.ownerId() == 0);
//rootObj.insert("v2suidEnabled", v2rayCoreExeFile.ownerId() == 0);
#else
// No such uid gid thing on windows....
#endif
modifiedDoc.setObject(rootObj);
QByteArray byteArray = modifiedDoc.toJson(QJsonDocument::Indented);
QFile confFile("conf/Hv2ray.config.json");
if (!confFile.open(QIODevice::WriteOnly)) {
showWarnMessageBox(this, tr("#Prefrences"), tr("#CannotOpenConfigFile"));
qDebug() << "Cannot open Hv2ray.config.json for modifying";
}
confFile.write(byteArray);
confFile.close();
} else {
showWarnMessageBox(this, tr("Prefrences"), tr("PortNumbersCannotBeSame"));
}
@ -150,17 +90,15 @@ namespace Hv2ray
ui->httpPortLE->setDisabled(true);
} else {
ui->httpPortLE->setEnabled(true);
ui->httpPortLE->setText("6666");
}
}
void PrefrencesWindow::on_socksCB_stateChanged(int checked)
{
if (checked != Qt::Checked) {
ui->socksPortLE->setDisabled(true);
ui->socksPortLE->setEnabled(false);
} else {
ui->socksPortLE->setEnabled(true);
ui->socksPortLE->setText("1080");
}
}

View File

@ -3,7 +3,7 @@
#include <QDialog>
#include <ui_w_PrefrencesWindow.h>
#include <QJsonObject>
#include "HConfigObjects.hpp"
namespace Hv2ray
{
@ -16,7 +16,6 @@ namespace Hv2ray
public:
explicit PrefrencesWindow(QWidget *parent = nullptr);
~PrefrencesWindow();
QJsonObject rootObj;
QWidget *parentMW;
private slots:
@ -29,6 +28,7 @@ namespace Hv2ray
void on_runAsRootCheckBox_stateChanged(int arg1);
private:
Hv2ray::HConfigModels::Hv2Config CurrentConfig;
Ui_PrefrencesWindow *ui;
};
}

View File

@ -197,56 +197,56 @@
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="20"/>
<source>#ConnectionSettings</source>
<translation type="unfinished">Connection Settings</translation>
<translation>Connection Settings</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="28"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="335"/>
<source>#Host</source>
<translation type="unfinished">Host</translation>
<translation>Host</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="42"/>
<source>#Port</source>
<translation type="unfinished">Port</translation>
<translation>Port</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="56"/>
<source>#Name</source>
<translation type="unfinished">Name</translation>
<translation>Name</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="73"/>
<source>#UUID</source>
<translation type="unfinished">UUID</translation>
<translation>UUID</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="90"/>
<source>#AlterID</source>
<translation type="unfinished">Alter ID</translation>
<translation>Alter ID</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="104"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="702"/>
<source>#Security</source>
<translation type="unfinished">Security Settings</translation>
<translation>Security Settings</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="112"/>
<source>auto</source>
<translation type="unfinished">Auto</translation>
<translation>Auto</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="117"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="721"/>
<source>aes-128-gcm</source>
<translation type="unfinished">aes-128-gcm</translation>
<translation>aes-128-gcm</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="122"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="726"/>
<source>chacha20-poly1305</source>
<translation type="unfinished">chacha20-poly1305</translation>
<translation>chacha20-poly1305</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="127"/>
@ -255,199 +255,199 @@
<location filename="../src/w_ConnectionEditWindow.ui" line="716"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="783"/>
<source>none</source>
<translation type="unfinished">Do not use</translation>
<translation>Do not use</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="135"/>
<source>#Transport</source>
<translation type="unfinished">Transport Settings</translation>
<translation>Transport Settings</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="143"/>
<source>tcp (TCP)</source>
<translation type="unfinished">tcp (TCP)</translation>
<translation>tcp (TCP)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="148"/>
<source>http (HTTP)</source>
<translation type="unfinished">http (HTTP)</translation>
<translation>http (HTTP)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="153"/>
<source>ws (WebSocket)</source>
<translation type="unfinished">ws (WebSocket)</translation>
<translation>ws (WebSocket)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="158"/>
<source>kcp (mKCP)</source>
<translation type="unfinished">kcp (mKCP)</translation>
<translation>kcp (mKCP)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="163"/>
<source>domainsocket (Domain Socket)</source>
<translation type="unfinished">domainsocket (Domain Socket)</translation>
<translation>domainsocket (Domain Socket)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="168"/>
<source>quic (Quick UDP Internet Connection)</source>
<translation type="unfinished">quic (Quick UDP Internet Connection)</translation>
<translation>quic (Quick UDP Internet Connection)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="194"/>
<source>#TransportSettings</source>
<translation type="unfinished">Transport Settings</translation>
<translation>Transport Settings</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="225"/>
<source>TCP</source>
<translation type="unfinished">TCP</translation>
<translation>TCP</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="241"/>
<source>http</source>
<translation type="unfinished">HTTP</translation>
<translation>HTTP</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="249"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="618"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="769"/>
<source>#Type</source>
<translation type="unfinished">Type</translation>
<translation>Type</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="262"/>
<source>#Request</source>
<translation type="unfinished">Request</translation>
<translation>Request</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="282"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="310"/>
<source>#InsertDefaultContent</source>
<translation type="unfinished">Insert Default Content</translation>
<translation>Insert Default Content</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="293"/>
<source>#Response</source>
<translation type="unfinished">Response</translation>
<translation>Response</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="324"/>
<source>HTTP</source>
<translation type="unfinished">HTTP</translation>
<translation>HTTP</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="342"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="369"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="677"/>
<source>#Path</source>
<translation type="unfinished">Path</translation>
<translation>Path</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="359"/>
<source>WebSocket</source>
<translation type="unfinished">WebSocket</translation>
<translation>WebSocket</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="385"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="748"/>
<source>#Headers</source>
<translation type="unfinished">Headers</translation>
<translation>Headers</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="440"/>
<source>mKCP</source>
<translation type="unfinished">mKCP</translation>
<translation>mKCP</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="448"/>
<source>#MTU</source>
<translation type="unfinished">MTU</translation>
<translation>MTU</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="474"/>
<source>#TTI (ms)</source>
<translation type="unfinished">TTI (ms)</translation>
<translation>TTI (ms)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="500"/>
<source>#UplinkCapacity (MB/s)</source>
<translation type="unfinished">Uplink Capacity (MB/s)</translation>
<translation>Uplink Capacity (MB/s)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="523"/>
<source>#Congestion</source>
<translation type="unfinished">Congestion Control</translation>
<translation>Congestion Control</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="530"/>
<source>#Enabled</source>
<translation type="unfinished">Enabled</translation>
<translation>Enabled</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="541"/>
<source>#DownlinkCapacity (MB/s)</source>
<translation type="unfinished">Downlink Capacity (MB/s)</translation>
<translation>Downlink Capacity (MB/s)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="564"/>
<source>#ReadBufferSize (MB)</source>
<translation type="unfinished">Read Buffer Size (MB)</translation>
<translation>Read Buffer Size (MB)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="587"/>
<source>#WriteBufferSize (MB)</source>
<translation type="unfinished">Write Buffer Size (MB)</translation>
<translation>Write Buffer Size (MB)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="612"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="761"/>
<source>#Header</source>
<translation type="unfinished">Headers</translation>
<translation>Headers</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="637"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="788"/>
<source>srtp (SRTP, FaceTime)</source>
<translation type="unfinished">srtp (SRTP, FaceTime)</translation>
<translation>srtp (SRTP, FaceTime)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="642"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="793"/>
<source>utp (BitTorrent)</source>
<translation type="unfinished">utp (BitTorrent)</translation>
<translation>utp (BitTorrent)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="647"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="798"/>
<source>wechat-video (WeChat Video Message)</source>
<translation type="unfinished">wechat-video (WeChat Video Message)</translation>
<translation>wechat-video (WeChat Video Message)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="652"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="803"/>
<source>dtls (DTLS 1.2)</source>
<translation type="unfinished">dtls (DTLS 1.2)</translation>
<translation>dtls (DTLS 1.2)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="657"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="808"/>
<source>wireguard (WireGuard fake packets)</source>
<translation type="unfinished">wireguard (WireGuard fake packets)</translation>
<translation>wireguard (WireGuard fake packets)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="669"/>
<source>DomainSocket</source>
<translation type="unfinished">DomainSocket</translation>
<translation>DomainSocket</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="694"/>
<source>QUIC</source>
<translation type="unfinished">QUIC</translation>
<translation>QUIC</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="734"/>
<source>#Key</source>
<translation type="unfinished">Key</translation>
<translation>Key</translation>
</message>
</context>
<context>
@ -455,82 +455,82 @@
<message>
<location filename="../src/w_ImportConfig.ui" line="20"/>
<source>Import file</source>
<translation type="unfinished">Import file</translation>
<translation>Import file</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="28"/>
<source>#ImportFrom</source>
<translation type="unfinished">Import From</translation>
<translation>Import From</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="36"/>
<source>Existing File</source>
<translation type="unfinished">Existing File</translation>
<translation>Existing File</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="41"/>
<source>VMess Connection String</source>
<translation type="unfinished">VMess Connection String</translation>
<translation>VMess Connection String</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="51"/>
<source>#FromFile</source>
<translation type="unfinished">From file</translation>
<translation>From file</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="57"/>
<source>#Path</source>
<translation type="unfinished">Path</translation>
<translation>Path</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="73"/>
<source>#SelectFile</source>
<translation type="unfinished">Select File</translation>
<translation>Select File</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="82"/>
<source>#Name</source>
<translation type="unfinished">Name</translation>
<translation>Name</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="92"/>
<source>#Inbound</source>
<translation type="unfinished">Inbound Settings</translation>
<translation>Inbound Settings</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="101"/>
<source>#UseCurrent</source>
<translation type="unfinished">Use Current Settings</translation>
<translation>Use Current Settings</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="111"/>
<source>#UseImported</source>
<translation type="unfinished">Use Imported Inbound Settings</translation>
<translation>Use Imported Inbound Settings</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="123"/>
<source>#From VMess Connection String</source>
<translation type="unfinished">From VMess Connection String</translation>
<translation>From VMess Connection String</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="129"/>
<source>#VMess Connection String</source>
<translation type="unfinished">VMess Connection String</translation>
<translation>VMess Connection String</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.cpp" line="38"/>
<source>OpenConfigFile</source>
<translation type="unfinished">Open Config File</translation>
<translation>Open Config File</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.cpp" line="125"/>
<source>ImportConfig</source>
<translation type="unfinished">Import Config</translation>
<translation>Import Config</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.cpp" line="125"/>
<source>CannotGenerateConfig</source>
<translation type="unfinished">Failed to generate config file</translation>
<translation>Failed to generate config file</translation>
</message>
</context>
<context>
@ -539,147 +539,147 @@
<location filename="../src/w_MainWindow.ui" line="26"/>
<location filename="../src/w_MainWindow.cpp" line="25"/>
<source>Hv2ray</source>
<translation type="unfinished">Hv2ray</translation>
<translation>Hv2ray</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="46"/>
<location filename="../src/w_MainWindow.cpp" line="35"/>
<source>#Start</source>
<translation type="unfinished">Start</translation>
<translation>Start</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="53"/>
<location filename="../src/w_MainWindow.cpp" line="36"/>
<source>#Stop</source>
<translation type="unfinished">Stop</translation>
<translation>Stop</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="60"/>
<location filename="../src/w_MainWindow.cpp" line="37"/>
<source>#Restart</source>
<translation type="unfinished">Restart</translation>
<translation>Restart</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="70"/>
<source>#ClearLog</source>
<translation type="unfinished">Clear Log</translation>
<translation>Clear Log</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="97"/>
<source>#HostList</source>
<translation type="unfinished">Host List</translation>
<translation>Host List</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="140"/>
<source>#ConfigDetail</source>
<translation type="unfinished">Detailed Config Info</translation>
<translation>Detailed Config Info</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="152"/>
<source>#Host</source>
<translation type="unfinished">Host</translation>
<translation>Host</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="166"/>
<source>#Port</source>
<translation type="unfinished">Port</translation>
<translation>Port</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="180"/>
<source>#UUID</source>
<translation type="unfinished">UUID</translation>
<translation>UUID</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="194"/>
<source>#Transport</source>
<translation type="unfinished">Transport Settings</translation>
<translation>Transport Settings</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="214"/>
<location filename="../src/w_MainWindow.ui" line="221"/>
<source>#ConnectionSettings</source>
<translation type="unfinished">Connection Settings</translation>
<translation>Connection Settings</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="252"/>
<source>#File</source>
<translation type="unfinished">File</translation>
<translation>File</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="256"/>
<source>#NewConnection</source>
<translation type="unfinished">New Connection</translation>
<translation>New Connection</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="271"/>
<source>#ManuallyInput</source>
<translation type="unfinished">Manually Input Config</translation>
<translation>Manually Input Config</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="276"/>
<source>#ImportConnection</source>
<translation type="unfinished">Import Config File</translation>
<translation>Import Config File</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="281"/>
<source>#Exit</source>
<translation type="unfinished">Exit</translation>
<translation>Exit</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="286"/>
<source>#Preferences</source>
<translation type="unfinished">Preferences</translation>
<translation>Preferences</translation>
</message>
<message>
<location filename="../src/w_MainWindow.cpp" line="33"/>
<location filename="../src/w_MainWindow.cpp" line="236"/>
<source>#Hide</source>
<translation type="unfinished">Hide</translation>
<translation>Hide</translation>
</message>
<message>
<location filename="../src/w_MainWindow.cpp" line="34"/>
<source>#Quit</source>
<translation type="unfinished">Quit</translation>
<translation>Quit</translation>
</message>
<message>
<location filename="../src/w_MainWindow.cpp" line="239"/>
<source>#Show</source>
<translation type="unfinished">Show</translation>
<translation>Show</translation>
</message>
</context>
<context>
<name>Hv2ray::Ui::PrefrencesWindow</name>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="20"/>
<location filename="../src/w_PrefrencesWindow.cpp" line="142"/>
<location filename="../src/w_PrefrencesWindow.cpp" line="177"/>
<location filename="../src/w_PrefrencesWindow.cpp" line="66"/>
<location filename="../src/w_PrefrencesWindow.cpp" line="99"/>
<source>Prefrences</source>
<translation type="unfinished">Preferences</translation>
<translation>Preferences</translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="26"/>
<source>#General</source>
<translation type="unfinished">General</translation>
<translation>General</translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="34"/>
<source>#Language</source>
<translation type="unfinished">Language</translation>
<translation>Language</translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="48"/>
<source>zh-CN</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="53"/>
<source>en-US</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="61"/>
<source>#RunAsRoot</source>
<translation type="unfinished">Run v2ray as root</translation>
<translation>Run v2ray as root</translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="68"/>
@ -690,7 +690,7 @@
<location filename="../src/w_PrefrencesWindow.ui" line="270"/>
<location filename="../src/w_PrefrencesWindow.ui" line="298"/>
<source>#Enabled</source>
<translation type="unfinished">Enabled</translation>
<translation>Enabled</translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="75"/>
@ -769,37 +769,35 @@
<location filename="../src/w_PrefrencesWindow.ui" line="227"/>
<location filename="../src/w_PrefrencesWindow.ui" line="291"/>
<source>#Password</source>
<translation type="unfinished">Password</translation>
<translation>Password</translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="250"/>
<source>SOCKS</source>
<translation type="unfinished">SOCKS</translation>
<translation>SOCKS</translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="263"/>
<source>9001</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.cpp" line="135"/>
<source>#Prefrences</source>
<translation type="unfinished">Preferences</translation>
<translation type="obsolete">Preferences</translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.cpp" line="135"/>
<source>#CannotOpenConfigFile</source>
<translation type="unfinished">Cannot open config file</translation>
<translation type="obsolete">Cannot open config file</translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.cpp" line="142"/>
<location filename="../src/w_PrefrencesWindow.cpp" line="66"/>
<source>PortNumbersCannotBeSame</source>
<translation type="unfinished">Port numbers cannot be the same</translation>
<translation>Port numbers cannot be the same</translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.cpp" line="177"/>
<location filename="../src/w_PrefrencesWindow.cpp" line="99"/>
<source>RunAsRootNotOnWindows</source>
<translation type="unfinished">Run as root is not avaliable on Windows Platform</translation>
<translation>Run as root is not avaliable on Windows Platform</translation>
</message>
</context>
<context>
@ -1070,12 +1068,12 @@
<context>
<name>QObject</name>
<message>
<location filename="../src/main.cpp" line="99"/>
<location filename="../src/main.cpp" line="73"/>
<source>Hv2Ray</source>
<translation>Hv2ray</translation>
</message>
<message>
<location filename="../src/main.cpp" line="99"/>
<location filename="../src/main.cpp" line="73"/>
<source>AnotherInstanceRunning</source>
<translation>Another instance is already running</translation>
</message>

View File

@ -197,56 +197,56 @@
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="20"/>
<source>#ConnectionSettings</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="28"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="335"/>
<source>#Host</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="42"/>
<source>#Port</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="56"/>
<source>#Name</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="73"/>
<source>#UUID</source>
<translation type="unfinished">UUID</translation>
<translation>UUID</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="90"/>
<source>#AlterID</source>
<translation type="unfinished">Alter ID</translation>
<translation>Alter ID</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="104"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="702"/>
<source>#Security</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="112"/>
<source>auto</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="117"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="721"/>
<source>aes-128-gcm</source>
<translation type="unfinished">aes-128-gcm</translation>
<translation>aes-128-gcm</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="122"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="726"/>
<source>chacha20-poly1305</source>
<translation type="unfinished">chacha20-poly1305</translation>
<translation>chacha20-poly1305</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="127"/>
@ -255,199 +255,199 @@
<location filename="../src/w_ConnectionEditWindow.ui" line="716"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="783"/>
<source>none</source>
<translation type="unfinished">使</translation>
<translation>使</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="135"/>
<source>#Transport</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="143"/>
<source>tcp (TCP)</source>
<translation type="unfinished">tcp (TCP)</translation>
<translation>tcp (TCP)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="148"/>
<source>http (HTTP)</source>
<translation type="unfinished">http (HTTP)</translation>
<translation>http (HTTP)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="153"/>
<source>ws (WebSocket)</source>
<translation type="unfinished">ws (WebSocket)</translation>
<translation>ws (WebSocket)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="158"/>
<source>kcp (mKCP)</source>
<translation type="unfinished">kcp (mKCP)</translation>
<translation>kcp (mKCP)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="163"/>
<source>domainsocket (Domain Socket)</source>
<translation type="unfinished">domainsocket (Domain Socket)</translation>
<translation>domainsocket (Domain Socket)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="168"/>
<source>quic (Quick UDP Internet Connection)</source>
<translation type="unfinished">quic (Quick UDP Internet Connection)</translation>
<translation>quic (Quick UDP Internet Connection)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="194"/>
<source>#TransportSettings</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="225"/>
<source>TCP</source>
<translation type="unfinished">TCP</translation>
<translation>TCP</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="241"/>
<source>http</source>
<translation type="unfinished">HTTP</translation>
<translation>HTTP</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="249"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="618"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="769"/>
<source>#Type</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="262"/>
<source>#Request</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="282"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="310"/>
<source>#InsertDefaultContent</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="293"/>
<source>#Response</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="324"/>
<source>HTTP</source>
<translation type="unfinished">HTTP</translation>
<translation>HTTP</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="342"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="369"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="677"/>
<source>#Path</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="359"/>
<source>WebSocket</source>
<translation type="unfinished">WebSocket</translation>
<translation>WebSocket</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="385"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="748"/>
<source>#Headers</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="440"/>
<source>mKCP</source>
<translation type="unfinished">mKCP</translation>
<translation>mKCP</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="448"/>
<source>#MTU</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="474"/>
<source>#TTI (ms)</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="500"/>
<source>#UplinkCapacity (MB/s)</source>
<translation type="unfinished"> (MB/s)</translation>
<translation> (MB/s)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="523"/>
<source>#Congestion</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="530"/>
<source>#Enabled</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="541"/>
<source>#DownlinkCapacity (MB/s)</source>
<translation type="unfinished"> (MB/s)</translation>
<translation> (MB/s)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="564"/>
<source>#ReadBufferSize (MB)</source>
<translation type="unfinished"> (MB)</translation>
<translation> (MB)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="587"/>
<source>#WriteBufferSize (MB)</source>
<translation type="unfinished"> (MB)</translation>
<translation> (MB)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="612"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="761"/>
<source>#Header</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="637"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="788"/>
<source>srtp (SRTP, FaceTime)</source>
<translation type="unfinished">srtp (SRTP, FaceTime)</translation>
<translation>srtp (SRTP, FaceTime)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="642"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="793"/>
<source>utp (BitTorrent)</source>
<translation type="unfinished">utp (BitTorrent)</translation>
<translation>utp (BitTorrent)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="647"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="798"/>
<source>wechat-video (WeChat Video Message)</source>
<translation type="unfinished">wechat-video (WeChat Video Message)</translation>
<translation>wechat-video (WeChat Video Message)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="652"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="803"/>
<source>dtls (DTLS 1.2)</source>
<translation type="unfinished">dtls (DTLS 1.2)</translation>
<translation>dtls (DTLS 1.2)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="657"/>
<location filename="../src/w_ConnectionEditWindow.ui" line="808"/>
<source>wireguard (WireGuard fake packets)</source>
<translation type="unfinished">wireguard (WireGuard fake packets)</translation>
<translation>wireguard (WireGuard fake packets)</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="669"/>
<source>DomainSocket</source>
<translation type="unfinished">DomainSocket</translation>
<translation>DomainSocket</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="694"/>
<source>QUIC</source>
<translation type="unfinished">QUIC</translation>
<translation>QUIC</translation>
</message>
<message>
<location filename="../src/w_ConnectionEditWindow.ui" line="734"/>
<source>#Key</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
</context>
<context>
@ -455,82 +455,82 @@
<message>
<location filename="../src/w_ImportConfig.ui" line="20"/>
<source>Import file</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="28"/>
<source>#ImportFrom</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="36"/>
<source>Existing File</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="41"/>
<source>VMess Connection String</source>
<translation type="unfinished">VMess </translation>
<translation>VMess </translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="51"/>
<source>#FromFile</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="57"/>
<source>#Path</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="73"/>
<source>#SelectFile</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="82"/>
<source>#Name</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="92"/>
<source>#Inbound</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="101"/>
<source>#UseCurrent</source>
<translation type="unfinished">使</translation>
<translation>使</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="111"/>
<source>#UseImported</source>
<translation type="unfinished">使</translation>
<translation>使</translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="123"/>
<source>#From VMess Connection String</source>
<translation type="unfinished"> VMess </translation>
<translation> VMess </translation>
</message>
<message>
<location filename="../src/w_ImportConfig.ui" line="129"/>
<source>#VMess Connection String</source>
<translation type="unfinished">VMess </translation>
<translation>VMess </translation>
</message>
<message>
<location filename="../src/w_ImportConfig.cpp" line="38"/>
<source>OpenConfigFile</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ImportConfig.cpp" line="125"/>
<source>ImportConfig</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_ImportConfig.cpp" line="125"/>
<source>CannotGenerateConfig</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
</context>
<context>
@ -539,147 +539,147 @@
<location filename="../src/w_MainWindow.ui" line="26"/>
<location filename="../src/w_MainWindow.cpp" line="25"/>
<source>Hv2ray</source>
<translation type="unfinished">Hv2ray</translation>
<translation>Hv2ray</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="46"/>
<location filename="../src/w_MainWindow.cpp" line="35"/>
<source>#Start</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="53"/>
<location filename="../src/w_MainWindow.cpp" line="36"/>
<source>#Stop</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="60"/>
<location filename="../src/w_MainWindow.cpp" line="37"/>
<source>#Restart</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="70"/>
<source>#ClearLog</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="97"/>
<source>#HostList</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="140"/>
<source>#ConfigDetail</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="152"/>
<source>#Host</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="166"/>
<source>#Port</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="180"/>
<source>#UUID</source>
<translation type="unfinished">UUID</translation>
<translation>UUID</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="194"/>
<source>#Transport</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="214"/>
<location filename="../src/w_MainWindow.ui" line="221"/>
<source>#ConnectionSettings</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="252"/>
<source>#File</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="256"/>
<source>#NewConnection</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="271"/>
<source>#ManuallyInput</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="276"/>
<source>#ImportConnection</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="281"/>
<source>#Exit</source>
<translation type="unfinished">退</translation>
<translation>退</translation>
</message>
<message>
<location filename="../src/w_MainWindow.ui" line="286"/>
<source>#Preferences</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.cpp" line="33"/>
<location filename="../src/w_MainWindow.cpp" line="236"/>
<source>#Hide</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_MainWindow.cpp" line="34"/>
<source>#Quit</source>
<translation type="unfinished">退</translation>
<translation>退</translation>
</message>
<message>
<location filename="../src/w_MainWindow.cpp" line="239"/>
<source>#Show</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
</context>
<context>
<name>Hv2ray::Ui::PrefrencesWindow</name>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="20"/>
<location filename="../src/w_PrefrencesWindow.cpp" line="142"/>
<location filename="../src/w_PrefrencesWindow.cpp" line="177"/>
<location filename="../src/w_PrefrencesWindow.cpp" line="66"/>
<location filename="../src/w_PrefrencesWindow.cpp" line="99"/>
<source>Prefrences</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="26"/>
<source>#General</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="34"/>
<source>#Language</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="48"/>
<source>zh-CN</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="53"/>
<source>en-US</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="61"/>
<source>#RunAsRoot</source>
<translation type="unfinished">使 root </translation>
<translation>使 root </translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="68"/>
@ -690,7 +690,7 @@
<location filename="../src/w_PrefrencesWindow.ui" line="270"/>
<location filename="../src/w_PrefrencesWindow.ui" line="298"/>
<source>#Enabled</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="75"/>
@ -769,37 +769,35 @@
<location filename="../src/w_PrefrencesWindow.ui" line="227"/>
<location filename="../src/w_PrefrencesWindow.ui" line="291"/>
<source>#Password</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="250"/>
<source>SOCKS</source>
<translation type="unfinished">SOCKS</translation>
<translation>SOCKS</translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.ui" line="263"/>
<source>9001</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.cpp" line="135"/>
<source>#Prefrences</source>
<translation type="unfinished"></translation>
<translation type="obsolete"></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.cpp" line="135"/>
<source>#CannotOpenConfigFile</source>
<translation type="unfinished"></translation>
<translation type="obsolete"></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.cpp" line="142"/>
<location filename="../src/w_PrefrencesWindow.cpp" line="66"/>
<source>PortNumbersCannotBeSame</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/w_PrefrencesWindow.cpp" line="177"/>
<location filename="../src/w_PrefrencesWindow.cpp" line="99"/>
<source>RunAsRootNotOnWindows</source>
<translation type="unfinished">Windows </translation>
<translation>Windows </translation>
</message>
</context>
<context>
@ -1070,12 +1068,12 @@
<context>
<name>QObject</name>
<message>
<location filename="../src/main.cpp" line="99"/>
<location filename="../src/main.cpp" line="73"/>
<source>Hv2Ray</source>
<translation>Hv2ray</translation>
</message>
<message>
<location filename="../src/main.cpp" line="99"/>
<location filename="../src/main.cpp" line="73"/>
<source>AnotherInstanceRunning</source>
<translation></translation>
</message>