Feature: Protonvpn filter servers with FREE_ONLY
This commit is contained in:
@@ -40,7 +40,8 @@ func Test_OpenVPN_JSON(t *testing.T) {
|
||||
"owned": false,
|
||||
"custom_port": 0,
|
||||
"numbers": null,
|
||||
"encryption_preset": ""
|
||||
"encryption_preset": "",
|
||||
"free_only": false
|
||||
},
|
||||
"extra_config": {
|
||||
"encryption_preset": "",
|
||||
|
||||
@@ -2,6 +2,7 @@ package configuration
|
||||
|
||||
import (
|
||||
"github.com/qdm12/gluetun/internal/constants"
|
||||
"github.com/qdm12/golibs/params"
|
||||
)
|
||||
|
||||
func (settings *Provider) protonvpnLines() (lines []string) {
|
||||
@@ -25,6 +26,10 @@ func (settings *Provider) protonvpnLines() (lines []string) {
|
||||
lines = append(lines, lastIndent+"Hostnames: "+commaJoin(settings.ServerSelection.Hostnames))
|
||||
}
|
||||
|
||||
if settings.ServerSelection.FreeOnly {
|
||||
lines = append(lines, lastIndent+"Free only: yes")
|
||||
}
|
||||
|
||||
return lines
|
||||
}
|
||||
|
||||
@@ -71,5 +76,10 @@ func (settings *Provider) readProtonvpn(r reader) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
settings.ServerSelection.FreeOnly, err = r.env.YesNo("FREE_ONLY", params.Default("no"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ type ServerSelection struct { //nolint:maligned
|
||||
|
||||
// PIA
|
||||
EncryptionPreset string `json:"encryption_preset"`
|
||||
|
||||
// ProtonVPN
|
||||
FreeOnly bool `json:"free_only"`
|
||||
}
|
||||
|
||||
type ExtraConfigOptions struct {
|
||||
|
||||
Reference in New Issue
Block a user