added protocol settings pages and models for openvpn, cloak and shadowsocks

This commit is contained in:
vladimir.kuznetsov 2023-07-13 11:29:26 +09:00
parent a97417fd38
commit c13b9754eb
42 changed files with 2130 additions and 576 deletions

View file

@ -1,147 +0,0 @@
import QtQuick 2.15
import QtQuick.Controls
import QtQuick.Layouts
import "../../Controls2"
import "../../Controls2/TextTypes"
import "../../Components"
Item {
id: root
implicitHeight: col.implicitHeight
implicitWidth: col.implicitWidth
ColumnLayout {
id: col
anchors.fill: parent
anchors.leftMargin: 16
anchors.rightMargin: 16
spacing: 16
Header2TextType {
Layout.fillWidth: true
text: "OpenVpn"
}
TextFieldWithHeaderType {
Layout.fillWidth: true
headerText: qsTr("VPN Addresses Subnet")
}
ParagraphTextType {
Layout.fillWidth: true
text: qsTr("Network protocol")
}
TransportProtoSelector {
Layout.fillWidth: true
}
TextFieldWithHeaderType {
Layout.fillWidth: true
headerText: qsTr("Port")
}
SwitcherType {
Layout.fillWidth: true
text: qsTr("Auto-negotiate encryption")
}
DropDownType {
id: hash
Layout.fillWidth: true
implicitHeight: 74
descriptionText: qsTr("Hash")
headerText: qsTr("Hash")
listView: ListViewType {
rootWidth: root.width
model: ListModel {
ListElement { name : qsTr("SHA512") }
ListElement { name : qsTr("SHA384") }
ListElement { name : qsTr("SHA256") }
ListElement { name : qsTr("SHA3-512") }
ListElement { name : qsTr("SHA3-384") }
ListElement { name : qsTr("SHA3-256") }
ListElement { name : qsTr("whirlpool") }
ListElement { name : qsTr("BLAKE2b512") }
ListElement { name : qsTr("BLAKE2s256") }
ListElement { name : qsTr("SHA1") }
}
currentIndex: 0
clickedFunction: {
hash.text = selectedText
hash.menuVisible = false
}
Component.onCompleted: {
hash.text = selectedText
}
}
}
DropDownType {
id: cipher
Layout.fillWidth: true
implicitHeight: 74
descriptionText: qsTr("Cipher")
headerText: qsTr("Cipher")
listView: ListViewType {
rootWidth: root.width
model: ListModel {
ListElement { name : qsTr("AES-256-GCM") }
ListElement { name : qsTr("AES-192-GCM") }
ListElement { name : qsTr("AES-128-GCM") }
ListElement { name : qsTr("AES-256-CBC") }
ListElement { name : qsTr("AES-192-CBC") }
ListElement { name : qsTr("AES-128-CBC") }
ListElement { name : qsTr("ChaCha20-Poly1305") }
ListElement { name : qsTr("ARIA-256-CBC") }
ListElement { name : qsTr("CAMELLIA-256-CBC") }
ListElement { name : qsTr("none") }
}
currentIndex: 0
clickedFunction: {
cipher.text = selectedText
cipher.menuVisible = false
}
Component.onCompleted: {
cipher.text = selectedText
}
}
}
CheckBoxType {
Layout.fillWidth: true
text: qsTr("TLS auth")
}
CheckBoxType {
Layout.fillWidth: true
text: qsTr("Block DNS requests outside of VPN")
}
SwitcherType {
Layout.fillWidth: true
text: qsTr("Additional configuration commands")
}
}
}

View file

@ -6,6 +6,7 @@ import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerEnum 1.0
import "../Controls2"
import "../Controls2/TextTypes"
@ -88,8 +89,32 @@ ListView {
onClicked: {
if (isInstalled) {
ContainersModel.setCurrentlyProcessedContainerIndex(root.model.mapToSource(index))
goToPage(PageEnum.PageSettingsServerProtocol)
var containerIndex = root.model.mapToSource(index)
ContainersModel.setCurrentlyProcessedContainerIndex(containerIndex)
switch (containerIndex) {
case ContainerEnum.OpenVpn: {
OpenVpnConfigModel.updateModel(ProtocolsModel.getConfig())
goToPage(PageEnum.PageProtocolOpenVpnSettings)
break
}
case ContainerEnum.WireGuard: {
WireGuardConfigModel.updateModel(ProtocolsModel.getConfig())
goToPage(PageEnum.PageProtocolWireGuardSettings)
break
}
case ContainerEnum.Ipsec: {
Ikev2ConfigModel.updateModel(ProtocolsModel.getConfig())
goToPage(PageEnum.PageProtocolIKev2Settings)
break
}
default: {
if (serviceType !== ProtocolEnum.Other) { //todo disable settings for dns container
ProtocolsModel.updateModel(config)
goToPage(PageEnum.PageSettingsServerProtocol)
}
}
}
} else {
ContainersModel.setCurrentlyProcessedContainerIndex(root.model.mapToSource(index))
InstallController.setShouldCreateServer(false)

View file

@ -75,9 +75,9 @@ DrawerType {
text: qsTr("Copy")
onClicked: {
configContent.selectAll()
configContent.copy()
configContent.select(0, 0)
configText.selectAll()
configText.copy()
configText.select(0, 0)
}
}
@ -138,6 +138,8 @@ DrawerType {
}
TextArea {
id: configText
Layout.fillWidth: true
Layout.topMargin: 16
Layout.bottomMargin: 16

View file

@ -25,6 +25,8 @@ Rectangle {
HorizontalRadioButton {
checked: root.currentIndex === 0
hoverEnabled: root.enabled
implicitWidth: (rootWidth - 32) / 2
text: "UDP"
@ -36,6 +38,8 @@ Rectangle {
HorizontalRadioButton {
checked: root.currentIndex === 1
hoverEnabled: root.enabled
implicitWidth: (rootWidth - 32) / 2
text: "TCP"