This commit is contained in:
Quentin McGaw
2020-08-30 14:48:57 +00:00
parent aac5274eab
commit 7c102c0028
11 changed files with 262 additions and 18 deletions

View File

@@ -8,19 +8,29 @@ import (
"github.com/qdm12/gluetun/internal/params"
)
const (
enabled = "enabled"
disabled = "disabled"
)
// Settings contains all settings for the program to run
type Settings struct {
VPNSP models.VPNProvider
OpenVPN OpenVPN
System System
DNS DNS
Firewall Firewall
TinyProxy TinyProxy
ShadowSocks ShadowSocks
PublicIPPeriod time.Duration
VPNSP models.VPNProvider
OpenVPN OpenVPN
System System
DNS DNS
Firewall Firewall
TinyProxy TinyProxy
ShadowSocks ShadowSocks
PublicIPPeriod time.Duration
VersionInformation bool
}
func (s *Settings) String() string {
versionInformation := disabled
if s.VersionInformation {
versionInformation = enabled
}
return strings.Join([]string{
"Settings summary below:",
s.OpenVPN.String(),
@@ -30,6 +40,7 @@ func (s *Settings) String() string {
s.TinyProxy.String(),
s.ShadowSocks.String(),
"Public IP check period: " + s.PublicIPPeriod.String(),
"Version information: " + versionInformation,
"", // new line at the end
}, "\n")
}
@@ -69,5 +80,9 @@ func GetAllSettings(paramsReader params.Reader) (settings Settings, err error) {
if err != nil {
return settings, err
}
settings.VersionInformation, err = paramsReader.GetVersionInformation()
if err != nil {
return settings, err
}
return settings, nil
}