feat(providers): add giganews support (#2479)

This commit is contained in:
Quentin McGaw
2024-09-18 13:01:37 +02:00
committed by GitHub
parent 429aea8e0f
commit 07651683f9
16 changed files with 958 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
package updater
import (
"errors"
"fmt"
"strings"
)
var errNotOvpnExt = errors.New("filename does not have the openvpn file extension")
func parseFilename(fileName string) (
region string, err error,
) {
const suffix = ".ovpn"
if !strings.HasSuffix(fileName, suffix) {
return "", fmt.Errorf("%w: %s", errNotOvpnExt, fileName)
}
region = strings.TrimSuffix(fileName, suffix)
region = strings.ReplaceAll(region, " - ", " ")
return region, nil
}