- Goal was to simplify main.go complexity
- Use common structures and interfaces for all vpn providers
- Moved files around
- Removed some alias models
This commit is contained in:
Quentin McGaw
2020-06-13 14:08:29 -04:00
committed by GitHub
parent 4f502abcf8
commit 7369808b84
47 changed files with 1530 additions and 1693 deletions

View File

@@ -1,35 +1,29 @@
package params
import (
"strings"
libparams "github.com/qdm12/golibs/params"
"github.com/qdm12/private-internet-access-docker/internal/constants"
"github.com/qdm12/private-internet-access-docker/internal/models"
)
// GetMullvadCountry obtains the country for the Mullvad server from the
// environment variable COUNTRY
func (r *reader) GetMullvadCountry() (country models.MullvadCountry, err error) {
func (r *reader) GetMullvadCountry() (country string, err error) {
choices := append(constants.MullvadCountryChoices(), "")
s, err := r.envParams.GetValueIfInside("COUNTRY", choices)
return models.MullvadCountry(strings.ToLower(s)), err
return r.envParams.GetValueIfInside("COUNTRY", choices)
}
// GetMullvadCity obtains the city for the Mullvad server from the
// environment variable CITY
func (r *reader) GetMullvadCity() (country models.MullvadCity, err error) {
func (r *reader) GetMullvadCity() (country string, err error) {
choices := append(constants.MullvadCityChoices(), "")
s, err := r.envParams.GetValueIfInside("CITY", choices)
return models.MullvadCity(strings.ToLower(s)), err
return r.envParams.GetValueIfInside("CITY", choices)
}
// GetMullvadISP obtains the ISP for the Mullvad server from the
// environment variable ISP
func (r *reader) GetMullvadISP() (country models.MullvadProvider, err error) {
choices := append(constants.MullvadProviderChoices(), "")
s, err := r.envParams.GetValueIfInside("ISP", choices)
return models.MullvadProvider(strings.ToLower(s)), err
func (r *reader) GetMullvadISP() (isp string, err error) {
choices := append(constants.MullvadISPChoices(), "")
return r.envParams.GetValueIfInside("ISP", choices)
}
// GetMullvadPort obtains the port to reach the Mullvad server on from the