func BootconfigCall(w http.ResponseWriter, req *http.Request) { var msg interfaces.InfoMsg fmDaemon.DaemonLog.DebugHttp(req) req.ProtoMinor = 0 add := req.RemoteAddr addTmp := strings.Split(add, ":") address := addTmp[0] fmDaemon.UpdateActivity() cmd := strings.Split(req.RequestURI, "/") imageTemp := fm.RenderImage(strings.TrimSpace(cmd[1]), address) _, err := w.Write(imageTemp) fm.data[address].Activity = time.Now() msg.Time = time.Now().Unix() msg.MsgType = "Info" host, _ := net.LookupAddr(address) msg.Message = fmt.Sprintf("%s is booting up", host[:1]) fm.data[address].Info = append(fm.data[address].Info, msg) fm.Store() fmDaemon.DaemonLog.LogError("Will not write status", err) fmDaemon.DaemonLog.Log(fmt.Sprintf("%s in allocation #%d has booted.", address, fm.data[address].AllocNum)) }
func StaticCall(w http.ResponseWriter, req *http.Request) { var msg interfaces.InfoMsg fmDaemon.DaemonLog.DebugHttp(req) req.ProtoMinor = 0 add := req.RemoteAddr addTmp := strings.Split(add, ":") address := addTmp[0] //Flunky auth needed fmDaemon.UpdateActivity() cmd := strings.Split(req.RequestURI, "/") staticTemp := fm.RenderGetStatic(req.RequestURI, address) w.Write(staticTemp) host, _ := net.LookupAddr(address) fm.data[address].Activity = time.Now() msg.Time = time.Now().Unix() msg.MsgType = "Info" msg.Message = fmt.Sprintf("%s is loading %s", host[:1], cmd) fm.data[address].Info = append(fm.data[address].Info, msg) fm.Store() fmDaemon.DaemonLog.Log(fmt.Sprintf("%s Rendered %s", cmd[1:], address)) }