Skip to content
Padra edited this page Jun 25, 2023 · 40 revisions

The Trojan Protocol has yet to be implemented on any mobile platforms. It would be unlikely for an implementation to come out any time soon, due to the complexity involed. (i.e g to implement a session layer protocol on top of a network layer interface). However, there are still various of workarounds which you can use to make Trojan run on Android, iOS or other platforms.

Android

Igniter (trojan for android) is currently under construction. The release versions are not production ready yet but rather for testing purposes. Consult the following for stable usage.

Cigniter (Now merged into Igniter)

Cigniter is a user modified fork of Igniter, which provides the automatic bypass mode to boost the visiting of Chinese website, as well as reduce the traffic consumption of servers. Download the APK.

Pharos Pro have implemented trojan protocol.

Walk Through is a Trojan client for Android based on Flutter. It's currently under construction.

ClashForAndroid has implemented trojan protocol.

Running in Termux

Trojan can be compiled in Termux, an Android terminal emulator. Follow these steps to build and install it:

apt install wget git clang cmake openssl
wget https://mirrors.ustc.edu.cn/termux/dists/stable/main/binary-aarch64/boost_1.69.0-2_aarch64.deb
wget https://mirrors.ustc.edu.cn/termux/dists/stable/main/binary-aarch64/boost-dev_1.69.0-2_aarch64.deb
chmod 777 boost_1.69.0-2_aarch64.deb
chmod 777 boost-dev_1.69.0-2_aarch64.deb
dpkg -i ./boost_1.69.0-2_aarch64.deb
dpkg -i ./boost-dev_1.69.0-2_aarch64.deb
git clone https://github.com/trojan-gfw/trojan
cd trojan/
cmake -DCMAKE_INSTALL_PREFIX=/data/data/com.termux/files/usr -DENABLE_MYSQL=OFF .
make install

If you encounter linker errors, you may need to patch the CMakeLists.txt before cmake:

if(ENABLE_MYSQL)
     target_link_libraries(trojan ${MYSQL_LIBRARIES})
     add_definitions(-DENABLE_MYSQL)
 endif()
+target_link_libraries(trojan atomic)
 if(WIN32)
     target_link_libraries(trojan wsock32 ws2_32 crypt32)
 else()

Next, If you need bypass china domain/ip and local network,use Kitsunebi-android with this custom config.

{
  "outbounds": [
    {
      "protocol": "socks",
      "settings": {
        "servers": [
          {
            "address": "127.0.0.1",
            "port": -----replace with the value of "local_port" in your client config-----
          }
        ]
      },
      "tag": "proxy"
    },
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    }
  ],
  "dns": {
    "servers": [
      {
        "address": "114.114.114.114",
        "port": 53,
        "domains": [
          "geosite:geolocation-cn"
        ]
      },
      {
        "address": "8.8.8.8",
        "port": 53,
        "domains": [
          "geosite:geolocation-!cn"
        ]
      },
      "114.114.114.114"
    ]
  },
  "routing": {
    "strategy": "rules",
    "domainStrategy": "IPIfNonMatch",
    "settings": {
      "rules": [
        {
          "type": "field",
          "ip": [
            "geoip:private",
            "geoip:cn"
          ],
          "outboundTag": "direct"
        },
        {
          "type": "field",
          "domain": [
            "-----replace with your trojan domain-----"
          ],
          "port": -----replace with your trojan port-----,
          "network": "tcp",
          "protocol": [
            "tls"
          ],
          "outboundTag": "direct"
        },
        {
          "type": "field",
          "inboundTag": "tunsocks",
          "outboundTag": "proxy"
        }
      ]
    }
  }
}

If you needn't bypass china domain/ip and local network,use Privoxy to convert SOCKS5 proxy to HTTP proxy, and set system proxy settings to privoxy address and port.

Privoxy can be installed via

apt install privoxy

iOS

Pharos Pro and Shadowrocket have implemented trojan protocol.

iOS has more restrictions than Android. Therefore, the only way to use trojan is to setup a computer on the same LAN to run trojan and then either:

  • Convert SOCKS5 proxy to HTTP proxy by the same means introduced above and set the system proxy settings

OR

  • Use apps like Potatso to redirect network flow to the SOCKS5 proxy.