示例#1
0
文件: netstat.go 项目: wchh/gocoin
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
文件: network.go 项目: wchh/gocoin
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()))
	}
}