Commit 2e0a6fc6 authored by Max Lv's avatar Max Lv

almost works

parent 9c1a28b1
classes
bin
gen
obj
target
local.properties
.classpath
.project
.settings
tests/bin
tests/gen
tests/local.properties
NUL
libs
#Intellij IDEA
*.iml
*.ipr
*.iws
.idea/
out/
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.shadowsocks"
android:installLocation="auto"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false"/>
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="17"/>
<application
android:name=".ShadowsocksApplication"
android:hardwareAccelerated="true"
android:icon="@drawable/icon"
android:label="@string/app_name">
<activity
android:name=".Shadowsocks"
android:label="@string/app_name"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".AppManager"
android:label="@string/app_name"/>
<service
android:name=".ShadowsocksService"
android:enabled="true"/>
<receiver android:name=".ShadowsocksReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
</application>
</manifest>
File added
File added
global {
perm_cache = 2048;
cache_dir = "/data/data/com.github.shadowsocks";
server_ip = 127.0.0.1;
server_port = 8053;
status_ctl = on;
paranoid = on;
query_method = tcp_only;
min_ttl = 15m;
max_ttl = 1w;
timeout = 10;
daemon = on;
pid_file = "/data/data/com.github.shadowsocks/pdnsd.pid";
}
server {
label = "root-servers";
root_server = on;
ip = 8.8.8.8
, 8.8.4.4
, 208.67.222.222
, 208.67.220.220
;
timeout = 5;
uptest = query;
interval = 30m; // Test every half hour.
ping_timeout = 300; // 30 seconds.
purge_cache = off;
exclude = .localdomain;
policy = included;
preset = off;
}
rr {
name=localhost;
reverse=on;
a=127.0.0.1;
owner=localhost;
soa=localhost,root.localhost,42,86400,900,86400,86400;
}
File added
...@@ -24,18 +24,15 @@ LOCAL_SRC_FILES := \ ...@@ -24,18 +24,15 @@ LOCAL_SRC_FILES := \
include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY)
#include $(CLEAR_VARS) include $(CLEAR_VARS)
#PDNSD_SOURCES := $(wildcard $(LOCAL_PATH)/pdnsd/*.c)
#LOCAL_MODULE := pdnsd
#LOCAL_SRC_FILES := $(PDNSD_SOURCES:$(LOCAL_PATH)%=%)
#LOCAL_CFLAGS := -O3 PDNSD_SOURCES := $(wildcard $(LOCAL_PATH)/pdnsd/*.c)
#LOCAL_STATIC_LIBRARIES := LOCAL_MODULE := pdnsd
LOCAL_SRC_FILES := $(PDNSD_SOURCES:$(LOCAL_PATH)%=%)
LOCAL_CFLAGS := -Wall -O2 -I$(LOCAL_PATH)/pdnsd
#include $(BUILD_STATIC_LIBRARY) include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS) include $(CLEAR_VARS)
...@@ -47,6 +44,17 @@ LOCAL_STATIC_LIBRARIES := libev libcrypto ...@@ -47,6 +44,17 @@ LOCAL_STATIC_LIBRARIES := libev libcrypto
LOCAL_LDLIBS := -llog LOCAL_LDLIBS := -llog
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE:= libexec
LOCAL_SRC_FILES:= \
termExec.cpp
LOCAL_LDLIBS := -ldl -llog
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)
subdirs := $(addprefix $(LOCAL_PATH)/openssl/,$(addsuffix /Android.mk, \ subdirs := $(addprefix $(LOCAL_PATH)/openssl/,$(addsuffix /Android.mk, \
......
...@@ -166,35 +166,6 @@ int read_config_file(const char *nm, globparm_t *global, servparm_array *servers ...@@ -166,35 +166,6 @@ int read_config_file(const char *nm, globparm_t *global, servparm_array *servers
*errstr=NULL; *errstr=NULL;
goto close_file; goto close_file;
} }
else if (sb.st_uid!=init_uid) {
/* Note by Paul Rombouts:
Perhaps we should use getpwuid_r() instead of getpwuid(), which is not necessarily thread safe.
As long as getpwuid() is only used by only one thread, it should be OK,
but it is something to keep in mind.
*/
struct passwd *pws;
char owner[24],user[24];
if((pws=getpwuid(sb.st_uid)))
strncp(owner,pws->pw_name,sizeof(owner));
else
sprintf(owner,"%i",sb.st_uid);
if((pws=getpwuid(init_uid)))
strncp(user,pws->pw_name,sizeof(user));
else
sprintf(user,"%i",init_uid);
if(asprintf(errstr,
"Error: %s file %s is owned by '%s', but pdnsd was started as user '%s'.",
conftype,nm,owner,user)<0)
*errstr=NULL;
goto close_file;
}
else if ((sb.st_mode&(S_IWGRP|S_IWOTH))) {
if(asprintf(errstr,
"Error: Bad %s file permissions: file %s must be only writeable by the user.",
conftype,nm)<0)
*errstr=NULL;
goto close_file;
}
} }
retval=confparse(in,NULL,global,servers,includedepth,errstr); retval=confparse(in,NULL,global,servers,includedepth,errstr);
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
* In normal operation, you will currently only need IPv4. */ * In normal operation, you will currently only need IPv4. */
#define ENABLE_IPV4 1 #define ENABLE_IPV4 1
#define DEFAULT_IPV4 1 #define DEFAULT_IPV4 1
/* #undef ENABLE_IPV6 */ #undef ENABLE_IPV6
/* In all pdnsd versions before 1.0.6, DNS queries were always done over /* In all pdnsd versions before 1.0.6, DNS queries were always done over
* TCP. Now, you have the choice. You can control that behaviour using * TCP. Now, you have the choice. You can control that behaviour using
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
* error or times out, the query is retried using UDP. * error or times out, the query is retried using UDP.
* UDP_TCP: UDP, then TCP. If the UDP reply is truncated (i.e. the tc flag is set), * UDP_TCP: UDP, then TCP. If the UDP reply is truncated (i.e. the tc flag is set),
* the query is retried using TCP. */ * the query is retried using TCP. */
#define M_PRESET UDP_ONLY #define M_PRESET TCP_ONLY
/* In addition to choosing the presets, you may also completely disable /* In addition to choosing the presets, you may also completely disable
* one of the protocols (TCP for preset UDP_ONLY and UDP for preset TCP_ONLY). * one of the protocols (TCP for preset UDP_ONLY and UDP for preset TCP_ONLY).
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
* default: native; others: gdbm */ * default: native; others: gdbm */
#define CACHE_DBM DBM_NATIVE #define CACHE_DBM DBM_NATIVE
#define CACHEDIR "/var/cache/pdnsd" #define CACHEDIR "/data/data/com.github.shadowsocks"
#define TEMPDIR "/tmp"; #define TEMPDIR "/tmp";
...@@ -214,10 +214,10 @@ ...@@ -214,10 +214,10 @@
#define HAVE_FCNTL_H 1 #define HAVE_FCNTL_H 1
/* Define to 1 if you have the `getline' function. */ /* Define to 1 if you have the `getline' function. */
#define HAVE_GETLINE 1 //#define HAVE_GETLINE 1
/* Define to 1 if you have the `getpwnam_r' function. */ /* Define to 1 if you have the `getpwnam_r' function. */
#define HAVE_GETPWNAM_R 1 //#define HAVE_GETPWNAM_R 1
/* Define to 1 if you have the `gettimeofday' function. */ /* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1 #define HAVE_GETTIMEOFDAY 1
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
#define HAVE_MEMORY_H 1 #define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mempcpy' function. */ /* Define to 1 if you have the `mempcpy' function. */
#define HAVE_MEMPCPY 1 //#define HAVE_MEMPCPY 1
/* Define to 1 if you have the `mkfifo' function. */ /* Define to 1 if you have the `mkfifo' function. */
#define HAVE_MKFIFO 1 #define HAVE_MKFIFO 1
...@@ -277,10 +277,10 @@ ...@@ -277,10 +277,10 @@
#define HAVE_STDLIB_H 1 #define HAVE_STDLIB_H 1
/* Define to 1 if you have the `stpcpy' function. */ /* Define to 1 if you have the `stpcpy' function. */
#define HAVE_STPCPY 1 //#define HAVE_STPCPY 1
/* Define to 1 if you have the `stpncpy' function. */ /* Define to 1 if you have the `stpncpy' function. */
#define HAVE_STPNCPY 1 //#define HAVE_STPNCPY 1
/* Define to 1 if you have the `strdup' function. */ /* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1 #define HAVE_STRDUP 1
......
...@@ -67,7 +67,7 @@ FILE *dbg_file=NULL; ...@@ -67,7 +67,7 @@ FILE *dbg_file=NULL;
volatile int tcp_socket=-1; volatile int tcp_socket=-1;
volatile int udp_socket=-1; volatile int udp_socket=-1;
sigset_t sigs_msk; sigset_t sigs_msk;
char *conf_file=CONFDIR"/pdnsd.conf"; char *conf_file="pdnsd.conf";
/* version and licensing information */ /* version and licensing information */
...@@ -140,7 +140,7 @@ static const char help_message[] = ...@@ -140,7 +140,7 @@ static const char help_message[] =
"\n" "\n"
"-c\t\t--or--\n" "-c\t\t--or--\n"
"--config-file\tspecifies the file the configuration is read from.\n" "--config-file\tspecifies the file the configuration is read from.\n"
"\t\tDefault is " CONFDIR "/pdnsd.conf\n" "\t\tDefault is " "pdnsd.conf\n"
#ifdef ENABLE_IPV4 #ifdef ENABLE_IPV4
"-4\t\tswitches to IPv4 mode.\n" "-4\t\tswitches to IPv4 mode.\n"
"\t\t" "\t\t"
......
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.shadowsocks</groupId>
<artifactId>shadowsocks</artifactId>
<version>1.0</version>
<packaging>apk</packaging>
<name>Shadowsocks</name>
<repositories>
<repository>
<id>madeye-maven-repository</id>
<url>http://madeye-maven-repository.googlecode.com/git</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android.analytics</groupId>
<artifactId>analytics</artifactId>
<version>V2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.5</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.4.1</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<archiveDirectory/>
<includes>
<include>${project.build.directory}/${project.artifactId}.apk</include>
</includes>
<keystore>${sign.keystore}</keystore>
<alias>${sign.alias}</alias>
<storepass>${sign.storepass}</storepass>
<keypass>${sign.keypass}</keypass>
<verbose>true</verbose>
<arguments>
<argument>-sigalg</argument><argument>MD5withRSA</argument>
<argument>-digestalg</argument><argument>SHA1</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<executions>
<execution>
<id>alignApk</id>
<phase>install</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
<extensions>true</extensions>
<configuration>
<release>true</release>
<sign>
<debug>false</debug>
</sign>
<zipalign>
<verbose>true</verbose>
<skip>false</skip>
<inputApk>${project.build.directory}/${project.artifactId}.apk</inputApk>
<outputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk
</outputApk>
</zipalign>
<sdk>
<platform>16</platform>
</sdk>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>debug-sign</id>
<activation>
<file>
<missing>${basedir}/local.properties</missing>
</file>
</activation>
<properties>
<sign.keystore>${basedir}/travis.keystore</sign.keystore>
<sign.alias>travis</sign.alias>
<sign.keypass>travis</sign.keypass>
<sign.storepass>travis</sign.storepass>
</properties>
</profile>
<profile>
<id>release-sign</id>
<activation>
<file>
<exists>${basedir}/local.properties</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/local.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>travis</id>
<activation>
<property>
<name>TRAVIS</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>deploy-to-sae</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>${basedir}/deploy</executable>
<arguments>
<argument>${project.build.directory}</argument>
<argument>${project.artifactId}-${project.version}.apk</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:gravity="center">
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:id="@+id/serviceToggle"
android:src="@drawable/off" android:layout_gravity="center"></ImageView>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:duplicateParentState="false">
<TextView android:text="@string/proxyed_help"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:textSize="16sp" android:padding="3px" />
<ListView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/applistview"></ListView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
<ImageView android:id="@+id/itemicon" android:layout_width="48sp"
android:layout_height="48sp" android:scaleType="fitCenter"
android:padding="3dip"></ImageView>
<TextView android:layout_height="wrap_content" android:id="@+id/itemtext"
android:text="uid:packages" android:maxLength="25" android:textSize="18sp" android:padding="3dip"></TextView>
<CheckBox android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/itemcheck"></CheckBox>
</TableRow>
</TableLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:id="@+id/image" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:src="@drawable/icon" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:id="@+id/down_tv" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:textSize="14sp"
android:paddingBottom="4dp" android:text="@string/downloading" />
<ProgressBar android:id="@+id/pb" android:layout_width="200dp"
android:layout_height="wrap_content" style="?android:attr/progressBarStyleHorizontal" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/v.sched.quite"
android:id="@+id/mainLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false"
android:scrollbarAlwaysDrawVerticalTrack="true" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="80dp" android:maxWidth="80dp" android:gravity="center"
android:textSize="70sp" android:textColor="#ffffffff"
android:background="#99000088" android:padding="10dp"
android:visibility="invisible" />
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<!--Replace placeholder ID with your tracking ID-->
<string name="ga_trackingId">UA-33136904-1</string>
<!--Enable Activity tracking-->
<bool name="ga_autoActivityTracking">true</bool>
<!--Enable automatic exception tracking-->
<bool name="ga_reportUncaughtExceptions">true</bool>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
Zirco Browser for Android
Copyright (C) 2010 J. Devauchelle and contributors.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-->
<resources>
<color name="title_background">#ff5e5e5e</color>
<color name="dialog_title_background">#17170443</color>
<color name="black">#000000</color>
<color name="grey1">#646464</color>
<color name="grey2">#c8c8c8</color>
<color name="grey3">#323232</color>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="service_running">Running in the background.</string>
<string name="app_name">Shadowsocks</string>
<string name="forward_success">Service started.</string>
<string name="forward_fail">Service failed to start.</string>
<string name="service_stopped">Shadowsocks service stopped.</string>
<string name="auto_reconnected">Auto Reconnected</string>
<string name="reconnect_success">Reconnected successfully.</string>
<string name="already_stopped">Service has been stopped already.</string>
<string name="already_running">Service has been started already.</string>
<string name="forward_stop">Proxy Service Stopped</string>
<string name="service_failed">Please check your network and login information</string>
<string name="reconnect_fail">Cannot reconnect</string>
<string name="ok_iknow">OK, I know</string>
<string name="proxy">Address</string>
<string name="port">Local Port</string>
<string name="sitekey">Site Key</string>
<string name="auto_connect">Auto Connect</string>
<string name="auto_reconnect">Auto reconnect</string>
<string name="auto_set_proxy">Global Proxy</string>
<string name="disconnect">Disconnect</string>
<string name="connect">Connect</string>
<string name="feedback">Feedback @ofmax</string>
<string name="proxy_cat">Shadowsocks Settings</string>
<string name="fearute_cat">Feature Settings</string>
<string name="service_controller">Proxy Switch</string>
<string name="function_cat">Service Controller</string>
<string name="service_summary">Enable / Disable Proxy</string>
<string name="proxy_summary">Shadowsocks URL</string>
<string name="port_summary">Listening port</string>
<string name="sitekey_summary">Site key for GoAgent</string>
<string name="port_alert">The port number should be greater than 1024</string>
<string name="auto_connect_summary">Start Shadowsocks at the startup</string>
<string name="auto_set_proxy_summary">Set up the global proxy (needs ROOT permission and
IPTABLES support)
</string>
<string name="port_empty">Port should not be empty</string>
<string name="proxy_empty">Proxy should not be empty</string>
<string name="install_cat">Package configure</string>
<string name="isInstalled">Install / Uninstall</string>
<string name="download">Downloading</string>
<string name="downloading">Downloading, Patient Please...</string>
<string name="isInstalled_summary">Install / Uninstall extra packages (need SD card)</string>
<string name="install_alert">Please install dependent module first! (Scroll to
the bottom, and select to install)
</string>
<string name="sdcard_alert">Please make sure you have a SD CARD!</string>
<string name="recovery">Reset</string>
<string name="unzip">Unzipping...</string>
<string name="proxyed_apps">Individual Proxy</string>
<string name="proxyed_apps_summary">Set individual proxy for apps (needs ROOT permission and IPTABLES support)
</string>
<string name="bypass_apps">Bypass Mode</string>
<string name="bypass_apps_summary">Enable this option to bypass selected apps</string>
<string name="proxyed_help">Select apps to use with Shadowsocks:</string>
<string name="crash_alert">An unexpected exit detected, context has been
recovered
</string>
<string name="copy_rights">Shadowsocks is an open source project
published under
the GPLv3. \n\nIf you have any questions, please visit
our project page on
googlecode. \n\n(gaeproxy.googlecode.com)
</string>
<string name="about">About</string>
<string name="proxy_type">Proxy Type</string>
<array name="proxy_type_entry">
<item>GAE</item>
<item>PaaS</item>
</array>
<string-array name="gfw_list">
<item>209.0.0.0/8</item>
<item>72.0.0.0/8</item>
<item>74.0.0.0/8</item>
<item>68.0.0.0/8</item>
<item>69.0.0.0/8</item>
<item>66.0.0.0/8</item>
<item>64.0.0.0/8</item>
<item>199.0.0.0/8</item>
<item>168.0.0.0/8</item>
<item>67.0.0.0/8</item>
<item>173.0.0.0/8</item>
<item>202.248.0.0/16</item>
</string-array>
<string-array name="chn_list">
<item>1.0.0.0/8</item>
<item>14.0.0.0/8</item>
<item>27.0.0.0/8</item>
<item>36.0.0.0/8</item>
<item>39.0.0.0/8</item>
<item>42.0.0.0/8</item>
<item>49.0.0.0/8</item>
<item>58.0.0.0/7</item>
<item>60.0.0.0/7</item>
<item>96.0.0.0/3</item>
<item>128.0.0.0/4</item>
<item>171.0.0.0/8</item>
<item>175.0.0.0/8</item>
<item>180.0.0.0/8</item>
<item>182.0.0.0/8</item>
<item>183.0.0.0/8</item>
<item>202.0.0.0/8</item>
<item>203.0.0.0/8</item>
<item>210.0.0.0/8</item>
<item>211.0.0.0/8</item>
<item>216.0.0.0/5</item>
<item>192.168.0.0/16</item>
<item>10.0.0.0/8</item>
<item>172.16.0.0/12</item>
</string-array>
<string name="mirror_list">
d3dxZ3R4eHByb3h5LTF8d3dxZ3R4eHByb3h5LTJ8d3dxZ3R4eHByb3h5LTN8d3dxZ3R4eHByb3h5LTR8d3dxZ3R4eHByb3h5LTV8d3dxZ3R4eHByb3h5LTZ8d3dxZ3R4eHByb3h5LTd8d3dxZ3R4eHByb3h5LTh8d3dxZ3R4eHByb3h5LTl8d3dxZ3R4eHByb3h5LTEwfHd3cWd0eHhwcm94eTEtMXx3d3FndHh4cHJveHkxLTJ8d3dxZ3R4eHByb3h5MS0zfHd3cWd0eHhwcm94eTEtNHx3d3FndHh4cHJveHkxLTV8d3dxZ3R4eHByb3h5MS02fHd3cWd0eHhwcm94eTEtN3x3d3FndHh4cHJveHkxLTh8d3dxZ3R4eHByb3h5MS05fHd3cWd0eHhwcm94eTEtMTB8d3dxZ3R4eHByb3h5Mi0xfHd3cWd0eHhwcm94eTItMnx3d3FndHh4cHJveHkyLTN8d3dxZ3R4eHByb3h5Mi00fHd3cWd0eHhwcm94eTItNXx3d3FndHh4cHJveHkyLTZ8d3dxZ3R4eHByb3h5Mi03fHd3cWd0eHhwcm94eTItOHx3d3FndHh4cHJveHkyLTl8d3dxZ3R4eHByb3h5Mi0xMA==
</string>
<string name="mirror_path">2</string>
<string name="mirror_sitekey">wwqgtxx-goagent</string>
<string name="connecting">Connecting…</string>
<string name="initializing">Initializing…</string>
<string name="recovering">Reseting…</string>
<string name="https_alert">Please modify your proxy host to start with
"https://"
</string>
<string name="https_proxy">HTTPS Proxy</string>
<string name="https_proxy_summary">Proxy HTTPS through GAE, not compatible with most
apps
</string>
<!-- settings notification category -->
<string name="notif_cat">Notification Settings</string>
<string name="notif_ringtone_title">Ringtone</string>
<string name="notif_ringtone_summary">Select the notification\'s ringtone</string>
<string name="notif_vibrate_title">Vibrate</string>
<string name="notif_vibrate_summary">Also vibrate when connection status changes</string>
<string name="loading">Loading app list…</string>
<string name="enable_market">Market Proxy</string>
<string name="enable_market_summary">Only for users in China, help to update app from
Android Market (need reboot)
</string>
<string name="auto_set_gfwlist">CHN Route</string>
<string name="auto_set_gfwlist_summary">Bypass all sites located in China (needs ROOT
permission and
IPTABLES support)
</string>
<string name="toast_start">Connecting to Shadowsocks</string>
<string name="toast_restart">Reconnecting to Shadowsocks</string>
<string name="browser">GAE Browser</string>
<string name="browser_summary">Start a browser through GAE proxy, for users
without root permission or iptables support
</string>
<string name="default_proxy_alert">You are using the default proxy, which has a quota
of only 10G bandwidth every day. Please deploy your own
servers to get
more free bandwidth quota with Google App Engine.\n\nYou can find more
information here: https://github.com/phus/goagent
</string>
<string name="warning">Warning</string>
<string name="system_proxy">System Proxy</string>
<string name="system_proxy_summary">Enable system wide proxy automatically without ROOT permission,
only works for Wifi on Android 4.0 and above.</string>
<string name="remote_port">Remote Port</string>
<string name="remote_port_summary">Server port of shadowsocks</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<!--
Zirco Browser for Android
Copyright (C) 2010 - 2011 J. Devauchelle and contributors.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-->
<resources>
<!-- Base application theme is the default theme -->
<style name="Theme" parent="android:Theme" />
<!-- Variation on the Light theme that turns off the title -->
<style name="Theme.GAEProxy" parent="@android:style/Theme">
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="Bookmarks"></style>
<style name="Bookmarks.Title">
<item name="android:textSize">16sp</item>
<item name="android:textColor">@android:color/white</item>
</style>
<style name="History"></style>
<style name="History.Title">
<item name="android:textSize">16sp</item>
<item name="android:textColor">@android:color/white</item>
</style>
<style name="History.Url">
<item name="android:textSize">12sp</item>
<item name="android:textColor">#888888</item>
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/function_cat">
<CheckBoxPreference
android:key="isRunning"
android:summary="@string/service_summary"
android:title="@string/service_controller">
</CheckBoxPreference>
</PreferenceCategory>
<PreferenceCategory android:title="@string/proxy_cat">
<EditTextPreference
android:defaultValue="127.0.0.1"
android:key="proxy"
android:summary="@string/proxy_summary"
android:title="@string/proxy">
</EditTextPreference>
<EditTextPreference
android:defaultValue="1984"
android:key="remotePort"
android:summary="@string/remote_port_summary"
android:title="@string/remote_port">
</EditTextPreference>
<EditTextPreference
android:defaultValue="1080"
android:key="port"
android:summary="@string/port_summary"
android:title="@string/port">
</EditTextPreference>
<EditTextPreference
android:defaultValue=""
android:key="sitekey"
android:summary="@string/sitekey_summary"
android:title="@string/sitekey">
</EditTextPreference>
</PreferenceCategory>
<PreferenceCategory android:title="@string/fearute_cat">
<CheckBoxPreference
android:key="isAutoConnect"
android:summary="@string/auto_connect_summary"
android:title="@string/auto_connect">
</CheckBoxPreference>
<CheckBoxPreference
android:defaultValue="true"
android:key="isGFWList"
android:summary="@string/auto_set_gfwlist_summary"
android:title="@string/auto_set_gfwlist">
</CheckBoxPreference>
<CheckBoxPreference
android:defaultValue="true"
android:key="isGlobalProxy"
android:summary="@string/auto_set_proxy_summary"
android:title="@string/auto_set_proxy">
</CheckBoxPreference>
<CheckBoxPreference
android:defaultValue="false"
android:key="isBypassApps"
android:summary="@string/bypass_apps_summary"
android:title="@string/bypass_apps">
</CheckBoxPreference>
<Preference
android:key="proxyedApps"
android:summary="@string/proxyed_apps_summary"
android:title="@string/proxyed_apps">
</Preference>
</PreferenceCategory>
</PreferenceScreen>
This diff is collapsed.
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.shadowsocks;
import java.io.FileDescriptor;
/**
* Utility methods for creating and managing a subprocess.
* <p/>
* Note: The native methods access a package-private java.io.FileDescriptor
* field to get and set the raw Linux file descriptor. This might break if the
* implementation of java.io.FileDescriptor is changed.
*/
public class Exec {
static {
System.loadLibrary("exec");
}
/**
* Close a given file descriptor.
*/
public static native void close(FileDescriptor fd);
/**
* Create a subprocess. Differs from java.lang.ProcessBuilder in that a pty
* is used to communicate with the subprocess.
* <p/>
* Callers are responsible for calling Exec.close() on the returned file
* descriptor.
*
* @param cmd The command to execute
* @param args An array of arguments to the command
* @param envVars An array of strings of the form "VAR=value" to be added to the
* environment of the process
* @param processId A one-element array to which the process ID of the started
* process will be written.
* @return the file descriptor of the started process.
*/
public static native FileDescriptor createSubprocess(String cmd,
String[] args, String[] envVars, int[] processId);
/**
* Send SIGHUP to a process group.
*/
public static native void hangupProcessGroup(int processId);
/**
* Causes the calling thread to wait for the process associated with the
* receiver to finish executing.
*
* @return The exit value of the Process being waited on
*/
public static native int waitFor(int processId);
}
package com.github.shadowsocks;
import android.R;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.widget.ImageView;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Stack;
public class ImageLoader {
// Used to display bitmap in the UI thread
class BitmapDisplayer implements Runnable {
Bitmap bitmap;
ImageView imageView;
public BitmapDisplayer(Bitmap b, ImageView i) {
bitmap = b;
imageView = i;
}
@Override
public void run() {
if (bitmap != null)
imageView.setImageBitmap(bitmap);
else
imageView.setImageResource(stub_id);
}
}
class PhotosLoader extends Thread {
@Override
public void run() {
try {
while (true) {
// thread waits until there are any images to load in the
// queue
if (photosQueue.photosToLoad.size() == 0)
synchronized (photosQueue.photosToLoad) {
photosQueue.photosToLoad.wait();
}
if (photosQueue.photosToLoad.size() != 0) {
PhotoToLoad photoToLoad;
synchronized (photosQueue.photosToLoad) {
photoToLoad = photosQueue.photosToLoad.pop();
}
Bitmap bmp = getBitmap(photoToLoad.uid);
cache.put(photoToLoad.uid, bmp);
Object tag = photoToLoad.imageView.getTag();
if (tag != null && ((Integer) tag) == photoToLoad.uid) {
BitmapDisplayer bd = new BitmapDisplayer(bmp,
photoToLoad.imageView);
Activity a = (Activity) photoToLoad.imageView
.getContext();
a.runOnUiThread(bd);
}
}
if (Thread.interrupted())
break;
}
} catch (InterruptedException e) {
// allow thread to exit
}
}
}
// stores list of photos to download
class PhotosQueue {
private final Stack<PhotoToLoad> photosToLoad = new Stack<PhotoToLoad>();
// removes all instances of this ImageView
public void Clean(ImageView image) {
synchronized (photosToLoad) {
for (int j = 0; j < photosToLoad.size(); ) {
if (photosToLoad.get(j).imageView == image) photosToLoad.remove(j);
else ++j;
}
}
}
}
// Task for the queue
private class PhotoToLoad {
public int uid;
public ImageView imageView;
public PhotoToLoad(int u, ImageView i) {
uid = u;
imageView = i;
}
}
// the simplest in-memory cache implementation. This should be replaced with
// something like SoftReference or BitmapOptions.inPurgeable(since 1.6)
private HashMap<Integer, Bitmap> cache = new HashMap<Integer, Bitmap>();
private File cacheDir;
private Context context;
final int stub_id = R.drawable.sym_def_app_icon;
PhotosQueue photosQueue = new PhotosQueue();
PhotosLoader photoLoaderThread = new PhotosLoader();
public ImageLoader(Context c) {
// Make the background thead low priority. This way it will not affect
// the UI performance
photoLoaderThread.setPriority(Thread.NORM_PRIORITY - 1);
context = c;
// Find the dir to save cached images
cacheDir = context.getCacheDir();
}
public void clearCache() {
// clear memory cache
cache.clear();
// clear SD cache
File[] files = cacheDir.listFiles();
for (File f : files)
f.delete();
}
// decodes image and scales it to reduce memory consumption
private Bitmap decodeFile(File f) {
try {
// decode image size
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeStream(new FileInputStream(f), null, o);
// Find the correct scale value. It should be the power of 2.
final int REQUIRED_SIZE = 70;
int width_tmp = o.outWidth, height_tmp = o.outHeight;
int scale = 1;
while (true) {
if (width_tmp / 2 < REQUIRED_SIZE
|| height_tmp / 2 < REQUIRED_SIZE)
break;
width_tmp /= 2;
height_tmp /= 2;
scale *= 2;
}
// decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
return BitmapFactory.decodeStream(new FileInputStream(f), null, o2);
} catch (FileNotFoundException e) {
}
return null;
}
public void DisplayImage(int uid, Activity activity, ImageView imageView) {
if (cache.containsKey(uid))
imageView.setImageBitmap(cache.get(uid));
else {
queuePhoto(uid, activity, imageView);
imageView.setImageResource(stub_id);
}
}
private Bitmap getBitmap(int uid) {
// I identify images by hashcode. Not a perfect solution, good for the
// demo.
String filename = String.valueOf(uid);
File f = new File(cacheDir, filename);
// from SD cache
Bitmap b = decodeFile(f);
if (b != null)
return b;
// from web
try {
BitmapDrawable icon = (BitmapDrawable) Utils.getAppIcon(context,
uid);
return icon.getBitmap();
} catch (Exception ex) {
return null;
}
}
private void queuePhoto(int uid, Activity activity, ImageView imageView) {
// This ImageView may be used for other images before. So there may be
// some old tasks in the queue. We need to discard them.
photosQueue.Clean(imageView);
PhotoToLoad p = new PhotoToLoad(uid, imageView);
synchronized (photosQueue.photosToLoad) {
photosQueue.photosToLoad.push(p);
photosQueue.photosToLoad.notifyAll();
}
// start thread if it's not started yet
if (photoLoaderThread.getState() == Thread.State.NEW)
photoLoaderThread.start();
}
public void stopThread() {
photoLoaderThread.interrupt();
}
}
// dbartists - Douban artists client for Android
// Copyright (C) 2011 Max Lv <max.c.lv@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
//
//
// ___====-_ _-====___
// _--^^^#####// \\#####^^^--_
// _-^##########// ( ) \\##########^-_
// -############// |\^^/| \\############-
// _/############// (@::@) \\############\_
// /#############(( \\// ))#############\
// -###############\\ (oo) //###############-
// -#################\\ / VV \ //#################-
// -###################\\/ \//###################-
// _#/|##########/\######( /\ )######/\##########|\#_
// |/ |#/\#/\#/\/ \#/\##\ | | /##/\#/ \/\#/\#/\#| \|
// ` |/ V V ` V \#\| | | |/#/ V ' V V \| '
// ` ` ` ` / | | | | \ ' ' ' '
// ( | | | | )
// __\ | | | | /__
// (vvv(VVV)(VVV)vvv)
//
// HERE BE DRAGONS
package com.github.shadowsocks;
import android.content.Context;
public class ImageLoaderFactory {
private static ImageLoader il = null;
public static ImageLoader getImageLoader(Context context) {
if (il == null) {
il = new ImageLoader(context);
}
return il;
}
}
package com.github.shadowsocks;
public class ProxyedApp {
private boolean enabled;
private int uid;
private String username;
private String procname;
private String name;
private boolean proxyed = false;
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @return the procname
*/
public String getProcname() {
return procname;
}
/**
* @return the uid
*/
public int getUid() {
return uid;
}
/**
* @return the username
*/
public String getUsername() {
return username;
}
/**
* @return the enabled
*/
public boolean isEnabled() {
return enabled;
}
/**
* @return the proxyed
*/
public boolean isProxyed() {
return proxyed;
}
/**
* @param enabled the enabled to set
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @param procname the procname to set
*/
public void setProcname(String procname) {
this.procname = procname;
}
/**
* @param proxyed the proxyed to set
*/
public void setProxyed(boolean proxyed) {
this.proxyed = proxyed;
}
/**
* @param uid the uid to set
*/
public void setUid(int uid) {
this.uid = uid;
}
/**
* @param username the username to set
*/
public void setUsername(String username) {
this.username = username;
}
}
\ No newline at end of file
This diff is collapsed.
package com.github.shadowsocks;
import android.app.Application;
import com.google.analytics.tracking.android.EasyTracker;
public class ShadowsocksApplication extends Application {
@Override
public void onCreate() {
EasyTracker.getInstance().setContext(this);
}
}
This diff is collapsed.
This diff is collapsed.
File added
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment