web重做
This commit is contained in:
@@ -339,22 +339,14 @@ func (s *Server) handleQuery(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// 检查域名是否被屏蔽
|
||||
blocked := s.shieldManager.IsBlocked(domain)
|
||||
|
||||
// 检查hosts文件是否有匹配
|
||||
hostsIP, hasHosts := s.shieldManager.GetHostsIP(domain)
|
||||
|
||||
result := map[string]interface{}{
|
||||
"domain": domain,
|
||||
"blocked": blocked,
|
||||
"hasHosts": hasHosts,
|
||||
"hostsIP": hostsIP,
|
||||
"timestamp": time.Now(),
|
||||
}
|
||||
// 获取域名屏蔽的详细信息
|
||||
blockDetails := s.shieldManager.CheckDomainBlockDetails(domain)
|
||||
|
||||
// 添加时间戳
|
||||
blockDetails["timestamp"] = time.Now()
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(result)
|
||||
json.NewEncoder(w).Encode(blockDetails)
|
||||
}
|
||||
|
||||
// handleStatus 处理系统状态请求
|
||||
|
||||
Reference in New Issue
Block a user