mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-08-07 05:38:30 +02:00
@@ -157,3 +157,13 @@ func resolveIpFromDomain(targetIpOrDomain string) string {
|
||||
|
||||
return targetIpAddrString
|
||||
}
|
||||
|
||||
// Check if the given port is already used by another process
|
||||
func CheckIfPortOccupied(portNumber int) bool {
|
||||
listener, err := net.Listen("tcp", ":"+strconv.Itoa(portNumber))
|
||||
if err != nil {
|
||||
return true
|
||||
}
|
||||
listener.Close()
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user