fix(traffic,server,sandbox): fix TCP/53 false positives, add error-traffic storage toggle, and fix spawn_task/sandbox polling

- Route external TCP/53 through netstack deferred handshake and real-target DNS inspection (RFC 7766 single-write framing) instead of hijacking to host DNS.
- Preserve explicit targetServer in ProcessDNSQueryToTarget under upstream proxy so external UDP/53 probes never fall back to host DNSUpstream.
- Default error traffic storage (net_flows/dns_queries action=error) to off with hot-toggle controls synced across gateway, Proxy & Egress, and Traffic pages.
- Restore json.Unmarshal in spawn_task orchestration tool and poll live sandbox container state in chat/task controls.
This commit is contained in:
ji ruo committed 2026-12-02 15:17:42 +08:00
1 parent 07309e4530
commit d5926d6420
22 files changed
+1189 -101

No files matched your search

+4 -2
View File
@@ -11,7 +11,7 @@ import (
func (s *Server) getTrafficFlows(w http.ResponseWriter, r *http.Request) {
tr := s.m.Traffic()
if tr == nil {
writeJSON(w, 200, map[string]any{"enabled": false, "flows": []any{}, "total": 0, "count": 0})
writeJSON(w, 200, map[string]any{"enabled": false, "store_error_traffic": s.storeErrorTrafficEnabled(), "flows": []any{}, "total": 0, "count": 0})
return
}
q := r.URL.Query()
@@ -41,6 +41,7 @@ func (s *Server) getTrafficFlows(w http.ResponseWriter, r *http.Request) {
}
writeJSON(w, 200, map[string]any{
"enabled": s.m.TrafficEnabled(),
"store_error_traffic": s.storeErrorTrafficEnabled(),
"count": count,
"total": total,
"page": page,
@@ -95,7 +96,7 @@ func (s *Server) deleteTrafficFlows(w http.ResponseWriter, r *http.Request) {
func (s *Server) getTrafficDNS(w http.ResponseWriter, r *http.Request) {
tr := s.m.Traffic()
if tr == nil {
writeJSON(w, 200, map[string]any{"enabled": false, "queries": []any{}, "total": 0, "count": 0})
writeJSON(w, 200, map[string]any{"enabled": false, "store_error_traffic": s.storeErrorTrafficEnabled(), "queries": []any{}, "total": 0, "count": 0})
return
}
q := r.URL.Query()
@@ -126,6 +127,7 @@ func (s *Server) getTrafficDNS(w http.ResponseWriter, r *http.Request) {
}
writeJSON(w, 200, map[string]any{
"enabled": s.m.TrafficEnabled(),
"store_error_traffic": s.storeErrorTrafficEnabled(),
"count": count,
"total": total,
"page": page,