Files
gluetun/internal/updater/providers/ivpn/filename.go
Quentin McGaw (desktop) 8b8bab5c58 Feature: IVPN support
2021-05-31 00:11:16 +00:00

17 lines
356 B
Go

package ivpn
import (
"strings"
)
func parseFilename(fileName string) (country, city string) {
const suffix = ".ovpn"
fileName = strings.TrimSuffix(fileName, suffix)
parts := strings.Split(fileName, "-")
country = strings.ReplaceAll(parts[0], "_", " ")
if len(parts) > 1 {
city = strings.ReplaceAll(parts[1], "_", " ")
}
return country, city
}