• Stars
    star
    114
  • Rank 308,031 (Top 7 %)
  • Language
    Java
  • Created over 9 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

**Umaintained ** Lantern for Android

UNMAINTAINED Lantern Android

This project is no longer maintained.

Overview

Lantern Android is an App that uses the Android VpnService API to route all device traffic through a packet interception service and subsequently the Lantern circumvention tool.

Building Lantern Android

Before building make sure you've compiled the Lantern proxy for Android:

cd $GOPATH/src/github.com/getlantern/lantern
make android-lib

Building from Android Studio

Prerequisites

Download the most recent copy of the Lantern Android source code using git:

mkdir -p ~/AndroidstudioProjects
cd ~/AndroidstudioProjects
git clone https://github.com/getlantern/lantern-mobile.git

In the welcome screen choose the "Open an existing Android Studio" option and select the lantern folder you just checked out with git.

Building from the Command Line (beta, for development only)

Prerequisites

  • Java Development Kit 1.7
  • Git
  • Android NDK
  • Android SDK Tools (if not using Android Studio)
  • Go (1.6 tip is best as it eliminates text-relocations and provides the best performance)

Replace the paths based on wherever you've installed the Android SDK and NDK

export ANDROID_HOME=/opt/adt-bundle-mac-x86_64-20130917/sdk
export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/23.0.2/:$PATH
export NDK_HOME=/opt/android-ndk-r10e
export PATH=$NDK_HOME:$PATH

Using the sdk-manager ($ANDROID_HOME/tools/android), install Android 6.0 API 23 and also the Android SDK Build Tools rev. 23.0.1.

Building tun2socks

Lantern Android uses tun2socks to route intercepted VPN traffic through a local SOCKS server.

make build-tun2socks

Building, installing and running

Build the Debug target:

make build-debug

Install it:

make install

Run the app on the device from the command line:

make run

By default, all three tasks will be run in order with:

make

Note - if you want to test with an emulator, run android and then choose Tools -> Manage AVDs. Create an AVD (e.g. Nexus_4) and then run the emulator from the command line like so:

emulator -avd Nexus_4

The following settings seem to work well enough performance wise:

Device: 3.4" WQVGA 240x432
Target: Android 5.1.1 - API Level 22
CPU/ABI: ARM (armeabi-v7a)
Keyboard: x Hardware keyboard present
Skin: Skin with dynamic hardware controls
Front Camera: None
Back Camera: None
Memory RAM: 2048
VM Heap: 128
Internal Storage: 200
SD Card: 4GiB (probably more than necessary)
Emulation Options: x Use Host GPU

Testing the app

Debugging

With Lantern Android running, to filter Logcat messages:

make logcat

Simulating tun2socks and lantern outside Android

This is very useful when you can to check each moving part separately.

Within Android, the VpnService creates a TUN device and configures the network to route all traffic to this virtual device, an app is listening on this device and has the ability to inspect, modify and reinject packets back to the device. Some special packets can ignore the tun device and pass to the Internet directly (protected packages).

We are going to use a Linux virtual machine to simulate the device <-> tun <-> tun2sock <-> lantern <-> Internet dance, on a normal Linux we don't have the VpnService API but we have the ability to create tun devices and route traffic at will.

The main idea is to create a tun device, run a vanilla tun2socks and route all outgoing traffic to this device, everything but DNS server requests and a special route that goes directly to the virtual machine's host, which will be running a Lantern-SOCKs server.

Let's create and configure this virtual machine:

cd /path/to/lantern-mobile
vagrant up

While you're waiting for the vm to build up go back to the local machine (the vm's host) and compile the socks-server:

cd ~/go/src/github.com/getlantern/lantern
source setenv.bash
go build github.com/getlantern/lantern-mobile/lantern/socks-server

Run the server you've just compiled:

./socks-server
# ...
# DEBUG lantern-android.interceptor: interceptor.go:90 SOCKS proxy now listening on port: 8788
# 2015/09/15 08:47:40 Go and play for 10 minutes.

Run a simple test with cURL and watch the sock-server output.

curl --socks5 127.0.0.1:8788 https://www.google.com/humans.txt
# Google is built by a large team of engineers, designers, researchers, robots, and others in many different sites across the globe. It is updated continuously, and built with more tools and technologies than we can shake a stick at. If you'd like to help us out, see google.com/careers.

The SOCKs server will run for 10 minutes and then it will exit, you can also stop it anytime with ^C.

You can also cross-compile the tests we're going to run within the vm:

cd ~/go/src/github.com/getlantern/lantern
make mobile-test-linux-amd64
# ...
# ok      github.com/getlantern/lantern-mobile/lantern    0.082s

Once the build has finished log in into the new box:

vagrant ssh

And run the script that is going to setup

chmod +x /vagrant/vagrant-tun-up.sh
/vagrant/vagrant-tun-up.sh

The script will ask you for a HOST_IP, this is the IP of the host machine which in my case is 10.0.0.101:

