1
0

mutation_audit_test.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. package sub
  2. import (
  3. "encoding/base64"
  4. "encoding/json"
  5. "path/filepath"
  6. "strings"
  7. "testing"
  8. "github.com/mhsanaei/3x-ui/v3/internal/database"
  9. "github.com/mhsanaei/3x-ui/v3/internal/database/model"
  10. "github.com/mhsanaei/3x-ui/v3/internal/xray"
  11. )
  12. // initMutDB spins up a real temp SQLite DB for tests that exercise DB-backed
  13. // query helpers, mirroring the house pattern in service_sharelink/dedup tests.
  14. func initMutDB(t *testing.T) {
  15. t.Helper()
  16. dbDir := t.TempDir()
  17. t.Setenv("XUI_DB_FOLDER", dbDir)
  18. if err := database.InitDB(filepath.Join(dbDir, "x-ui.db")); err != nil {
  19. t.Fatalf("InitDB: %v", err)
  20. }
  21. t.Cleanup(func() { _ = database.CloseDB() })
  22. }
  23. // --- json_service.go:40 — rules are merged into routing only when non-empty ---
  24. func TestSubJsonService_CustomRulesPrepended(t *testing.T) {
  25. rules := `[{"type":"field","domain":["geosite:ads"],"outboundTag":"block"}]`
  26. svc := NewSubJsonService("", rules, "", nil)
  27. routing, ok := svc.configJson["routing"].(map[string]any)
  28. if !ok {
  29. t.Fatalf("routing missing: %#v", svc.configJson["routing"])
  30. }
  31. got, _ := routing["rules"].([]any)
  32. // default.json ships exactly 1 rule; the custom rule must be prepended.
  33. if len(got) != 2 {
  34. t.Fatalf("rules len = %d, want 2 (custom prepended to default)", len(got))
  35. }
  36. first, _ := got[0].(map[string]any)
  37. if domains, _ := first["domain"].([]any); len(domains) != 1 || domains[0] != "geosite:ads" {
  38. t.Fatalf("custom rule must come first, got %#v", got[0])
  39. }
  40. }
  41. func TestSubJsonService_EmptyRulesLeavesDefault(t *testing.T) {
  42. svc := NewSubJsonService("", "", "", nil)
  43. routing, _ := svc.configJson["routing"].(map[string]any)
  44. got, _ := routing["rules"].([]any)
  45. if len(got) != 1 {
  46. t.Fatalf("rules len = %d, want 1 (no custom rules → default untouched)", len(got))
  47. }
  48. }
  49. // --- json_service.go:331,356,408 — mux is attached only when configured ---
  50. func TestSubJsonService_MuxAttachedWhenConfigured(t *testing.T) {
  51. const mux = `{"enabled":true,"concurrency":8}`
  52. client := model.Client{ID: "uuid-1", Password: "p4ss"}
  53. cases := []struct {
  54. name string
  55. raw []byte
  56. wantMux bool
  57. protocol model.Protocol
  58. }{
  59. {"vmess mux", NewSubJsonService(mux, "", "", nil).genVnext(&model.Inbound{Protocol: model.VMESS, Settings: `{}`}, nil, client), true, model.VMESS},
  60. {"vless mux", NewSubJsonService(mux, "", "", nil).genVless(&model.Inbound{Protocol: model.VLESS, Settings: `{}`}, nil, client), true, model.VLESS},
  61. {"server mux", NewSubJsonService(mux, "", "", nil).genServer(&model.Inbound{Protocol: model.Trojan, Settings: `{}`}, nil, client), true, model.Trojan},
  62. {"vmess no mux", NewSubJsonService("", "", "", nil).genVnext(&model.Inbound{Protocol: model.VMESS, Settings: `{}`}, nil, client), false, model.VMESS},
  63. {"vless no mux", NewSubJsonService("", "", "", nil).genVless(&model.Inbound{Protocol: model.VLESS, Settings: `{}`}, nil, client), false, model.VLESS},
  64. {"server no mux", NewSubJsonService("", "", "", nil).genServer(&model.Inbound{Protocol: model.Trojan, Settings: `{}`}, nil, client), false, model.Trojan},
  65. }
  66. for _, tc := range cases {
  67. t.Run(tc.name, func(t *testing.T) {
  68. var ob map[string]any
  69. if err := json.Unmarshal(tc.raw, &ob); err != nil {
  70. t.Fatalf("unmarshal outbound: %v", err)
  71. }
  72. m, has := ob["mux"]
  73. if tc.wantMux {
  74. if !has {
  75. t.Fatalf("mux must be set when configured, outbound = %#v", ob)
  76. }
  77. mm, _ := m.(map[string]any)
  78. if mm["enabled"] != true || mm["concurrency"] != float64(8) {
  79. t.Fatalf("mux payload wrong: %#v", m)
  80. }
  81. } else if has {
  82. t.Fatalf("mux must be omitted when empty, outbound = %#v", ob)
  83. }
  84. })
  85. }
  86. }
  87. // --- json_service.go:268 — a non-empty finalMask that merges to nothing must
  88. // not add the finalmask key (the `len(merged) > 0` guard). ---
  89. func TestSubJsonService_FinalMaskMergingToEmptyNotAdded(t *testing.T) {
  90. // finalMask is non-empty (passes the len(fm)==0 early return) but its only
  91. // key is an empty tcp slice, which mergeFinalMask drops → merged is empty,
  92. // so applyGlobalFinalMask (json_service.go:268) must NOT set finalmask.
  93. svc := NewSubJsonService("", "", `{"tcp":[]}`, nil)
  94. stream := svc.streamData(`{"network":"tcp","security":"none","tcpSettings":{"header":{"type":"none"}}}`)
  95. if _, ok := stream["finalmask"]; ok {
  96. t.Fatalf("finalMask merging to empty must not add a finalmask key: %#v", stream["finalmask"])
  97. }
  98. // Sanity: a finalMask that DOES merge to something still gets set, so the
  99. // guard is the only distinguishing factor.
  100. svc2 := NewSubJsonService("", "", `{"tcp":[{"type":"fragment"}]}`, nil)
  101. stream2 := svc2.streamData(`{"network":"tcp","security":"none","tcpSettings":{"header":{"type":"none"}}}`)
  102. if _, ok := stream2["finalmask"]; !ok {
  103. t.Fatal("non-empty finalMask must be set")
  104. }
  105. }
  106. // --- json_service.go:494 — an empty extra tcp slice must not clobber the base ---
  107. func TestMergeFinalMask_EmptyExtraTcpKeepsBase(t *testing.T) {
  108. base := map[string]any{"tcp": []any{map[string]any{"type": "keep"}}}
  109. extra := map[string]any{"tcp": []any{}} // empty → must be ignored
  110. merged := mergeFinalMask(base, extra)
  111. tcp, _ := merged["tcp"].([]any)
  112. if len(tcp) != 1 {
  113. t.Fatalf("tcp len = %d, want 1 (empty extra must not drop or append)", len(tcp))
  114. }
  115. if first, _ := tcp[0].(map[string]any); first["type"] != "keep" {
  116. t.Fatalf("base tcp mask lost: %#v", tcp)
  117. }
  118. // Sanity: a non-empty extra DOES append, so the guard is the only thing
  119. // distinguishing the two paths.
  120. extra2 := map[string]any{"tcp": []any{map[string]any{"type": "add"}}}
  121. merged2 := mergeFinalMask(base, extra2)
  122. if tcp2, _ := merged2["tcp"].([]any); len(tcp2) != 2 {
  123. t.Fatalf("non-empty extra must append: len = %d, want 2", len(tcp2))
  124. }
  125. }
  126. // --- service.go:69-77 — configuredPublicHost priority: subDomain > webDomain > "" ---
  127. func TestConfiguredPublicHost_Priority(t *testing.T) {
  128. initMutDB(t)
  129. db := database.GetDB()
  130. set := func(key, val string) {
  131. if err := db.Save(&model.Setting{Key: key, Value: val}).Error; err != nil {
  132. t.Fatalf("save %s: %v", key, err)
  133. }
  134. }
  135. s := &SubService{}
  136. // Both empty → "".
  137. if got := s.configuredPublicHost(); got != "" {
  138. t.Fatalf("no domains configured: got %q, want empty", got)
  139. }
  140. // Only webDomain → webDomain wins (exercises the second branch, service.go:73).
  141. set("webDomain", "web.example.com")
  142. if got := s.configuredPublicHost(); got != "web.example.com" {
  143. t.Fatalf("webDomain fallback: got %q, want web.example.com", got)
  144. }
  145. // subDomain set → subDomain takes precedence over webDomain (service.go:70).
  146. set("subDomain", "sub.example.com")
  147. if got := s.configuredPublicHost(); got != "sub.example.com" {
  148. t.Fatalf("subDomain priority: got %q, want sub.example.com", got)
  149. }
  150. }
  151. // --- service.go:248 — AggregateTrafficByEmails tracks the MAX LastOnline ---
  152. func TestAggregateTrafficByEmails_LastOnlineIsMax(t *testing.T) {
  153. initMutDB(t)
  154. db := database.GetDB()
  155. rows := []xray.ClientTraffic{
  156. {Email: "a@x", Up: 10, Down: 20, LastOnline: 100},
  157. {Email: "b@x", Up: 1, Down: 2, LastOnline: 500}, // the max
  158. {Email: "c@x", Up: 3, Down: 4, LastOnline: 300},
  159. }
  160. for i := range rows {
  161. if err := db.Create(&rows[i]).Error; err != nil {
  162. t.Fatalf("seed traffic: %v", err)
  163. }
  164. }
  165. s := &SubService{}
  166. agg, lastOnline := s.AggregateTrafficByEmails([]string{"a@x", "b@x", "c@x"})
  167. if lastOnline != 500 {
  168. t.Fatalf("lastOnline = %d, want 500 (max across rows)", lastOnline)
  169. }
  170. // Up/Down must still sum so a mutant can't pass by zeroing everything.
  171. if agg.Up != 14 || agg.Down != 26 {
  172. t.Fatalf("agg up/down = %d/%d, want 14/26", agg.Up, agg.Down)
  173. }
  174. }
  175. // --- service.go:329 — projectThroughFallbackMaster returns false for nil ---
  176. func TestProjectThroughFallbackMaster_Nil(t *testing.T) {
  177. s := &SubService{}
  178. if s.projectThroughFallbackMaster(nil) {
  179. t.Fatal("nil inbound must yield false (no projection, no DB hit)")
  180. }
  181. }
  182. // --- service.go:555 — empty client flow must not emit a flow param even when allowed ---
  183. func TestGenVlessLink_NoFlowWhenClientFlowEmpty(t *testing.T) {
  184. // tcp+reality is a flow-allowed combo; with an empty client flow the
  185. // len(...)>0 guard (service.go:555) must keep `flow` out of the link.
  186. stream := `{
  187. "network":"tcp","security":"reality",
  188. "tcpSettings":{"header":{"type":"none"}},
  189. "realitySettings":{"serverNames":["r.example.com"],"shortIds":["ab"],"settings":{"publicKey":"PBK","fingerprint":"chrome"}}
  190. }`
  191. inbound := &model.Inbound{
  192. Listen: "203.0.113.1",
  193. Port: 443,
  194. Protocol: model.VLESS,
  195. Remark: "noflow",
  196. Settings: `{"clients":[{"id":"11111111-2222-4333-8444-555555555555","email":"user"}],"encryption":"none"}`,
  197. StreamSettings: stream,
  198. }
  199. s := &SubService{remarkModel: "-ieo"}
  200. if link := s.genVlessLink(inbound, "user"); strings.Contains(link, "flow=") {
  201. t.Fatalf("empty client flow must not produce a flow param, got %q", link)
  202. }
  203. }
  204. // --- service.go:906-913 — applyPathAndHostParams host source ---
  205. func TestApplyPathAndHostParams(t *testing.T) {
  206. // Direct host wins (service.go:908 true branch).
  207. params := map[string]string{}
  208. applyPathAndHostParams(map[string]any{"path": "/p", "host": "direct.example.com"}, params)
  209. if params["path"] != "/p" {
  210. t.Fatalf("path = %q, want /p", params["path"])
  211. }
  212. if params["host"] != "direct.example.com" {
  213. t.Fatalf("direct host = %q, want direct.example.com", params["host"])
  214. }
  215. // No direct host → fall back to headers.Host (service.go:908 false branch).
  216. params = map[string]string{}
  217. applyPathAndHostParams(map[string]any{
  218. "path": "/p",
  219. "headers": map[string]any{"Host": "via-header.example.com"},
  220. }, params)
  221. if params["host"] != "via-header.example.com" {
  222. t.Fatalf("header host fallback = %q, want via-header.example.com", params["host"])
  223. }
  224. // Empty-string host must NOT shadow the header fallback (len(host) > 0 guard).
  225. params = map[string]string{}
  226. applyPathAndHostParams(map[string]any{
  227. "path": "/p",
  228. "host": "",
  229. "headers": map[string]any{"Host": "via-header.example.com"},
  230. }, params)
  231. if params["host"] != "via-header.example.com" {
  232. t.Fatalf("empty host must defer to headers, got %q", params["host"])
  233. }
  234. }
  235. // --- external_config.go:39,42,55,58 — getClientExternalLinksBySubId ---
  236. func TestGetClientExternalLinksBySubId(t *testing.T) {
  237. initMutDB(t)
  238. db := database.GetDB()
  239. s := &SubService{}
  240. // No client rows for the subId → nil, no error (service.go path :42).
  241. out, err := s.getClientExternalLinksBySubId("missing")
  242. if err != nil {
  243. t.Fatalf("missing subId err = %v, want nil", err)
  244. }
  245. if out != nil {
  246. t.Fatalf("missing subId = %#v, want nil", out)
  247. }
  248. // A client with NO external-link rows → nil (the rows-empty guard :58).
  249. bare := &model.ClientRecord{Email: "bare@x", SubID: "sub-bare", UUID: "u", Enable: true}
  250. if err := db.Create(bare).Error; err != nil {
  251. t.Fatalf("seed bare client: %v", err)
  252. }
  253. out, err = s.getClientExternalLinksBySubId("sub-bare")
  254. if err != nil {
  255. t.Fatalf("bare subId err = %v", err)
  256. }
  257. if out != nil {
  258. t.Fatalf("client with no links = %#v, want nil", out)
  259. }
  260. // A client with two link rows: ordering by sort_index and email/enable
  261. // attribution from the owning client (the loop copies rec.Email/rec.Enable).
  262. rec := &model.ClientRecord{Email: "owner@x", SubID: "sub-ok", UUID: "u2", Enable: true}
  263. if err := db.Create(rec).Error; err != nil {
  264. t.Fatalf("seed client: %v", err)
  265. }
  266. if err := db.Create(&model.ClientExternalLink{ClientId: rec.Id, Kind: model.ExternalLinkKindLink, Value: "trojan://b", Remark: "second", SortIndex: 5}).Error; err != nil {
  267. t.Fatalf("seed link b: %v", err)
  268. }
  269. if err := db.Create(&model.ClientExternalLink{ClientId: rec.Id, Kind: model.ExternalLinkKindLink, Value: "trojan://a", Remark: "first", SortIndex: 1}).Error; err != nil {
  270. t.Fatalf("seed link a: %v", err)
  271. }
  272. out, err = s.getClientExternalLinksBySubId("sub-ok")
  273. if err != nil {
  274. t.Fatalf("ok subId err = %v", err)
  275. }
  276. if len(out) != 2 {
  277. t.Fatalf("entries = %d, want 2", len(out))
  278. }
  279. // sort_index ASC: the SortIndex=1 row comes first.
  280. if out[0].Value != "trojan://a" || out[1].Value != "trojan://b" {
  281. t.Fatalf("ordering wrong: %#v", out)
  282. }
  283. // Email + Enable must be copied from the owning client, not the link row
  284. // (which carries neither field). The enabled owner → Enable true.
  285. if out[0].Email != "owner@x" || out[0].Enable != true {
  286. t.Fatalf("attribution wrong: email=%q enable=%v", out[0].Email, out[0].Enable)
  287. }
  288. // A DISABLED client must produce entries with Enable=false, proving the
  289. // value is read from the client row (Enable has a gorm default:true, so
  290. // flip it with a raw UPDATE that bypasses the default).
  291. dis := &model.ClientRecord{Email: "off@x", SubID: "sub-off", UUID: "u3", Enable: true}
  292. if err := db.Create(dis).Error; err != nil {
  293. t.Fatalf("seed disabled client: %v", err)
  294. }
  295. if err := db.Model(&model.ClientRecord{}).Where("id = ?", dis.Id).Update("enable", false).Error; err != nil {
  296. t.Fatalf("disable client: %v", err)
  297. }
  298. if err := db.Create(&model.ClientExternalLink{ClientId: dis.Id, Kind: model.ExternalLinkKindLink, Value: "trojan://c", SortIndex: 1}).Error; err != nil {
  299. t.Fatalf("seed link c: %v", err)
  300. }
  301. offOut, err := s.getClientExternalLinksBySubId("sub-off")
  302. if err != nil {
  303. t.Fatalf("off subId err = %v", err)
  304. }
  305. if len(offOut) != 1 {
  306. t.Fatalf("disabled client entries = %d, want 1", len(offOut))
  307. }
  308. if offOut[0].Email != "off@x" || offOut[0].Enable != false {
  309. t.Fatalf("disabled attribution wrong: email=%q enable=%v", offOut[0].Email, offOut[0].Enable)
  310. }
  311. }
  312. // --- external_config.go:102 — applyRemarkToLink appends a fragment when none exists ---
  313. func TestApplyRemarkToLink_NoFragmentAppends(t *testing.T) {
  314. link := "trojan://[email protected]:8443?security=tls"
  315. out := applyRemarkToLink(link, "DE-Node")
  316. if out != link+"#DE-Node" {
  317. t.Fatalf("no-fragment link must get the remark appended, got %q", out)
  318. }
  319. }
  320. // --- external_config.go:111 — applyVmessRemark falls back to RawURLEncoding ---
  321. func TestApplyVmessRemark_RawURLEncodingFallback(t *testing.T) {
  322. // The "aa?" ps forces a URL-safe char (_) in the RawURL encoding, so
  323. // base64.StdEncoding.DecodeString fails and the RawURLEncoding fallback
  324. // path (external_config.go:111) must take over. (ps is overwritten below,
  325. // so its value is irrelevant to the assertions.)
  326. payload := map[string]any{"v": "2", "ps": "aa?", "add": "1.2.3.4", "port": "443", "id": "uuid"}
  327. b, _ := json.Marshal(payload)
  328. link := "vmess://" + base64.RawURLEncoding.EncodeToString(b)
  329. // Guard the premise: this link must NOT be std-decodable, else the fallback
  330. // branch is never reached and the test is meaningless.
  331. if _, err := base64.StdEncoding.DecodeString(padBase64Sub(strings.TrimPrefix(link, "vmess://"))); err == nil {
  332. t.Fatal("test premise broken: link is std-base64 decodable, fallback not exercised")
  333. }
  334. out := applyRemarkToLink(link, "NL-Node")
  335. if out == link {
  336. t.Fatalf("raw-url-encoded vmess remark was not applied (fallback decode broken): %q", out)
  337. }
  338. // The result re-encodes with StdEncoding; decode and verify ps + credentials.
  339. raw, err := base64.StdEncoding.DecodeString(strings.TrimPrefix(out, "vmess://"))
  340. if err != nil {
  341. t.Fatalf("decode out: %v", err)
  342. }
  343. var got map[string]any
  344. if err := json.Unmarshal(raw, &got); err != nil {
  345. t.Fatalf("unmarshal: %v", err)
  346. }
  347. if got["ps"] != "NL-Node" {
  348. t.Fatalf("ps = %v, want NL-Node", got["ps"])
  349. }
  350. if got["id"] != "uuid" {
  351. t.Fatalf("credentials lost via fallback path: %#v", got)
  352. }
  353. }
  354. // --- external_config.go:130 — padBase64Sub pads to a multiple of 4 ---
  355. func TestPadBase64Sub(t *testing.T) {
  356. cases := map[string]string{
  357. "": "",
  358. "a": "a===",
  359. "ab": "ab==",
  360. "abc": "abc=",
  361. "abcd": "abcd",
  362. }
  363. for in, want := range cases {
  364. if got := padBase64Sub(in); got != want {
  365. t.Fatalf("padBase64Sub(%q) = %q, want %q", in, got, want)
  366. }
  367. if len(padBase64Sub(in))%4 != 0 {
  368. t.Fatalf("padBase64Sub(%q) length not a multiple of 4", in)
  369. }
  370. }
  371. }
  372. // --- external_subscription.go:122 — base64 body decode strips embedded whitespace ---
  373. func TestDecodeSubscriptionBody_StripsWhitespaceInBase64(t *testing.T) {
  374. plain := "vless://[email protected]:443#one\ntrojan://[email protected]:8443#two\n"
  375. encoded := base64.StdEncoding.EncodeToString([]byte(plain))
  376. // Inject whitespace into the base64 token; tryDecodeBase64Body must strip it
  377. // (external_subscription.go:122) so decoding still succeeds.
  378. half := len(encoded) / 2
  379. dirty := encoded[:half] + "\n \t" + encoded[half:]
  380. links := decodeSubscriptionBody([]byte(dirty))
  381. if len(links) != 2 || links[0] != "vless://[email protected]:443#one" || links[1] != "trojan://[email protected]:8443#two" {
  382. t.Fatalf("whitespace-laden base64 body decoded wrong: %#v", links)
  383. }
  384. }
  385. // --- clash_service.go:123 — duplicate proxy names disambiguate as base-N ---
  386. func TestEnsureUniqueProxyNames_SuffixSequence(t *testing.T) {
  387. proxies := []map[string]any{
  388. {"name": "node"},
  389. {"name": "node"},
  390. {"name": "node"},
  391. }
  392. ensureUniqueProxyNames(proxies)
  393. if proxies[0]["name"] != "node" {
  394. t.Fatalf("first occurrence must keep base name, got %v", proxies[0]["name"])
  395. }
  396. if proxies[1]["name"] != "node-2" {
  397. t.Fatalf("second duplicate = %v, want node-2", proxies[1]["name"])
  398. }
  399. if proxies[2]["name"] != "node-3" {
  400. t.Fatalf("third duplicate = %v, want node-3", proxies[2]["name"])
  401. }
  402. }
  403. // --- clash_service.go:422,447 — empty transport opts must NOT add the *-opts key ---
  404. func TestApplyTransport_EmptyOptsOmitted(t *testing.T) {
  405. svc := &SubClashService{}
  406. // httpupgrade with no path/host → opts empty → no http-upgrade-opts key (clash:422).
  407. huProxy := map[string]any{}
  408. if !svc.applyTransport(huProxy, "httpupgrade", map[string]any{"httpupgradeSettings": map[string]any{}}) {
  409. t.Fatal("httpupgrade must still be buildable")
  410. }
  411. if huProxy["network"] != "httpupgrade" {
  412. t.Fatalf("network = %v, want httpupgrade", huProxy["network"])
  413. }
  414. if _, ok := huProxy["http-upgrade-opts"]; ok {
  415. t.Fatalf("empty opts must not set http-upgrade-opts: %#v", huProxy["http-upgrade-opts"])
  416. }
  417. // xhttp with no path/host/mode → opts empty → no xhttp-opts key (clash:447).
  418. xhProxy := map[string]any{}
  419. if !svc.applyTransport(xhProxy, "xhttp", map[string]any{"xhttpSettings": map[string]any{}}) {
  420. t.Fatal("xhttp must still be buildable")
  421. }
  422. if xhProxy["network"] != "xhttp" {
  423. t.Fatalf("network = %v, want xhttp", xhProxy["network"])
  424. }
  425. if _, ok := xhProxy["xhttp-opts"]; ok {
  426. t.Fatalf("empty opts must not set xhttp-opts: %#v", xhProxy["xhttp-opts"])
  427. }
  428. }