platform: modularize api/gui, add docs-tests-web foundation, and refresh root config
This commit is contained in:
30
selective-vpn-api/app/helpers_values.go
Normal file
30
selective-vpn-api/app/helpers_values.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func parsePort(raw string) int {
|
||||
p := strings.TrimSpace(raw)
|
||||
if p == "" {
|
||||
return 0
|
||||
}
|
||||
n, err := strconv.Atoi(p)
|
||||
if err != nil || n <= 0 || n > 65535 {
|
||||
return 0
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func asString(v any) string {
|
||||
switch vv := v.(type) {
|
||||
case string:
|
||||
return strings.TrimSpace(vv)
|
||||
case nil:
|
||||
return ""
|
||||
default:
|
||||
return strings.TrimSpace(fmt.Sprint(vv))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user