1
0
Fork 0
httpserver/funcs/funcs.go

27 Zeilen
477 B
Go

package funcs
import (
"net"
)
// IsUnix tests if the address is an unix address. It returns false if its an tcp address.
func IsUnix(address string) bool {
if IsTCP(address) {
return false
}
if _, err := net.ResolveUnixAddr("unix", address); err == nil {
return true
}
return false
}
// IsTCP tests if the address is an tcp address
func IsTCP(address string) bool {
_, err := net.ResolveTCPAddr("tcp", address)
if err == nil {
return true
}
return false
}