Maint: configuration Openvpn selection structure

- Move network protocol from ServerSelection to OpenVPNSelection child
- Move PIA encryption preset from ServerSelection to OpenVPNSelection child
- Move custom port from ServerSelection to OpenVPNSelection child
This commit is contained in:
Quentin McGaw (desktop)
2021-08-17 16:54:22 +00:00
parent cc2235653a
commit 9105b33e9f
57 changed files with 321 additions and 282 deletions
+3 -3
View File
@@ -11,13 +11,13 @@ func (h *HideMyAss) GetOpenVPNConnection(selection configuration.ServerSelection
connection models.OpenVPNConnection, err error) {
var port uint16 = 553
protocol := constants.UDP
if selection.TCP {
if selection.OpenVPN.TCP {
protocol = constants.TCP
port = 8080
}
if selection.CustomPort > 0 {
port = selection.CustomPort
if selection.OpenVPN.CustomPort > 0 {
port = selection.OpenVPN.CustomPort
}
servers, err := h.filterServers(selection)
+2 -2
View File
@@ -14,8 +14,8 @@ func (h *HideMyAss) filterServers(selection configuration.ServerSelection) (
utils.FilterByPossibilities(server.Country, selection.Countries),
utils.FilterByPossibilities(server.City, selection.Cities),
utils.FilterByPossibilities(server.Hostname, selection.Hostnames),
selection.TCP && !server.TCP,
!selection.TCP && !server.UDP:
selection.OpenVPN.TCP && !server.TCP,
!selection.OpenVPN.TCP && !server.UDP:
default:
servers = append(servers, server)
}