Maint: migrate PROTOCOL to OPENVPN_PROTOCOL

This commit is contained in:
Quentin McGaw (desktop)
2021-09-14 19:27:13 +00:00
parent dc6171185e
commit 61677fbce2
22 changed files with 46 additions and 43 deletions

View File

@@ -176,10 +176,11 @@ func (settings *OpenVPN) read(r reader, serviceProvider string) (err error) {
return nil
}
func readProtocol(env params.Interface) (tcp bool, err error) {
protocol, err := env.Inside("PROTOCOL", []string{constants.TCP, constants.UDP}, params.Default(constants.UDP))
func readOpenVPNProtocol(r reader) (tcp bool, err error) {
protocol, err := r.env.Inside("OPENVPN_PROTOCOL", []string{constants.TCP, constants.UDP},
params.Default(constants.UDP), params.RetroKeys([]string{"PROTOCOL"}, r.onRetroActive))
if err != nil {
return false, fmt.Errorf("environment variable PROTOCOL: %w", err)
return false, fmt.Errorf("environment variable OPENVPN_PROTOCOL: %w", err)
}
return protocol == constants.TCP, nil
}