Commit graph

30 commits

Author SHA1 Message Date
Alireza Ahmadi
d4fdd8e086 feat: enable/disable switch for inbounds #1327 2026-11-02 20:43:26 +01:00
freedomdb
e236a73a66
fix: replace bare type assertions in tag unmarshal and WARP API handling (#1310)
Two UnmarshalJSON implementations asserted raw["tag"] directly
while every sibling type in the same package uses the comma-ok
form:

  database/model/outbounds.go:  o.Tag = raw["tag"].(string)
  database/model/endpoints.go:  o.Tag = raw["tag"].(string)

A saved outbound/endpoint whose tag is missing or not a string --
hand-written API call, import script, third-party client; the
panel UI always sends one -- panicked the api/save and apiv2/save
handlers (gin's Recovery turns it into a 500 and a stack trace in
the log). Same class as #1296.

service/warp.go trusted the Cloudflare client API's response
shape the same way, in the WARP registration flow an admin runs
from the endpoints page:

  - rspData["id"] / ["token"] bare assertions
  - rspData["account"] asserted before the license lookup, so a
    missing account panicked before the existing ok check ran
  - warpConfig["peers"][0] indexed without a length check, so a
    response with no peers panicked
  - the error path in SetWarpLicense indexed response["errors"][0]
    bare, so a failed response with an empty or missing errors
    array panicked instead of returning the error it exists for

All of them now use comma-ok assertions and return a warp error,
like the license check already did. Regression tests cover the
two UnmarshalJSON cases (missing, numeric, null and object tags,
plus the normal string case); the WARP paths need the live
Cloudflare API, so they are covered by inspection and go vet.

Prepared by muse ai
2026-10-31 17:16:00 +01:00
Alireza Ahmadi
a4df7552a8 revert migration to the old solution 2026-09-15 21:07:34 +02:00
Alireza Ahmadi
4f6f714ae2 multi user snell #1262 2026-09-15 20:44:55 +02:00
Alireza Ahmadi
dcbe9a8728 unified pipelines
Some checks are pending
Release S-UI / test (push) Waiting to run
Release S-UI / build-frontend (push) Blocked by required conditions
Release S-UI / build-386 (push) Blocked by required conditions
Release S-UI / build-amd64 (push) Blocked by required conditions
Release S-UI / build-armv5 (push) Blocked by required conditions
Release S-UI / build-armv6 (push) Blocked by required conditions
Release S-UI / build-armv7 (push) Blocked by required conditions
Release S-UI / build-arm64 (push) Blocked by required conditions
Release S-UI / build-s390x (push) Blocked by required conditions
Release S-UI / build-windows-amd64 (push) Blocked by required conditions
Release S-UI / build-windows-arm64 (push) Blocked by required conditions
Release S-UI / publish (push) Blocked by required conditions
2026-09-12 17:25:04 +02:00
Alireza Ahmadi
9ec56e93b1 qa test and fix phases 0,1,2 2026-09-12 16:59:29 +02:00
Alireza Ahmadi
d8625970e4 Drop the TLS template for OpenVPN and OpenConnect endpoints (#1253) 2026-09-10 01:30:01 +02:00
Alireza Ahmadi
df1337d590 remove depricated options 2026-08-31 14:06:23 +02:00
Alireza Ahmadi
97a69bef2a http http2 quic fields 2026-08-31 14:06:23 +02:00
Alireza Ahmadi
4202af9b17 other migrations to 1.14 2026-08-31 14:06:23 +02:00
Alireza Ahmadi
91ff2e72d0 upgrade acme to ca provider 2026-08-31 14:06:23 +02:00
Alireza Ahmadi
2951532c94 new endpoints + mtls 2026-08-31 14:06:23 +02:00
Alireza Ahmadi
f41da0dfdd database: migrate options deprecated in sing-box 1.14
One-shot migration over the stored config and TLS rows, guarded by a setting
so it runs once:

- dns.independent_cache is dropped (1.14 reads it only to warn; the value is
  never passed to the DNS client)
- experimental.cache_file.store_rdrc becomes store_dns
- route.rule_set[].download_detour becomes the http_client 1.14 builds for it
- inline tls.acme becomes tls.certificate_provider with type "acme"

Legacy DNS address filters and the `strategy` DNS rule action are NOT migrated
automatically. Converting them means inserting evaluate rules and reordering,
which changes how names resolve, so they are logged with the upstream
migration link for the operator to handle.

Tests cover each rewrite, that unrelated options survive, that a config with
nothing to migrate is left byte-identical, and that the migrated shapes build
a box with no deprecation warning.
2026-08-31 14:06:23 +02:00
Alireza Ahmadi
b24c419ceb fix db lock #1209 2026-08-09 18:16:30 +02:00
Alireza Ahmadi
24ce6d25a5 fix tls nil pointer #1198
Some checks failed
Release S-UI / build-frontend (push) Has been cancelled
Build S-UI for Windows / build-frontend (push) Has been cancelled
Release S-UI / build-386 (push) Has been cancelled
Release S-UI / build-amd64 (push) Has been cancelled
Release S-UI / build-armv5 (push) Has been cancelled
Release S-UI / build-armv6 (push) Has been cancelled
Release S-UI / build-armv7 (push) Has been cancelled
Release S-UI / build-arm64 (push) Has been cancelled
Release S-UI / build-s390x (push) Has been cancelled
Build S-UI for Windows / build-windows-amd64 (push) Has been cancelled
Build S-UI for Windows / build-windows-arm64 (push) Has been cancelled
2026-07-17 22:19:01 +02:00
Alireza Ahmadi
b7931a9bbe fix dedubStats #1148 2026-06-28 18:00:30 +02:00
Alireza Ahmadi
1a8708aed3 improve stats saving on db
Some checks are pending
Release S-UI / build-frontend (push) Waiting to run
Release S-UI / build-386 (push) Blocked by required conditions
Release S-UI / build-amd64 (push) Blocked by required conditions
Release S-UI / build-armv5 (push) Blocked by required conditions
Release S-UI / build-armv6 (push) Blocked by required conditions
Release S-UI / build-armv7 (push) Blocked by required conditions
Release S-UI / build-arm64 (push) Blocked by required conditions
Release S-UI / build-s390x (push) Blocked by required conditions
Build S-UI for Windows / build-frontend (push) Waiting to run
Build S-UI for Windows / build-windows-amd64 (push) Blocked by required conditions
Build S-UI for Windows / build-windows-arm64 (push) Blocked by required conditions
2026-06-27 14:03:56 +02:00
Alireza Ahmadi
b43e2a4278 [feat] createAt-lastOnline-remark added to Client #1115 2026-06-27 13:42:39 +02:00
ayi21sui
855c269fb8 fix: SQLite connection leak causing unbounded memory growth
SaveStats returned tx.Create().Error directly without assigning to the
local err variable, so the deferred closure always saw err==nil and
called Commit() on a failed transaction. This left the underlying
go-sqlite3 connection unreturned to the pool. With StatsJob firing
every 10s, leaked connections accumulated ~150 KB each, reaching
400+ MB after ~33 hours.

Fixes:
- stats.go: assign Create result to err so defer can Rollback on failure
- backup.go: defer-close backupDb to prevent pool leak on early return
- migration/main.go: defer-close migration db
- db.go: add ConnMaxIdleTime(5m), lower MaxIdleConns to 2, set
  _cache_size=-200 to reduce per-connection memory from ~2 MB to ~200 KB

Measured: RSS dropped from 419 MB to 66 MB, db file descriptors from
4484 to 6, with zero growth over 3-minute observation window.
2026-05-07 12:30:59 +08:00
Alireza Ahmadi
9d35e02e0e fix db WAL memory leak #1056 2026-03-22 19:08:31 +01:00
Alireza Ahmadi
14ea27292f use journal mode WAL for expand db use 2026-03-08 23:18:42 +01:00
Alireza Ahmadi
6ba547331e [feat] delayStart and autoReset #718 2026-03-08 23:18:08 +01:00
Alireza Ahmadi
90976cded1 fix dblock on failure #964 2026-02-08 21:19:28 +01:00
Alireza Ahmadi
7751c8fce0 go package 2025-09-18 23:19:56 +02:00
Alireza Ahmadi
123813dc90 fix build for windows 2025-08-21 03:47:37 +02:00
Alireza Ahmadi
fc410c9a8d update new features service-dns 2025-05-28 23:00:19 +02:00
Alireza Ahmadi
1535338e0b fix jsonsub required rules #451 2025-02-15 14:13:54 +01:00
Alireza Ahmadi
ea6ceac2f2 fix backup empty tables 2025-02-09 00:00:33 +01:00
Alireza Ahmadi
1ac7bce6b4 new api with token 2025-02-02 21:46:36 +01:00
Alireza Ahmadi
7faa28a89d separate frontend repository 2025-01-29 00:08:36 +01:00