chore(updater): move updater packages to pkg/updaters/<name>

This commit is contained in:
Quentin McGaw
2026-04-23 03:47:57 +00:00
parent 5b01324d5f
commit 13503b0ae0
268 changed files with 1602 additions and 1026 deletions
@@ -0,0 +1,35 @@
package torguard
import (
"strings"
"golang.org/x/text/cases"
)
func parseFilename(fileName string, titleCaser cases.Caser) (country, city string) {
const prefix = "TorGuard."
const suffix = ".ovpn"
s := strings.TrimPrefix(fileName, prefix)
s = strings.TrimSuffix(s, suffix)
switch {
case strings.Count(s, ".") == 1 && !strings.HasPrefix(s, "USA"):
parts := strings.Split(s, ".")
country = parts[0]
city = parts[1]
case strings.HasPrefix(s, "USA"):
country = "USA"
s = strings.TrimPrefix(s, "USA-")
s = strings.ReplaceAll(s, "-", " ")
s = strings.ReplaceAll(s, ".", " ")
s = strings.ToLower(s)
s = titleCaser.String(s)
city = s
default:
country = s
}
return country, city
}