Пример #1
0
func (p *Proxy) writeHistory(w http.ResponseWriter, profileIP string, f *life.Life) {
	t, err := template.ParseFiles("template/history.tmpl")
	list := formatHistoryEventDataList(f.HistoryEvents(), profileIP, f)
	err = t.Execute(w, historyData{profileIP, list})
	if err != nil {
		fmt.Fprintln(w, "内部错误:", err)
	}
}
Пример #2
0
func (p *Proxy) writeDNSHistory(w http.ResponseWriter, f *life.Life, targetIP string) {
	t, err := template.ParseFiles("template/dnshistory.tmpl")
	list := formatDNSHistoryEventDataList(f.HistoryEvents(), f, targetIP)
	targetInfo := ""
	if len(targetIP) == 0 {
		targetInfo = "DNS 服务"
	} else {
		targetInfo = targetIP + " DNS"
	}

	err = t.Execute(w, dnsHistoryData{targetInfo, list})
	if err != nil {
		fmt.Fprintln(w, "内部错误:", err)
	}
}