parent
9f82b4c21f
commit
e646b85e56
29 changed files with 512 additions and 56 deletions
|
@ -251,6 +251,19 @@ bool Daemon::parseConfig(const QJsonObject& obj, InterfaceConfig& config) {
|
|||
GETVALUE("serverPskKey", config.m_serverPskKey, String);
|
||||
GETVALUE("serverPort", config.m_serverPort, Double);
|
||||
|
||||
if (!obj.contains("deviceMTU") || obj.value("deviceMTU").toString().toInt() == 0)
|
||||
{
|
||||
config.m_deviceMTU = 1420;
|
||||
} else {
|
||||
config.m_deviceMTU = obj.value("deviceMTU").toString().toInt();
|
||||
#ifdef Q_OS_WINDOWS
|
||||
// For Windows min MTU value is 1280 (the smallest MTU legal with IPv6).
|
||||
if (config.m_deviceMTU < 1280) {
|
||||
config.m_deviceMTU = 1280;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
config.m_deviceIpv4Address = obj.value("deviceIpv4Address").toString();
|
||||
config.m_deviceIpv6Address = obj.value("deviceIpv6Address").toString();
|
||||
if (config.m_deviceIpv4Address.isNull() &&
|
||||
|
|
|
@ -23,6 +23,7 @@ QJsonObject InterfaceConfig::toJson() const {
|
|||
json.insert("serverIpv4AddrIn", QJsonValue(m_serverIpv4AddrIn));
|
||||
json.insert("serverIpv6AddrIn", QJsonValue(m_serverIpv6AddrIn));
|
||||
json.insert("serverPort", QJsonValue((double)m_serverPort));
|
||||
json.insert("deviceMTU", QJsonValue(m_deviceMTU));
|
||||
if ((m_hopType == InterfaceConfig::MultiHopExit) ||
|
||||
(m_hopType == InterfaceConfig::SingleHop)) {
|
||||
json.insert("serverIpv4Gateway", QJsonValue(m_serverIpv4Gateway));
|
||||
|
@ -85,8 +86,13 @@ QString InterfaceConfig::toWgConf(const QMap<QString, QString>& extra) const {
|
|||
if (addresses.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
out << "Address = " << addresses.join(", ") << "\n";
|
||||
|
||||
if (m_deviceMTU) {
|
||||
out << "MTU = " << m_deviceMTU << "\n";
|
||||
}
|
||||
|
||||
if (!m_dnsServer.isNull()) {
|
||||
QStringList dnsServers(m_dnsServer);
|
||||
// If the DNS is not the Gateway, it's a user defined DNS
|
||||
|
|
|
@ -33,6 +33,7 @@ class InterfaceConfig {
|
|||
QString m_serverIpv6AddrIn;
|
||||
QString m_dnsServer;
|
||||
int m_serverPort = 0;
|
||||
int m_deviceMTU = 1420;
|
||||
QList<IPAddress> m_allowedIPAddressRanges;
|
||||
QStringList m_excludedAddresses;
|
||||
QStringList m_vpnDisabledApps;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue