Use authbind to bind privileged ports

This commit is contained in:
Manuel de Brito Fontes 2018-08-03 09:50:53 -04:00 committed by Manuel Alejandro de Brito Fontes
parent e2f5d9066e
commit b148f113ae
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
14 changed files with 48 additions and 69 deletions

View file

@ -29,12 +29,12 @@ func IsIPV6(ip _net.IP) bool {
// IsPortAvailable checks if a TCP port is available or not
func IsPortAvailable(p int) bool {
ln, err := _net.Listen("tcp", fmt.Sprintf(":%v", p))
conn, err := _net.Dial("tcp", fmt.Sprintf(":%v", p))
if err != nil {
return false
return true
}
ln.Close()
return true
defer conn.Close()
return false
}
// IsIPv6Enabled checks if IPV6 is enabled or not