HOST_IP=10.0.0.101 /vagrant/vagrant-tun-up.sh
# NOTICE(tun2socks): initializing BadVPN tun2socks 1.999.130
# NOTICE(tun2socks): entering event loop

Go back to your host and restart the socks-server.

./socks-server
# ^C
./socks-server
# ...

Open another terminal without stopping the tun2socks process and we'll be ready to test everything.

vagrant ssh
curl https://www.google.com/humans.txt
# Google is built by a large team of engineers, designers, researchers, robots, and others in many different sites across the globe. It is updated continuously, and built with more tools and technologies than we can shake a stick at. If you'd like to help us out, see google.com/careers.

Make sure the request is catched by tun2socks and by the socks-server by watching each program's output.

Finally, run the transparent test, which will basically do the same as a normal cURL through tun2socks and the socks-server:

/vagrant/lantern/lantern_mobile_test -test.v -test.run TestTransparentRequestPassingThroughTun0
# ...
# --- PASS: TestTransparentRequestPassingThroughTun0 (1.36s)
# PASS

More Repositories

1

download

Lantern官方版本下载 蓝灯 翻墙 代理 科学上网 外网 加速器 梯子 路由 proxy vpn circumvention gfw
16,599
star
2

lantern

Lantern官方版本下载 蓝灯 翻墙 代理 科学上网 外网 加速器 梯子 路由 - Быстрый, надежный и безопасный доступ к открытому интернету - lantern proxy vpn censorship-circumvention censorship gfw accelerator پراکسی لنترن، ضدسانسور، امن، قابل اعتماد و پرسرعت
Go
13,542
star
3

systray

a cross platfrom Go library to place an icon and menu in the notification area
Go
2,904
star
4

lantern-binaries-archive

Lantern installers binary downloads.
Shell
2,799
star
5

firetweet

FireTweet for Android powered by Lantern
Java
273
star
6

http-proxy-archived

HTTP Proxy with TLS support
Go
194
star
7

www.getlantern.org

Superseded by https://github.com/getlantern/www
JavaScript
112
star
8

zenodb

Time-based database
Go
107
star
9

natty

Standalone WebRTC-based NAT traversal
C++
95
star
10

lantern-proxied-sites-lists

Wiki for maintaining different proxied sites lists for Lantern
63
star
11

lantern-binaries

This are the latest installers for the Lantern censorship circumvention tool
59
star
12

enproxy

Chained HTTP proxy that supports arbitrary TCP traffic tunneled over HTTP proxies using encapsulated HTTP requests
Go
47
star
13

wal

Write-ahead log in Golang
Go
41
star
14

www

The old website of lantern
JavaScript
39
star
15

sysproxy

Go library for managing system proxy
Go
36
star
16

go-natty

Go language wrapper around the natty NAT-traversal utility
Go
36
star
17

byteexec

Go library for executing files stored as byte arrays, handy for use with go-bindata.
Go
36
star
18

lampshade

Obfuscated encrypted network protocol for Lantern
Go
34
star
19

sockssh

SOCKS5 proxy to create SSH tunnels on demand
Go
31
star
20

gost

gost is like a vendoring `go get` that uses Git subtrees
Go
31
star
21

winfirewall

Control the Windows Firewall from Go, supports Windows XP API and Advanced Security COM API
C++
30
star
22

idletiming

Go
27
star
23

sysproxy-cmd

Command-line tool for setting HTTP(S) system proxy
C
27
star
24

pac-cmd

command line tool to change proxy auto-config settings of operation system
C
27
star
25

lantern-ui

UI for Lantern
JavaScript
26
star
26

multipath

Bond multiple connections for throughput and reliability.
Go
25
star
27

tunio

tunio forwards TCP packets to a net.Dialer
C
23
star
28

fronted

Go library for doing domain fronting
Go
23
star
29

lantern-chrome-extension

Google Chrome extension for Lantern
JavaScript
22
star
30

tarfs

In-memory tar-based filesystem for go
Go
21
star
31

awesome-go-lantern

Cool libraries, frameworks, tips and tricks and anything that can be useful to share
21
star
32

kaleidoscope

Java library for implementing the kaleidoscope limited advertisement protocol
Java
20
star
33

winproxy

Executable for manipulating Windows system proxy settings. This uses wininet and allows the setting of PAC files instead of winhttp that tools like netsh uses and that are more limited. Works on Windows XP and above.
C++
20
star
34

proxy

Golang library for core proxying logic
Go
20
star
35

deepcopy

Deep copying for Go
Go
19
star
36

geneva

Port of Geneva to Go
Go
18
star
37

pac

A simple Go library to toggle on and off system pac for various OS
Go
18
star
38

ats

Lantern chained server implemented using Apache Traffic Server
C
18
star
39

lanterntemp

蓝灯Windows下载 https://raw.githubusercontent.com/getlantern/lantern-binaries/master/lantern-installer.exe 蓝灯安卓下载 https://raw.githubusercontent.com/getlantern/lantern-binaries/master/lantern-installer.apk
17
star
40

autoupdate

