Programming Languages Used in bannedbook/fanqiang: A Complete Technical Breakdown
The bannedbook/fanqiang repository is a polyglot codebase that combines Java, Kotlin, Go, Python, Shell (Bash), JavaScript, and C to create a cross-platform censorship circumvention toolkit.
The fanqiang project (meaning "scale the wall" in Chinese) is an open-source repository focused on circumventing internet censorship. Understanding the programming languages used in bannedbook/fanqiang reveals how the project balances native Android performance, cross-platform networking capabilities, and automated deployment scripts.
Java and Kotlin for Android Frontend
The mobile client relies on a dual-language approach for Android development, with legacy components in Java and modern features implemented in Kotlin.
Java Components
Java handles core Android application logic including UI services, networking configurations, and proxy management. In fqnews2/app/src/main/java/moe/matsuri/nb4a/proxy/shadowtls/ShadowTLSBean.java, the ShadowTLSBean class defines configuration objects for the ShadowTLS proxy protocol:
public class ShadowTLSBean extends StandardV2RayBean {
public Integer version;
public String password;
@Override
public void initializeDefaultValues() {
super.initializeDefaultValues();
// default ShadowTLS-specific values
}
}
This file demonstrates how Java structures the proxy configuration data used by the Android client to manage V2Ray and Shadowsocks connections.
Kotlin Components
Kotlin powers modern Android components, UI bindings, and coroutine-based asynchronous logic. The project uses Kotlin for unit testing and newer architectural components, as seen in fqnews2/app/src/test/java/com/nononsenseapps/feeder/archmodel/SettingsStoreTest.kt:
@Test
fun `store should hide FAB when disabled`() {
val store = SettingsStore()
store.showFab.value = false
assertEquals(false, store.showFab.value)
}
The migration toward Kotlin enables more concise syntax and better support for Android's modern concurrency patterns.
Go for Core Networking
The Go programming language implements the high-performance networking and proxy core within the libcore package. According to the bannedbook/fanqiang source code, Go handles STUN clients, DNS resolution, geosite filtering, and geo-IP management.
In fqnews2/libcore/stun/client.go, the STUN client discovers public IP addresses for VPN setups:
func main() {
addr := "stun.l.google.com:19302"
c, err := stun.Dial(addr)
if err != nil { log.Fatal(err) }
var ip net.IP
if err = c.Do(stun.TransactionID{}, stun.NewBindingRequest(), &ip); err != nil {
log.Fatal(err)
}
fmt.Println("Public IP:", ip)
}
Go provides cross-platform compilation targets for Android, Linux, macOS, and Windows while maintaining performance-critical networking operations.
Python for Automation and Rule Generation
Python scripts automate the generation of firewall rules and GFW (Great Firewall) list processing. Located in fqnews/core/gfwlist/gen.py, the Python utilities parse raw blocklists and generate ACL configurations:
import json, re
def parse_gfwlist(raw):
rules = set()
for line in raw.splitlines():
line = line.strip()
if line and not line.startswith('!'):
rules.add(line)
return rules
with open('gfwlist.txt') as f:
acl = parse_gfwlist(f.read())
print(json.dumps(list(acl), indent=2))
These helper utilities streamline the creation of rule sets that determine which domains require proxy routing.
Shell Scripts for Deployment
Shell (Bash) scripts handle installation, configuration, and virtual machine provisioning. The repository includes automation scripts for deploying V2Ray and Shadowsocks servers on various VPS platforms.
In v2ss/server-cfg/v2ray-init.sh, the official V2Ray installer is invoked:
#!/usr/bin/env bash
curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh | bash
Additional shell scripts manage server-side utilities and initial environment setup across different operating systems.
C for Cryptographic Primitives
C implements low-level cryptographic operations critical for WireGuard functionality. The fqnews/app/src/main/java/com/wireguard/crypto/Ed25519.java file contains JNI wrappers that interface with underlying C code for Ed25519 and Curve25519 operations.
These cryptographic primitives provide the speed and security necessary for modern VPN protocols, with C delivering performance that higher-level languages cannot match.
Legacy JavaScript Components
The repository contains JavaScript assets in the deprecated folder, including deprecated/jw/jwd.js. These legacy web UI helpers supported older web-based configuration interfaces but are no longer actively maintained. They remain in the codebase primarily for backward compatibility with historical deployment methods.
Summary
- Java provides the foundation for Android UI services and proxy configuration objects in files like
ShadowTLSBean.java. - Kotlin enables modern Android development patterns and comprehensive unit testing within the
fqnews2module. - Go delivers the high-performance
libcorenetworking engine that handles STUN, DNS, and cross-platform proxy logic. - Python automates GFW-list processing and rule generation through scripts in
fqnews/core/gfwlist/. - Shell (Bash) scripts automate server deployment and V2Ray installation across Linux environments.
- C underpins cryptographic operations for WireGuard via JNI interfaces in the crypto package.
- JavaScript appears only in deprecated legacy components no longer used in current builds.
Frequently Asked Questions
What is the primary language for the Android app in bannedbook/fanqiang?
Java serves as the primary language for core Android application logic, particularly for proxy configuration and UI services, while Kotlin handles newer components and testing. The split reflects a gradual migration from Java to modern Android development practices.
Why does fanqiang use Go for networking?
Go compiles to native code for multiple platforms including Android, Linux, macOS, and Windows, while providing high-performance concurrency patterns essential for STUN clients, DNS handling, and proxy operations. The libcore package leverages Go to share networking logic across all supported platforms.
How does Python contribute to the fanqiang project?
Python scripts in fqnews/core/gfwlist/gen.py parse and process Great Firewall blocklists to generate ACL rule sets. These utilities automate the maintenance of domain-blocking rules that determine which traffic routes through proxy servers.
Is the bannedbook/fanqiang repository actively maintained?
Yes, the repository shows active maintenance through its polyglot architecture, with modern Kotlin components replacing older Java code, while Go and Python utilities receive updates for networking protocols and rule generation. The presence of deprecated JavaScript files indicates ongoing codebase modernization.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →