Skip to content

Commit a20f07b

Browse files
committed
first commit - 1.0.0
0 parents  commit a20f07b

96 files changed

Lines changed: 16087 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: Official Release
2+
3+
# Required repository secrets:
4+
# - ANDROID_SIGNING_KEYSTORE_BASE64
5+
# - ANDROID_SIGNING_STORE_PASSWORD
6+
# - ANDROID_SIGNING_KEY_ALIAS
7+
# - ANDROID_SIGNING_KEY_PASSWORD
8+
#
9+
on:
10+
push:
11+
tags:
12+
- "*"
13+
14+
permissions:
15+
contents: write
16+
17+
env:
18+
ANDROID_API: "26"
19+
GRADLE_ANDROID_NDK_VERSION: "26.3.11579264"
20+
STORMDNS_ANDROID_NDK_VERSION: "29.0.14206865"
21+
22+
jobs:
23+
release:
24+
name: Build, sign, and publish release APKs
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Checkout WhiteDNS
29+
uses: actions/checkout@v4
30+
with:
31+
submodules: recursive
32+
33+
- name: Set up JDK
34+
uses: actions/setup-java@v4
35+
with:
36+
distribution: temurin
37+
java-version: "17"
38+
cache: gradle
39+
40+
- name: Set up Android SDK
41+
uses: android-actions/setup-android@v3
42+
43+
- name: Install Android SDK packages
44+
run: |
45+
set -euo pipefail
46+
command -v sdkmanager
47+
yes | sdkmanager --licenses >/dev/null || true
48+
sdkmanager \
49+
"platforms;android-36" \
50+
"build-tools;36.0.0" \
51+
"ndk;${GRADLE_ANDROID_NDK_VERSION}" \
52+
"ndk;${STORMDNS_ANDROID_NDK_VERSION}"
53+
54+
- name: Set up Go
55+
uses: actions/setup-go@v5
56+
with:
57+
go-version-file: third_party/StormDNS/go.mod
58+
cache-dependency-path: third_party/StormDNS/go.sum
59+
60+
- name: Build StormDNS native clients
61+
run: |
62+
set -euo pipefail
63+
make stormdns \
64+
NDK_HOST=linux-x86_64 \
65+
NDK_ROOT="${ANDROID_HOME}/ndk/${STORMDNS_ANDROID_NDK_VERSION}"
66+
67+
- name: Run unit tests
68+
run: ./gradlew testDebugUnitTest
69+
70+
- name: Build unsigned release APKs
71+
run: |
72+
set -euo pipefail
73+
TAG_NAME="${GITHUB_REF_NAME}"
74+
VERSION_NAME="${TAG_NAME#v}"
75+
./gradlew :app:assembleRelease \
76+
-PWHITE_DNS_VERSION_NAME="${VERSION_NAME}" \
77+
-PWHITE_DNS_VERSION_CODE="${GITHUB_RUN_NUMBER}"
78+
79+
- name: Sign release APKs
80+
env:
81+
ANDROID_SIGNING_KEYSTORE_BASE64: ${{ secrets.ANDROID_SIGNING_KEYSTORE_BASE64 }}
82+
ANDROID_SIGNING_STORE_PASSWORD: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
83+
ANDROID_SIGNING_KEY_ALIAS: ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }}
84+
ANDROID_SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}
85+
run: |
86+
set -euo pipefail
87+
for secret_name in \
88+
ANDROID_SIGNING_KEYSTORE_BASE64 \
89+
ANDROID_SIGNING_STORE_PASSWORD \
90+
ANDROID_SIGNING_KEY_ALIAS \
91+
ANDROID_SIGNING_KEY_PASSWORD
92+
do
93+
if [[ -z "${!secret_name:-}" ]]; then
94+
echo "::error::Missing GitHub secret: ${secret_name}"
95+
exit 1
96+
fi
97+
done
98+
99+
TAG_NAME="${GITHUB_REF_NAME}"
100+
KEYSTORE_PATH="${RUNNER_TEMP}/whitedns-release.keystore"
101+
echo "${ANDROID_SIGNING_KEYSTORE_BASE64}" | base64 --decode > "${KEYSTORE_PATH}"
102+
103+
BUILD_TOOLS_DIR="$(find "${ANDROID_HOME}/build-tools" -mindepth 1 -maxdepth 1 -type d | sort -V | tail -n 1)"
104+
mkdir -p dist
105+
106+
shopt -s nullglob
107+
unsigned_apks=(app/build/outputs/apk/release/*-release-unsigned.apk)
108+
if (( ${#unsigned_apks[@]} == 0 )); then
109+
echo "::error::No unsigned release APKs found."
110+
exit 1
111+
fi
112+
113+
for unsigned_apk in "${unsigned_apks[@]}"; do
114+
base_name="$(basename "${unsigned_apk}" -release-unsigned.apk)"
115+
abi_name="${base_name#app-}"
116+
aligned_apk="${RUNNER_TEMP}/${base_name}-aligned.apk"
117+
signed_apk="dist/WhiteDNS-${TAG_NAME}-${abi_name}.apk"
118+
119+
"${BUILD_TOOLS_DIR}/zipalign" -f -p 4 "${unsigned_apk}" "${aligned_apk}"
120+
"${BUILD_TOOLS_DIR}/apksigner" sign \
121+
--ks "${KEYSTORE_PATH}" \
122+
--ks-pass "pass:${ANDROID_SIGNING_STORE_PASSWORD}" \
123+
--ks-key-alias "${ANDROID_SIGNING_KEY_ALIAS}" \
124+
--key-pass "pass:${ANDROID_SIGNING_KEY_PASSWORD}" \
125+
--out "${signed_apk}" \
126+
"${aligned_apk}"
127+
"${BUILD_TOOLS_DIR}/apksigner" verify --verbose "${signed_apk}"
128+
done
129+
130+
cp THIRD_PARTY_NOTICES.md "dist/WhiteDNS-${TAG_NAME}-THIRD_PARTY_NOTICES.md"
131+
(cd dist && shasum -a 256 * > SHA256SUMS.txt)
132+
133+
- name: Publish GitHub Release
134+
env:
135+
GH_TOKEN: ${{ github.token }}
136+
run: |
137+
set -euo pipefail
138+
TAG_NAME="${GITHUB_REF_NAME}"
139+
RELEASE_TITLE="WhiteDNS ${TAG_NAME}"
140+
NOTES_FILE="${RUNNER_TEMP}/release-notes.md"
141+
142+
cat > "${NOTES_FILE}" <<EOF
143+
Official WhiteDNS release for ${TAG_NAME}.
144+
145+
WhiteDNS is not published on Google Play. APKs attached to this GitHub release are the official release artifacts for this tag.
146+
147+
See LICENSE.MD, CONTRIBUTING.md, CLA.md, and TRADEMARK.MD before using or contributing to this project.
148+
EOF
149+
150+
release_flags=()
151+
if [[ "${TAG_NAME}" =~ (alpha|beta|rc) ]]; then
152+
release_flags+=(--prerelease)
153+
fi
154+
155+
if gh release view "${TAG_NAME}" >/dev/null 2>&1; then
156+
gh release upload "${TAG_NAME}" dist/* --clobber
157+
else
158+
gh release create "${TAG_NAME}" dist/* \
159+
--title "${RELEASE_TITLE}" \
160+
--notes-file "${NOTES_FILE}" \
161+
"${release_flags[@]}"
162+
fi

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.gradle/
2+
.gradle-home/
3+
.idea/
4+
.DS_Store
5+
.kotlin/
6+
build/
7+
app/build/
8+
local.properties
9+
captures/
10+
*.iml
11+
*.apk
12+
*.aab
13+
*.jks
14+
*.keystore
15+
*.p12
16+
*.pem
17+
id_ed25519*
18+
id_rsa*
19+
nemigam*
20+
21+
/storm-dns/
22+
/StormDNS/

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "third_party/StormDNS"]
2+
path = third_party/StormDNS
3+
url = https://github.com/iampedii/StormDNS.git
4+
branch = feat/whitedns-android-client

CLA.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# WhiteDNS Contributor License Agreement
2+
3+
By submitting code, documentation, translations, designs, bug fixes, patches, or other contributions to WhiteDNS, you agree to the following terms:
4+
5+
## 1. Contribution Rights
6+
7+
You confirm that:
8+
9+
- the contribution is your original work; or
10+
- you have the necessary rights and permissions to submit it.
11+
12+
## 2. License to WhiteDNS
13+
14+
You grant WhiteDNS and its maintainers a perpetual, worldwide, royalty-free, irrevocable license to use, copy, modify, publish, distribute, sublicense, and include your contribution in the WhiteDNS project and related products.
15+
16+
## 3. No Ownership Transfer of WhiteDNS
17+
18+
Submitting a contribution does not give you ownership, control, revenue share, trademark rights, publishing rights, or distribution rights over WhiteDNS.
19+
20+
## 4. No Right to Fork or Redistribute
21+
22+
Submitting a contribution does not give you permission to fork, redistribute, repackage, re-sign, sell, clone, or create a derivative app based on WhiteDNS.
23+
24+
## 5. No Warranty
25+
26+
You provide your contribution without warranty of any kind.
27+
28+
## 6. Agreement
29+
30+
By opening a pull request, submitting a patch, or contributing to WhiteDNS, you agree to this Contributor License Agreement.

CONTRIBUTING.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Contributing to WhiteDNS
2+
3+
Thank you for your interest in contributing to WhiteDNS.
4+
5+
WhiteDNS is a source-available project. Community contributions are welcome, but the project is not open-source.
6+
7+
## What You Can Do
8+
9+
You may:
10+
11+
- report bugs;
12+
- suggest features;
13+
- submit pull requests to the official repository;
14+
- improve documentation;
15+
- improve translations;
16+
- review code for security issues;
17+
- help test official builds.
18+
19+
## What You Cannot Do
20+
21+
You may not:
22+
23+
- fork WhiteDNS to create another app;
24+
- publish modified builds;
25+
- redistribute APK files;
26+
- re-sign or repackage the app;
27+
- sell the app or any modified version;
28+
- use the WhiteDNS name, logo, icon, design, or brand in another project;
29+
- create a clone, competing product, or derivative app based on this code.
30+
31+
## Pull Requests
32+
33+
By submitting a pull request, you agree that your contribution may be used, modified, distributed, and included in the official WhiteDNS app.
34+
35+
You also confirm that your contribution is your own work or that you have the legal right to submit it.
36+
37+
## Security Issues
38+
39+
Please do not publicly disclose security vulnerabilities before giving the WhiteDNS team time to review and fix them.
40+
41+
Report security issues privately through the official contact channel.
42+
43+
## License
44+
45+
By contributing, you agree to the WhiteDNS Source-Available Proprietary License.

LICENSE.MD

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
WhiteDNS Source-Available Proprietary License
2+
3+
Copyright (c) 2026 WhiteDNS / Pedram Marandi. All rights reserved.
4+
5+
This software is source-available, not open-source.
6+
7+
1. Permission to View and Contribute
8+
9+
You may view the source code for transparency, security review, learning, and contribution to the official WhiteDNS project.
10+
11+
You may submit issues, bug reports, pull requests, patches, translations, documentation improvements, and other contributions to the official WhiteDNS repository.
12+
13+
2. No Redistribution or Forked Apps
14+
15+
You may not copy, redistribute, publish, mirror, sell, rent, lease, sublicense, repackage, re-sign, upload, or distribute this software, in whole or in part, without prior written permission.
16+
17+
You may not use this software, source code, UI, APK, assets, configuration format, or related materials to create, publish, distribute, or operate another app, fork, clone, modified version, competing service, or derivative product.
18+
19+
3. No Rebranding
20+
21+
You may not use the WhiteDNS name, logo, icon, brand, design, screenshots, Telegram identity, domain names, package identity, or confusingly similar names or branding without prior written permission.
22+
23+
4. Contributions
24+
25+
By submitting a contribution to the official WhiteDNS project, you agree that your contribution may be used, modified, distributed, sublicensed, and included in WhiteDNS by the project maintainers.
26+
27+
You confirm that your contribution is your original work or that you have the necessary rights to submit it.
28+
29+
You do not receive ownership, control, revenue share, or distribution rights over the WhiteDNS project by submitting a contribution.
30+
31+
5. Official Distribution Only
32+
33+
Only APKs and releases published by the official WhiteDNS team are authorized.
34+
35+
Modified, re-signed, repackaged, redistributed, or unofficial APKs are not permitted and may be unsafe.
36+
37+
6. Reverse Engineering and Security Research
38+
39+
Security research is allowed only for responsible disclosure to the official WhiteDNS team.
40+
41+
You may not publicly distribute exploit code, modified builds, bypass tools, malware-injected versions, or instructions that enable abuse of WhiteDNS users.
42+
43+
7. No Warranty
44+
45+
This software is provided "as is", without warranty of any kind.
46+
47+
The copyright holder is not responsible for damages, data loss, security issues, misuse, service interruption, or other consequences arising from use of the software.
48+
49+
8. Termination
50+
51+
Your permission to view or use this software ends automatically if you violate this license.
52+
53+
9. Permission Requests
54+
55+
For commercial use, redistribution, partnerships, or special permissions, contact the official WhiteDNS team.

Makefile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
SHELL := /bin/bash
2+
3+
SDK_ROOT ?= $(HOME)/Library/Android/sdk
4+
NDK_VERSION ?= 29.0.14206865
5+
NDK_ROOT ?= $(SDK_ROOT)/ndk/$(NDK_VERSION)
6+
NDK_HOST ?= darwin-x86_64
7+
NDK_BIN := $(NDK_ROOT)/toolchains/llvm/prebuilt/$(NDK_HOST)/bin
8+
ANDROID_API ?= 26
9+
10+
GO ?= go
11+
GRADLE ?= ./gradlew
12+
STORMDNS_DIR := third_party/StormDNS
13+
STORMDNS_CMD := ./cmd/client
14+
STORMDNS_BUILD_DIR := $(STORMDNS_DIR)/build/android
15+
JNI_LIBS_DIR := app/src/main/jniLibs
16+
GO_CACHE := $(STORMDNS_DIR)/.gocache
17+
STORMDNS_LDFLAGS := -s -w -linkmode external -extldflags "-Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384"
18+
19+
.PHONY: all debug stormdns stormdns-arm64 stormdns-armv7 stormdns-x86_64 stormdns-x86 clean clean-stormdns clean-app check-ndk debug-outputs
20+
21+
all: debug
22+
23+
debug: stormdns
24+
$(GRADLE) :app:assembleDebug
25+
26+
stormdns: stormdns-arm64 stormdns-armv7 stormdns-x86_64 stormdns-x86
27+
28+
check-ndk:
29+
@test -x "$(NDK_BIN)/aarch64-linux-android$(ANDROID_API)-clang" || (echo "Android NDK not found at $(NDK_ROOT). Install NDK $(NDK_VERSION) or set NDK_ROOT=/path/to/ndk."; exit 1)
30+
31+
stormdns-arm64: check-ndk
32+
@mkdir -p "$(STORMDNS_BUILD_DIR)/arm64-v8a" "$(JNI_LIBS_DIR)/arm64-v8a" "$(GO_CACHE)"
33+
cd "$(STORMDNS_DIR)" && GOCACHE="$$PWD/.gocache" CGO_ENABLED=1 CC="$(NDK_BIN)/aarch64-linux-android$(ANDROID_API)-clang" GOOS=android GOARCH=arm64 $(GO) build -trimpath -ldflags='$(STORMDNS_LDFLAGS)' -o "build/android/arm64-v8a/stormdns-client" "$(STORMDNS_CMD)"
34+
cp "$(STORMDNS_BUILD_DIR)/arm64-v8a/stormdns-client" "$(JNI_LIBS_DIR)/arm64-v8a/libstormdns_client.so"
35+
chmod 755 "$(STORMDNS_BUILD_DIR)/arm64-v8a/stormdns-client" "$(JNI_LIBS_DIR)/arm64-v8a/libstormdns_client.so"
36+
37+
stormdns-armv7: check-ndk
38+
@mkdir -p "$(STORMDNS_BUILD_DIR)/armeabi-v7a" "$(JNI_LIBS_DIR)/armeabi-v7a" "$(GO_CACHE)"
39+
cd "$(STORMDNS_DIR)" && GOCACHE="$$PWD/.gocache" CGO_ENABLED=1 CC="$(NDK_BIN)/armv7a-linux-androideabi$(ANDROID_API)-clang" GOOS=android GOARCH=arm GOARM=7 $(GO) build -trimpath -ldflags='$(STORMDNS_LDFLAGS)' -o "build/android/armeabi-v7a/stormdns-client" "$(STORMDNS_CMD)"
40+
cp "$(STORMDNS_BUILD_DIR)/armeabi-v7a/stormdns-client" "$(JNI_LIBS_DIR)/armeabi-v7a/libstormdns_client.so"
41+
chmod 755 "$(STORMDNS_BUILD_DIR)/armeabi-v7a/stormdns-client" "$(JNI_LIBS_DIR)/armeabi-v7a/libstormdns_client.so"
42+
43+
stormdns-x86_64: check-ndk
44+
@mkdir -p "$(STORMDNS_BUILD_DIR)/x86_64" "$(JNI_LIBS_DIR)/x86_64" "$(GO_CACHE)"
45+
cd "$(STORMDNS_DIR)" && GOCACHE="$$PWD/.gocache" CGO_ENABLED=1 CC="$(NDK_BIN)/x86_64-linux-android$(ANDROID_API)-clang" GOOS=android GOARCH=amd64 $(GO) build -trimpath -ldflags='$(STORMDNS_LDFLAGS)' -o "build/android/x86_64/stormdns-client" "$(STORMDNS_CMD)"
46+
cp "$(STORMDNS_BUILD_DIR)/x86_64/stormdns-client" "$(JNI_LIBS_DIR)/x86_64/libstormdns_client.so"
47+
chmod 755 "$(STORMDNS_BUILD_DIR)/x86_64/stormdns-client" "$(JNI_LIBS_DIR)/x86_64/libstormdns_client.so"
48+
49+
stormdns-x86: check-ndk
50+
@mkdir -p "$(STORMDNS_BUILD_DIR)/x86" "$(JNI_LIBS_DIR)/x86" "$(GO_CACHE)"
51+
cd "$(STORMDNS_DIR)" && GOCACHE="$$PWD/.gocache" CGO_ENABLED=1 CC="$(NDK_BIN)/i686-linux-android$(ANDROID_API)-clang" GOOS=android GOARCH=386 $(GO) build -trimpath -ldflags='$(STORMDNS_LDFLAGS)' -o "build/android/x86/stormdns-client" "$(STORMDNS_CMD)"
52+
cp "$(STORMDNS_BUILD_DIR)/x86/stormdns-client" "$(JNI_LIBS_DIR)/x86/libstormdns_client.so"
53+
chmod 755 "$(STORMDNS_BUILD_DIR)/x86/stormdns-client" "$(JNI_LIBS_DIR)/x86/libstormdns_client.so"
54+
55+
debug-outputs:
56+
@find app/build/outputs/apk/debug -type f -name '*.apk' -print | sort
57+
58+
clean: clean-app clean-stormdns
59+
60+
clean-app:
61+
$(GRADLE) :app:clean
62+
63+
clean-stormdns:
64+
rm -rf "$(STORMDNS_BUILD_DIR)" "$(GO_CACHE)"

0 commit comments

Comments
 (0)