Provides interfaces for helping lantern tools update themselves.
Go
16
star
41

keyman

Easy golang RSA key management
Go
16
star
42

gotun

Go library for working with tun interfaces
Go
16
star
43

tlsproxy

A TLS proxy kind of like stunnel
Go
15
star
44

autoupdate-server

Go
15
star
45

notifier

A library for sending native desktop notifications from Go
Go
14
star
46

lantern-mobile-single-app-example

Minimal Android app to ease Flashlight mobile backend development and testing
Java
14
star
47

flashlight-build

Repeatable builds for Lantern, using docker.
Go
14
star
48

sitescanner

Tunnel scanner
Go
14
star
49

waddell

Go
14
star
50

go-geoserve

Geoip lookup server/library written in Go and using MaxMind GeoLite2 City
Go
12
star
51

lantern-roadmap

Roadmap for Lantern development
12
star
52

libnatpmp

Libnatpmp with Java support
C
12
star
53

protected

protected is used for creating "protected" connections that bypass Android's VPNService
Go
11
star
54

httpseverywhere

Go implementation of using HTTPS Everywhere rule sets to send traffic over HTTPS
Go
11
star
55

go-udtwrapper

Go (golang) wrapper for the UDT networking library
C++
10
star
56

osversion

Get OS version information from Go
Go
10
star
57

redistrict

CLI utility written in Go for migrating redis data
Go
9
star
58

gonat

Go library for NAT'ing of TCP and UDP traffic
Go
9
star
59

webrtc-java

Java wrapper around WebRTC
Java
9
star
60

measured

Wraps a dialer to measure the delay, throughput and errors of a connection
Go
9
star
61

nattywad

NAT traversal with go-natty and waddell
Go
9
star
62

elevate

package elevate provides support for executing commands with elevated privileges.
C
9
star
63

geneva-cli

Command-line interface to Geneva
Go
8
star
64

lantern-docs

Design and implementation docs for the Lantern projects
HTML
8
star
65

firetweet.io

CSS
7
star
66

urlcache

Go library that caches the contents of a web URL
Go
7
star
67

proxysetup

proxysetup is a command-line utility that allows managing Macintosh proxy settings via the networksetup program without having to sudo or supply one's password
C
7
star
68

WinProxy4J

Library using JNI and InternetSetOptions in WinInet.dll to set the system proxy on Windows.
C++
6
star
69

detour

Go
6
star
70

fdcount

Go utility for counting file descriptors
Go
6
star
71

getlantern.github.io

CSS
6
star
72

pubsub

Infrastructure for pubsub messaging
Go
6
star
73

netx

Handy extensions to the standard net package
Go
6
star
74

laeproxy

Lantern App Engine Proxy - free proxy anyone can deploy to App Engine for use with Lantern desktop clients
Python
6
star
75

go-reverseproxy

HTTP reverse proxy handler that's almost exactly the same as httputil.ReverseProxy but adds a DynamicFlushInterval
Go
6
star
76

framed

Basic golang support for framing small messages over streams like TCP
Go
6
star
77

kcpwrapper

Wrapper around kcp-go that allows the use of regular net interfaces like dialing and listening
Go
6
star
78

lantern-java

IDL
5
star
79

cmux

Golang connection multiplexing based on smux
Go
5
star
80

hidden

Hide text in text
Go
5
star
81

direct-ip-scanner

Direct IP Scanner
Go
5
star
82

balancer

Connection balancer library for Go
Go
5
star
83

ops

Track success or failure of operations in code
Go
5
star
84

cljs-react-victory

Victory graphs for ClojureScript
Clojure
5
star
85

mitm

Go library for man-in-the-middling pairs of connections
Go
5
star
86

bbrconn

Wrapper for Go's net.Conn that exposes BBR congestion control info
Go
5
star
87

pbe

Experimental go library for encrypting and decrypting messages using a password-derived secret keys and authenticated encryption
Go
4
star
88

withtimeout

go library for adding a timeout to any operation
Go
4
star
89

preconn

Go library for inserting data at the head of a connection
Go
4
star
90

serveme

Go library for client-server TCP communication in which the server dials the client
Go
4
star
91

packetforward

Packet forwarding on top of gotun
Go
4
star
92

waitforserver

Provides a Go function to wait for a server at given address.
Go
4
star
93

go-udtrelay

Go convenience API for the UDT Gateway System (github.com/getlantern/go-udtrelay/udtrelay)
Go
4
star
94

i18n

simple i18n utility
Go
4
star
95

bytecounting

go library for counting bytes read/written on net.Conn and net.Listener.
Go
4
star
96

Exceptional4j

Uses Exceptional to report Java exceptions
Java
4
star
97

ema

Exponential Moving Averages for Go
Go
4
star
98

lantern-forum-ru

Lantern forum for Russian users
4
star
99

httptest

Golang http testing mock similar to net/http/httptest.ResponseRecorder but with support for the Hijacker interface
Go
4
star
100

quicwrapper

Wrapper around quic-go for lantern
Go
3
star