Completes https://github.com/XTLS/Xray-core/pull/6546
https://github.com/XTLS/Xray-core/pull/6546#issuecomment-5100711574