Repository navigation
clash-api: Fix flushing FakeIP cache - #13
Merged
reF1nd merged 95 commits intoSep 24, 2026
Merged
Conversation
The official anytls code is of poor quality and consumes excessive memory
Changes to the cache file are collected in a write buffer and written in one transaction when the buffer reaches buffer_size, when the OOM killer releases memory, or when sing-box is closed. An optional flush_interval writes the buffer periodically. Previously each DNS response, RDRC entry and FakeIP mapping was committed in its own transaction. Also open the database with NoFreelistSync, and mark store_rdrc and rdrc_timeout as deprecated in the options.
Co-authored-by: jebbs <[email protected]> Co-authored-by: PuerNya <[email protected]>
(cherry picked from commit rnetx@e98000c)
makes remote rule-set `path` correct
Co-authored-by: arm64v8a <[email protected]>
…elds Add TCPKeepAliveCount to ListenOptions (inbound) and apply it in listener_tcp.go, complementing the existing outbound-only support. Also move TCPKeepAliveCount in DialerOptions to sit next to other TCP keepalive fields for consistency.
Signed-off-by: lux5am <[email protected]>
Signed-off-by: lux5am <[email protected]>
Signed-off-by: lux5am <[email protected]>
Signed-off-by: lux5am <[email protected]>
Signed-off-by: lux5am <[email protected]>
The handler reset the cache file directly, so mappings kept in memory (store_fakeip disabled or no cache file) were never cleared, and a missing bucket turned the request into a 500. Reset through the FakeIP store instead, which now also restarts allocation from the beginning of the ranges, and ignore missing buckets in the cache file.
reF1nd
force-pushed
the
reF1nd-testing-next
branch
from
September 24, 2026 03:32
9e5ea21 to
137440a
Compare
Delusions6515
pushed a commit
to Delusions6515/sing-box
that referenced
this pull request
Sep 28, 2026
… 6258)
Дефолтный session id — дашед-UUID: 36 символов, hex, дефисы на фиксированных
позициях, а в packet-up к нему приклеивается инкрементный /0, /1, /2. Отпечаток
узнаётся регуляркой. Две новые опции заменяют его случайной строкой заданного
вида: session_table (имя предопределённого алфавита или свой ASCII-набор) +
session_length ("min-max" или "n").
Ручка чисто клиентская: сервер видит session id как непрозрачный ключ
группировки, согласование не нужно, Xray-сервер принимает любую форму. Дефолт
не изменился — без этих полей id остаётся UUID, как и у ненастроенного Xray.
Отход от Xray, осознанный: половинчатую конфигурацию (одна опция из двух)
отвергаем с ошибкой, а не вырождаемся молча в UUID — иначе написавший
session_table без session_length получил бы ровно то, от чего уходил, и заметил
бы только по проводу. Валидация: пол длины > 0, пространство id (len^min) > 2^31,
алфавит ASCII.
Имена полей по нашей конвенции (session_placement/session_key), не по
Xray-camelCase; Xray-имена указаны в доках для поиска.
Вопрос из issue reF1nd#13; апстрим — XTLS/Xray-core#6258.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
POST /cache/fakeip/flushreset the cache file directly instead of going through the FakeIP store:store_fakeipdisabled or without a cache file, mappings live in the in-memory storage and were never cleared.DeleteBucketfails withbucket not foundfor buckets that were never created (e.g. the IPv6 domain bucket when only IPv4 is used, or all of them withstore_fakeipdisabled), so the request returned 500 even when the mappings were cleared.Changes:
DNSTransportManager.FakeIP().Store(), so both storages are cleared.Store.Reset(previously unused) now also restarts allocation from the beginning of the ranges and saves the metadata, under the allocation lock.CacheFile.FakeIPResetignores missing buckets.Tested with unit tests for the store and the cache file, and manually with no cache file,
store_fakeip: falseandstore_fakeip: true: the flush returns 204 and allocation restarts from198.18.0.2in all three cases.