Repository navigation
Conversation
…кна для балансировщиков Корневой ключ burstObservatory раньше отклонялся как неизвестное поле. Теперь он читается как в Xray-core v26.11.9: subjectSelector и обязательный pingConfig (destination, connectivity, interval, sampling, timeout, httpMethod) с умолчаниями и нижними границами NewHealthPing. Планировщик: один пинг каждого исходящего при старте, затем sampling пингов в случайные моменты каждого периода interval * sampling. Пингует тот же пробник, что и observatory, с методом из httpMethod; проверка connectivity идёт напрямую, мимо исходящих. Статистика для leastLoad, leastPing, random и roundRobin: последние sampling пингов не старше двух периодов, исходящий жив, пока в окне есть успех, задержка равна среднему, отклонение одного успеха равно половине среднего. Неудачный пинг не засчитывается, если не ответил и connectivity. Если заданы оба наблюдателя, выбором управляет observatory, как в Xray-core; burstObservatory проверяется, даёт предупреждение и не запускается. Намеренные отличия, описаны в docs/xray-core-differences.md: - верхние границы interval 24h, sampling 100, timeout 60s с предупреждением; - не больше четырёх пингов одновременно; - пока connectivity не отвечает, уходит один пинг за паузу от 5 с до interval, а не каждый запланированный; - после смены сети (rebind_quic) каждый исходящий пингуется заново через 1-3 с, и первый новый замер заменяет окно прежней сети; - httpMethod, не являющийся HTTP-токеном, и непригодные URL отклоняются. CoreConfig получает поле burst_observatory, NetworkChanges получает observe: подписку, которую notify не считает соединением.
feat(observatory): burstObservatory как в Xray-core, со статистикой окна для балансировщиков Merged on top of #308, whose re-probes on failures of real traffic the pull request's base did not have. crates/xray-core-rs/src/outbound.rs: both recorded a probe's result. #308 keeps a re-probe out of the leastLoad window (HealthSample::StateOnly); this pull request made one record_health_probe that always adds a sample and, under a burst observatory, reads the health from the window. They are one function now: a sample enters the window, a re-probe sets the state, the last delay and the failure count without one, and under a burst observatory, beside which no re-probe runs, a probe that is no sample leaves the window's health alone. select() keeps main's Option. crates/xray-core-rs/src/health.rs: the imports of both; main's kind-aware record_result; the module's Instant stays tokio's, as #308's clocks need, and the burst code names std's in full. crates/xray-transport/src/network_change.rs: generation(), added on main for the DNS connection pools, reads the connections signal of the two this pull request split the changes into. crates/xray-core-rs/src/dns.rs: a test's CoreConfig gains the new field. CHANGELOG.md: the entry goes to the end of the Unreleased list.
…rvatory #308 has the classic observatory probe an outbound again when a flow fails to open through it. The burst observatory merged after it is a loop of its own and follows none of that, which is what its window of the last sampling pings needs. Nothing said so or held it. - traffic_failures_bring_no_reprobe_under_the_burst_observatory: under a burst policy a reported failure leaves no slot pending, since no observatory watches one, and a re-probe's result recorded all the same changes neither the window nor the health read from it. - the_classic_observatory_governs_when_both_are_configured: a core with both starts the classic probes and sends no burst ping. - docs/xray-core-differences.md lists the difference under burstObservatory, and the CHANGELOG entry names it.
Main gained #351 and #353 since this branch was cut. Two files conflict with #353, both because each side adds entries at the same place: crates/xray-config/src/surface.rs: the root object's keys of both, burstObservatory beside the inert root apps and fakeDns, with main's note, which is this branch's plus the sentences on those. tests/fixtures/config-tooling/cases.json: both appended cases to the list. Main's ten stay, and this branch's three follow them.
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.
The merge commit of the unchanged head of #290 on current main (3a70b2d), so that the pull request closes as merged, and one commit on top that pins how it lives beside #308.
burstObservatoryis read and run as in Xray-core v26.11.9, with its window statistics forleastLoad,leastPing,randomandroundRobinThe review of #290 asked its author for a rebase onto #308 and for three things with it. #308 is in main now, and this branch does them here instead.
The merge
#290's base predates #308, and the two overlap in how a probe's result is recorded. This is not a mechanical merge, so it is described file by file.
crates/xray-core-rs/src/outbound.rs(7 hunks). Re-probe observed outbounds when real traffic fails to dial them #308 keeps a re-probe out of theleastLoadwindow:record_reprobe_successandrecord_reprobe_failureset the state, the last delay and the failure count and add no sample. feat(observatory): burstObservatory как в Xray-core, со статистикой окна для балансировщиков #290 replaced the two recording functions by onerecord_health_probethat always adds a sample and, under a burst observatory, reads the outbound's health from the window. They are one function now,store_health_probe, which takes whether the result is a sample:select()keeps main'sResult<Option<OutboundNodeId>>, and the overlay keeps both sides' fields.crates/xray-core-rs/src/health.rs(4 hunks). The imports of both; main'srecord_result, which knows a scheduled probe from a re-probe; feat(observatory): burstObservatory как в Xray-core, со статистикой окна для балансировщиков #290's burst code and tests as they are. The module'sInstantstays tokio's, as Re-probe observed outbounds when real traffic fails to dial them #308's clocks and their paused-time tests need, and the burst code namesstd::time::Instantin full where it hands a time to the overlay.crates/xray-transport/src/network_change.rs(no textual conflict, did not compile). feat(observatory): burstObservatory как в Xray-core, со статистикой окна для балансировщиков #290 splits the change signal in two, for connections and for observers;generation(), added on main for the DNS connection pools, read the single signal. It reads the connections' one now. Both are advanced together.crates/xray-core-rs/src/dns.rs. A test'sCoreConfig, added on main after feat(observatory): burstObservatory как в Xray-core, со статистикой окна для балансировщиков #290's base, gainsburst_observatory: None.CHANGELOG.md. The entry goes to the end of the Unreleased list. The merge also carried the heading of an old release out of feat(observatory): burstObservatory как в Xray-core, со статистикой окна для балансировщиков #290's base; it is removed.The classic
observatoryis unchanged by #290's reworked window: only the burst loop starts a new network epoch, and without a burst policy every sample stays valid, so its window is the last 16 scheduled probes as before. #308's test of that window passes on the merged code.On top (c8f87de)
observatory: pin what failures of real traffic do beside a burst observatorytraffic_failures_bring_no_reprobe_under_the_burst_observatory: under a burst policy a reported failure leaves no slot pending, since only the classic observatory's loop watches the slots, and a re-probe's result recorded all the same changes neither the window nor the health read from it.the_classic_observatory_governs_when_both_are_configured: a core with both observatories starts the classic probes and sends no burst ping.docs/xray-core-differences.mdlists "Failures of real traffic" among the deliberate differences ofburstObservatory, and theCHANGELOG.mdentry names it.Review notes
burstObservatoryalone nothing follows traffic failures, so its window stays the lastsamplingscheduled pings, as inhealthping_result.go; with both observatoriesobservatorygoverns and its re-probes apply.Core::start, the burst loop with its connectivity gate, and the window'srecordandmetrics. Not read line by line: the parser (parser/burst_observatory.rs), the changes tostartup_probe.rsand feat(observatory): burstObservatory как в Xray-core, со статистикой окна для балансировщиков #290's own tests.connectivityURL requests it over the device's own network, outside every outbound, after a failed ping. That is Xray-core's behaviour and happens only when the URL is configured.Verification
--locked:cargo fmt --all -- --check; clippy for the whole workspace with the CI flags;cargo test -p xray-config(747 passed, 0 failed, 1 ignored), where the burst parser's tests live;cargo test -p xray-transport --lib(806 passed, 0 failed);cargo test -p xray-core-rs --lib(831 passed, 0 failed, 4 ignored), which holds Re-probe observed outbounds when real traffic fails to dial them #308's re-probe tests, feat(observatory): burstObservatory как в Xray-core, со статистикой окна для балансировщиков #290's burst tests and the new one; the integration tests feat(observatory): burstObservatory как в Xray-core, со статистикой окна для балансировщиков #290 touches,health_observatory_tests(9),startup_probe_tests(22) andcore_lifecycle_tests(27);scripts/tests/check-public-fixtures.test.sh, since feat(observatory): burstObservatory как в Xray-core, со статистикой окна для балансировщиков #290 adds configuration fixtures;cargo doc --workspace --no-depswith-D warnings. All pass.Update: main merged in (fc52100)
#351 and #353 went into main after this branch was cut, and #353 conflicted with it in two files, each side adding entries at the same place:
crates/xray-config/src/surface.rs: the root object's keys of both,burstObservatorybeside the inert root apps andfakeDns, with main's note.tests/fixtures/config-tooling/cases.json: both appended cases to the list; main's ten stay and this branch's three follow them.docs/config-contract.jsonmerged without a conflict and equals whatconfig_contractgenerates from the merged sources.On fc52100 locally, all with
--locked:cargo fmt --all -- --check; clippy for the whole workspace with the CI flags;cargo test -p xray-config(770 passed, 0 failed, 1 ignored);cargo test -p xray-transport --lib(812 passed);cargo test -p xray-core-rs --lib(837 passed, 0 failed, 4 ignored) withhealth_observatory_tests(9),startup_probe_tests(22),core_lifecycle_tests(27) andaddress_port_phone_tests(1); the public-fixtures gate; rustdoc with-D warnings. All pass.🤖 Generated with Claude Code