All Downloads are FREE. Search and download functionalities are using the official Maven repository.

images.baseimage.entrypoints.cmd.server-entrypoint.main.go Maven / Gradle / Ivy

Go to download

Bill of Materials POM for the entire protocol attacker ecosystem used to keep dependencies in sync.

The newest version!
package main

import (
	"entrypoints/lib"
	"fmt"
	"net/http"
	"strconv"
	"time"
)

func infinite() {
	failed := 0
	for {
		fmt.Println("Start Server!")
		start := time.Now()
		exitCode := lib.ExecuteArgs()
		elapsed := time.Since(start)

		fmt.Println("Server terminated! (" + strconv.Itoa(int(elapsed.Milliseconds())) + "ms)")
		if elapsed < 20 * time.Millisecond || exitCode > 0 || exitCode == -1 {
			failed = failed + 1
		} else {
			failed = 0
		}
	}
}


func main() {
	go infinite()

	http.HandleFunc("/shutdown", lib.Shutdown)
	http.HandleFunc("/portrequest", lib.Portrequest)
	http.HandleFunc("/enableportswitch", lib.EnablePortSwitch)
	http.HandleFunc("/killserver", lib.KillServer)
	fmt.Println("Listening on :8090...")
	_ = http.ListenAndServe(":8090", nil)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy