Using utils.GetNetwork

This commit is contained in:
aditya-K2
2022-09-14 20:42:28 +05:30
parent 503701691b
commit 3effda228b
3 changed files with 17 additions and 21 deletions

View File

@@ -8,6 +8,8 @@ import (
"strings"
"syscall"
"unsafe"
"github.com/spf13/viper"
)
type winsize struct {
@@ -174,3 +176,15 @@ func Unique(intSlice []int) []int {
}
return list
}
func GetNetwork() (string, string) {
del := ""
nt := viper.GetString("NETWORK_TYPE")
port := viper.GetString("MPD_PORT")
if nt == "tcp" {
del = ":"
} else if nt == "unix" && port != "" {
port = ""
}
return nt, viper.GetString("NETWORK_ADDRESS") + del + port
}