Offline source audit

PASS libcronet.dll matches pinned Go module archive byte-for-byte
PASS 135 Go module source ZIP h1 hashes match embedded binary module sums
PASS root sing-box.exe equals packaged sing-box.exe: True
cronet-go-45832ab07484.tar.gz: cronet-go-45832ab07484/.gitmodules
[submodule "naiveproxy"]
	path = naiveproxy
	url = https://github.com/SagerNet/naiveproxy.git
	branch = cronet-go

cronet-go-45832ab07484.tar.gz: cronet-go-45832ab07484/README.md
# cronet-go

[![Reference](https://pkg.go.dev/badge/github.com/sagernet/cronet-go.svg)](https://pkg.go.dev/github.com/sagernet/cronet-go)

Go bindings for [naiveproxy](https://github.com/klzgrad/naiveproxy).

## Supported Platforms

| Target        | OS      | CPU   |
|---------------|---------|-------|
| android/386   | android | x86   |
| android/amd64 | android | x64   |
| android/arm   | android | arm   |
| android/arm64 | android | arm64 |
| darwin/amd64  | mac     | x64   |
| darwin/arm64  | mac     | arm64 |
| ios/arm64     | ios     | arm64 |
| ios/amd64     | ios     | amd64 |
| linux/386     | linux   | x86   |
| linux/amd64   | linux   | x64   |
| linux/arm     | linux   | arm   |
| linux/arm64   | linux   | arm64   |
| linux/loong64 | linux   | loong64 |
| windows/amd64 | win     | x64     |
| windows/arm64 | win     | arm64 |

## System Requirements

| Platform      | Minimum Version |
|---------------|-----------------|
| macOS         | 12.0 (Monterey) |
| iOS/tvOS      | 15.0            |
| Windows       | 10              |
| Android       | 5.0 (API 21)    |
| Linux (glibc)       | glibc 2.31 (loong64: 2.36) |
| Linux (musl)        | any (loong64: 1.2.5)       |

## Downstream Build Requirements

| Platform                             | Requirements                    | Go Build Flags                    |
|--------------------------------------|---------------------------------|-----------------------------------|
| Linux (glibc)                        | Chromium toolchain              | -                                 |
| Linux (musl)                         | Chromium toolchain              | `-tags with_musl`                 |
| macOS / iOS                          | macOS Xcode                     | -                                 |
| iOS simulator/ tvOS / tvOS simulator | macOS Xcode + SagerNet/gomobile | -                                 |
| Windows                              | -                               | `CGO_ENABLED=0 -tags with_purego` |
| Android                              | Android NDK                     | -                                 |

## Linux Build instructions

```bash
git clone --recursive --depth=1 https://github.com/sagernet/cronet-go.git
cd cronet-go
go run ./cmd/build-naive --target=linux/amd64 download-toolchain
#go run ./cmd/build-naive --target=linux/amd64 --libc=musl download-toolchain

# Outputs CC, CXX, and CGO_LDFLAGS=-fuse-ld=lld
export $(go run ./cmd/build-naive --target=linux/amd64 env)
#export $(go run ./cmd/build-naive --target=linux/amd64 --libc=musl env)

cd /path/to/your/project
go build
# go build -tags with_musl
```

### Directories to cache

```yaml
- cronet-go/naiveproxy/src/third_party/llvm-build/
- cronet-go/naiveproxy/src/gn/out/
- cronet-go/naiveproxy/src/chrome/build/pgo_profiles/
- cronet-go/naiveproxy/src/out/sysroot-build/
```

## Windows / purego Build Instructions

For Windows or pure Go builds (no CGO), you need to distribute the dynamic library alongside your binary.

### Download Library

Download `libcronet.dll` (Windows) or `libcronet.so` (Linux) from [GitHub Releases](https://github.com/sagernet/cronet-go/releases).

### Build with purego

```bash
# Windows (purego is required)
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -tags with_purego -o myapp.exe

# Linux with purego (optional, for dynamic linking)
CGO_ENABLED=0 go build -tags with_purego -o myapp
```

### Distribution

Place the library file in the same directory as your executable:
- Windows: `libcronet.dll`
- Linux: `libcronet.so`

### For Downstream Developers

The `go` branch holds the libraries. The same commit supplies the
`github.com/sagernet/cronet-go/lib/*` modules. Pin this commit. Read the library file from it:

```bash
git init cronet-go-lib
git -C cronet-go-lib remote add origin https://github.com/sagernet/cronet-go.git
git -C cronet-go-lib sparse-checkout set --no-cone /lib/windows_amd64/libcronet.dll
git -C cronet-go-lib fetch --depth=1 --filter=blob:none origin "$CRONET_GO_VERSION"
git -C cronet-go-lib checkout FETCH_HEAD
```

cronet-go-libraries-f80ef37265e5.tar.gz: cronet-go-f80ef37265e5/.gitmodules
[submodule "naiveproxy"]
	path = naiveproxy
	url = https://github.com/SagerNet/naiveproxy.git
	branch = cronet-go

cronet-go-libraries-f80ef37265e5.tar.gz: cronet-go-f80ef37265e5/README.md
# cronet-go

[![Reference](https://pkg.go.dev/badge/github.com/sagernet/cronet-go.svg)](https://pkg.go.dev/github.com/sagernet/cronet-go)

Go bindings for [naiveproxy](https://github.com/klzgrad/naiveproxy).

## Supported Platforms

| Target        | OS      | CPU   |
|---------------|---------|-------|
| android/386   | android | x86   |
| android/amd64 | android | x64   |
| android/arm   | android | arm   |
| android/arm64 | android | arm64 |
| darwin/amd64  | mac     | x64   |
| darwin/arm64  | mac     | arm64 |
| ios/arm64     | ios     | arm64 |
| ios/amd64     | ios     | amd64 |
| linux/386     | linux   | x86   |
| linux/amd64   | linux   | x64   |
| linux/arm     | linux   | arm   |
| linux/arm64   | linux   | arm64   |
| linux/loong64 | linux   | loong64 |
| windows/amd64 | win     | x64     |
| windows/arm64 | win     | arm64 |

## System Requirements

| Platform      | Minimum Version |
|---------------|-----------------|
| macOS         | 12.0 (Monterey) |
| iOS/tvOS      | 15.0            |
| Windows       | 10              |
| Android       | 5.0 (API 21)    |
| Linux (glibc)       | glibc 2.31 (loong64: 2.36) |
| Linux (musl)        | any (loong64: 1.2.5)       |

## Downstream Build Requirements

| Platform                             | Requirements                    | Go Build Flags                    |
|--------------------------------------|---------------------------------|-----------------------------------|
| Linux (glibc)                        | Chromium toolchain              | -                                 |
| Linux (musl)                         | Chromium toolchain              | `-tags with_musl`                 |
| macOS / iOS                          | macOS Xcode                     | -                                 |
| iOS simulator/ tvOS / tvOS simulator | macOS Xcode + SagerNet/gomobile | -                                 |
| Windows                              | -                               | `CGO_ENABLED=0 -tags with_purego` |
| Android                              | Android NDK                     | -                                 |

## Linux Build instructions

```bash
git clone --recursive --depth=1 https://github.com/sagernet/cronet-go.git
cd cronet-go
go run ./cmd/build-naive --target=linux/amd64 download-toolchain
#go run ./cmd/build-naive --target=linux/amd64 --libc=musl download-toolchain

# Outputs CC, CXX, and CGO_LDFLAGS=-fuse-ld=lld
export $(go run ./cmd/build-naive --target=linux/amd64 env)
#export $(go run ./cmd/build-naive --target=linux/amd64 --libc=musl env)

cd /path/to/your/project
go build
# go build -tags with_musl
```

### Directories to cache

```yaml
- cronet-go/naiveproxy/src/third_party/llvm-build/
- cronet-go/naiveproxy/src/gn/out/
- cronet-go/naiveproxy/src/chrome/build/pgo_profiles/
- cronet-go/naiveproxy/src/out/sysroot-build/
```

## Windows / purego Build Instructions

For Windows or pure Go builds (no CGO), you need to distribute the dynamic library alongside your binary.

### Download Library

Download `libcronet.dll` (Windows) or `libcronet.so` (Linux) from [GitHub Releases](https://github.com/sagernet/cronet-go/releases).

### Build with purego

```bash
# Windows (purego is required)
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -tags with_purego -o myapp.exe

# Linux with purego (optional, for dynamic linking)
CGO_ENABLED=0 go build -tags with_purego -o myapp
```

### Distribution

Place the library file in the same directory as your executable:
- Windows: `libcronet.dll`
- Linux: `libcronet.so`

### For Downstream Developers

The `go` branch holds the libraries. The same commit supplies the
`github.com/sagernet/cronet-go/lib/*` modules. Pin this commit. Read the library file from it:

```bash
git init cronet-go-lib
git -C cronet-go-lib remote add origin https://github.com/sagernet/cronet-go.git
git -C cronet-go-lib sparse-checkout set --no-cone /lib/windows_amd64/libcronet.dll
git -C cronet-go-lib fetch --depth=1 --filter=blob:none origin "$CRONET_GO_VERSION"
git -C cronet-go-lib checkout FETCH_HEAD
```


These archives do not establish complete Chromium/NaiveProxy source or notices.
A GitHub source archive does not expand git submodules. No complete-source offer is made.