func FindTunnel() string {
	var res interface{}
	response := utilities.HttpGetJson("http://localhost:4040/api/tunnels")
	err := json.Unmarshal(response, &res)
	utilities.CheckError(err)
	tunnels := res.(map[string]interface{})
	for _, v := range tunnels {
		switch vv := v.(type) {
		case []interface{}:
			for _, u := range vv {
				tunnel := u.(map[string]interface{})
				for _, val := range tunnel {
					switch val.(type) {
					case string:
						strval, ok := val.(string)
						if ok && strings.Contains(strval, "https://") {
							//fmt.Println(tunnel["public_url"])
							return strval
						}
					}
				}
			}
		}
	}
	return ""
}
func PreRunService() {
	fmt.Println("Starting server!")
	ret, _, errNo := syscall.RawSyscall(syscall.SYS_FORK, 0, 0, 0)
	if errNo != 0 {
		panic(errors.New(fmt.Sprintf("Fork failed err: %d ", errNo)))
	} else {
		return
	}
	switch ret {
	case 0:
		break
	default:
		os.Exit(0)
	}
	sid, err := syscall.Setsid()
	utilities.CheckError(err)
	if sid == -1 {
		os.Exit(-1)
	}

	router := mux.NewRouter().StrictSlash(true)
	router.HandleFunc("/", Index)
	router.HandleFunc("/ls", GetFileList)
	router.HandleFunc("/file", GetFile)
	router.HandleFunc("/tunnel", GetTunnel)

	defer log.Fatal(http.ListenAndServe(":5922", router))
	fmt.Println("WTF!")
}