ChebuNET — source code of the modifications of Xray-core and libXray
===================================================================

The ChebuNET app for iPhone and iPad embeds a static build of libXray (https://github.com/XTLS/libXray, MIT)
with Xray-core (https://github.com/XTLS/Xray-core, Mozilla Public License 2.0). We modify several Xray-core
files and replace the iOS memory policy of libXray. This archive is the Source Code Form of those
modifications, published under MPL-2.0 (section 3.2(a)).

Upstream versions
  libXray    tag v26.10.10, commit c0cc8d4a86d32e71e2b4e9e6377723597a069a3d
  Xray-core  tag v26.10.10, commit 701af60772cda123492f86e383e1fdba066614a9 (the version pinned in libXray go.mod)
  Patch set  rx256+obs8+oom+mem3+xh+pc+doh+ob+why+oc+slp+en

Contents
  modified/xray-core/   full text of every modified Xray-core file (MPL-2.0)
  modified/libXray/     files added to / replaced in libXray memory/ (MPL-2.0; libXray itself is MIT)
  patches/*.diff        the same changes as unified diffs against the upstream commits
  tools/libxray/        the scripts that apply the changes and build libXray.a for iOS:
                          patch_tun_buffers.py   - edits Xray-core sources
                          patch_memory_policy.py - installs memory/*.go into libXray
                          build_ios.sh           - clones upstream, applies patches, builds (GOOS=ios, c-archive)
  LICENSE               Mozilla Public License 2.0 (from Xray-core)
  LICENSE.libXray       MIT License (from libXray)

Modified Xray-core files
  app/dns/nameserver_doh.go
  app/observatory/observer.go
  app/proxyman/outbound/handler.go
  proxy/tun/stack_gvisor.go
  proxy/tun/udp_fullcone.go
  transport/internet/grpc/dial.go
  transport/internet/splithttp/dialer.go

Added / replaced libXray files
  memory/memory_ios.go
  memory/policy.go
  memory/policy_test.go
  memory/prof.go
  memory/prof_test.go

Reproduce
  git clone https://github.com/XTLS/Xray-core.git && git -C Xray-core checkout 701af60772cda123492f86e383e1fdba066614a9
  git clone https://github.com/XTLS/libXray.git   && git -C libXray checkout c0cc8d4a86d32e71e2b4e9e6377723597a069a3d
  python3 tools/libxray/patch_tun_buffers.py Xray-core
  python3 tools/libxray/patch_memory_policy.py libXray
  (or: git -C Xray-core apply ../patches/xray-core.diff; git -C libXray apply ../patches/libXray.diff)
  Full iOS build: tools/libxray/build_ios.sh v26.10.10 (needs Go, clang and an iPhoneOS SDK; see the script header).

Code comments are in Russian. Most limits can be tuned with environment variables that the app's VPN
extension sets (XRAY_TUN_*, XRAY_OBS_*, XRAY_GRPC_*, XRAY_DOH_IDLE, XRAY_XHTTP_*, XRAY_OL_CONNLOG); the
memory policy marker is exported by libXray as the constant memory.Patch.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was
not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

Contact: support@chebunet.app
