2021-05-23 17:40:14 +00:00
|
|
|
package utils
|
|
|
|
|
|
2021-05-31 18:54:36 +00:00
|
|
|
import (
|
2021-10-05 20:36:23 +00:00
|
|
|
"strings"
|
|
|
|
|
|
2021-05-31 18:54:36 +00:00
|
|
|
"github.com/qdm12/gluetun/internal/constants"
|
|
|
|
|
)
|
2021-05-23 17:40:14 +00:00
|
|
|
|
2021-10-05 20:36:23 +00:00
|
|
|
func CipherLines(ciphers []string, version string) (lines []string) {
|
2022-04-25 07:57:45 +00:00
|
|
|
if len(ciphers) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-31 18:54:36 +00:00
|
|
|
switch version {
|
|
|
|
|
case constants.Openvpn24:
|
2021-10-05 20:36:23 +00:00
|
|
|
return []string{
|
|
|
|
|
"cipher " + ciphers[0],
|
|
|
|
|
"ncp-ciphers " + strings.Join(ciphers, ":"),
|
|
|
|
|
}
|
2021-05-23 17:40:14 +00:00
|
|
|
default: // 2.5 and above
|
|
|
|
|
return []string{
|
2021-10-05 20:36:23 +00:00
|
|
|
"data-ciphers-fallback " + ciphers[0],
|
|
|
|
|
"data-ciphers " + strings.Join(ciphers, ":"),
|
2021-05-23 17:40:14 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|