Пример #1
0
func node_info(par string) {
	v := network.Look4conn(par)
	if v == nil {
		fmt.Println("There is no such an active connection")
	} else {
		fmt.Print(v.Stats())
	}
}
Пример #2
0
func net_drop(par string) {
	c := network.Look4conn(par)
	if c != nil {
		c.DoS()
		fmt.Println("The connection with", c.PeerAddr.Ip(), "is being dropped and the peer is banned")
	} else {
		fmt.Println("There is no such an active connection")
	}
}
Пример #3
0
func raw_net(w http.ResponseWriter, r *http.Request) {
	if !ipchecker(r) {
		return
	}

	defer func() {
		if r := recover(); r != nil {
			fmt.Fprintln(w, "Error")
		}
	}()

	if len(r.Form["id"]) == 0 {
		fmt.Println("No id given")
		return
	}

	v := network.Look4conn(r.Form["id"][0])
	if v == nil {
		fmt.Fprintln(w, "There is no such an active connection")
	} else {
		w.Write([]byte(v.Stats()))
	}
}