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:
@@ -18,12 +18,14 @@ type Provider struct {
|
||||
}
|
||||
|
||||
func (settings *Provider) lines() (lines []string) {
|
||||
if settings.Name == "" { // custom OpenVPN configuration
|
||||
return nil
|
||||
}
|
||||
|
||||
lines = append(lines, lastIndent+strings.Title(settings.Name)+" settings:")
|
||||
|
||||
selection := settings.ServerSelection
|
||||
|
||||
lines = append(lines, indent+lastIndent+"Network protocol: "+protoToString(selection.TCP))
|
||||
|
||||
if selection.TargetIP != nil {
|
||||
lines = append(lines, indent+lastIndent+"Target IP address: "+selection.TargetIP.String())
|
||||
}
|
||||
@@ -153,14 +155,6 @@ func commaJoin(slice []string) string {
|
||||
return strings.Join(slice, ", ")
|
||||
}
|
||||
|
||||
func readProtocol(env params.Env) (tcp bool, err error) {
|
||||
protocol, err := env.Inside("PROTOCOL", []string{constants.TCP, constants.UDP}, params.Default(constants.UDP))
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("environment variable PROTOCOL: %w", err)
|
||||
}
|
||||
return protocol == constants.TCP, nil
|
||||
}
|
||||
|
||||
func protoToString(tcp bool) string {
|
||||
if tcp {
|
||||
return constants.TCP
|
||||
|
||||
Reference in New Issue
Block a user