Commit 6a0f26a0 authored by chenhuaqing's avatar chenhuaqing

remove unused code

parent ca111ace
...@@ -55,19 +55,19 @@ ...@@ -55,19 +55,19 @@
</intent-filter> </intent-filter>
</service> </service>
<service <!-- <service-->
android:name="com.github.shadowsocks.bg.TransproxyService" <!-- android:name="com.github.shadowsocks.bg.TransproxyService"-->
android:process=":bg" <!-- android:process=":bg"-->
android:directBootAware="true" <!-- android:directBootAware="true"-->
android:exported="false"> <!-- android:exported="false">-->
</service> <!-- </service>-->
<service <!-- <service-->
android:name="com.github.shadowsocks.bg.ProxyService" <!-- android:name="com.github.shadowsocks.bg.ProxyService"-->
android:process=":bg" <!-- android:process=":bg"-->
android:directBootAware="true" <!-- android:directBootAware="true"-->
android:exported="false"> <!-- android:exported="false">-->
</service> <!-- </service>-->
<service <service
android:name="com.github.shadowsocks.subscription.SubscriptionService" android:name="com.github.shadowsocks.subscription.SubscriptionService"
......
...@@ -27,12 +27,8 @@ import android.content.ServiceConnection ...@@ -27,12 +27,8 @@ import android.content.ServiceConnection
import android.os.IBinder import android.os.IBinder
import android.os.RemoteException import android.os.RemoteException
import com.github.shadowsocks.bg.BaseService import com.github.shadowsocks.bg.BaseService
import com.github.shadowsocks.bg.ProxyService
import com.github.shadowsocks.bg.TransproxyService
import com.github.shadowsocks.bg.VpnService import com.github.shadowsocks.bg.VpnService
import com.github.shadowsocks.preference.DataStore
import com.github.shadowsocks.utils.Action import com.github.shadowsocks.utils.Action
import com.github.shadowsocks.utils.Key
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
...@@ -42,12 +38,13 @@ import kotlinx.coroutines.launch ...@@ -42,12 +38,13 @@ import kotlinx.coroutines.launch
*/ */
class ShadowsocksConnection(private var listenForDeath: Boolean = false) : ServiceConnection, IBinder.DeathRecipient { class ShadowsocksConnection(private var listenForDeath: Boolean = false) : ServiceConnection, IBinder.DeathRecipient {
companion object { companion object {
val serviceClass get() = when (DataStore.serviceMode) { val serviceClass get() = VpnService::class.java
Key.modeProxy -> ProxyService::class // when (DataStore.serviceMode) {
Key.modeVpn -> VpnService::class // Key.modeProxy -> ProxyService::class
Key.modeTransproxy -> TransproxyService::class // Key.modeVpn -> VpnService::class
else -> throw UnknownError() // Key.modeTransproxy -> TransproxyService::class
}.java // else -> throw UnknownError()
// }.java
} }
interface Callback { interface Callback {
......
...@@ -29,11 +29,11 @@ import java.io.File ...@@ -29,11 +29,11 @@ import java.io.File
import java.io.IOException import java.io.IOException
object Executable { object Executable {
const val REDSOCKS = "libredsocks.so" // const val REDSOCKS = "libredsocks.so"
const val SS_LOCAL = "libsslocal.so" const val SS_LOCAL = "libsslocal.so"
const val TUN2SOCKS = "libtun2socks.so" const val TUN2SOCKS = "libtun2socks.so"
private val EXECUTABLES = setOf(SS_LOCAL, REDSOCKS, TUN2SOCKS) private val EXECUTABLES = setOf(SS_LOCAL, TUN2SOCKS)
fun killAll() { fun killAll() {
for (process in File("/proc").listFiles { _, name -> TextUtils.isDigitsOnly(name) } ?: return) { for (process in File("/proc").listFiles { _, name -> TextUtils.isDigitsOnly(name) } ?: return) {
......
...@@ -37,23 +37,23 @@ class TransproxyService : Service(), BaseService.Interface { ...@@ -37,23 +37,23 @@ class TransproxyService : Service(), BaseService.Interface {
super<BaseService.Interface>.onStartCommand(intent, flags, startId) super<BaseService.Interface>.onStartCommand(intent, flags, startId)
private fun startRedsocksDaemon() { private fun startRedsocksDaemon() {
File(Core.deviceStorage.noBackupFilesDir, "redsocks.conf").writeText("""base { // File(Core.deviceStorage.noBackupFilesDir, "redsocks.conf").writeText("""base {
log_debug = off; // log_debug = off;
log_info = off; // log_info = off;
log = stderr; // log = stderr;
daemon = off; // daemon = off;
redirector = iptables; // redirector = iptables;
} //}
redsocks { //redsocks {
local_ip = ${DataStore.listenAddress}; // local_ip = ${DataStore.listenAddress};
local_port = ${DataStore.portTransproxy}; // local_port = ${DataStore.portTransproxy};
ip = 127.0.0.1; // ip = 127.0.0.1;
port = ${DataStore.portProxy}; // port = ${DataStore.portProxy};
type = socks5; // type = socks5;
} //}
""") //""")
data.processes!!.start(listOf( // data.processes!!.start(listOf(
File(applicationInfo.nativeLibraryDir, Executable.REDSOCKS).absolutePath, "-c", "redsocks.conf")) // File(applicationInfo.nativeLibraryDir, Executable.REDSOCKS).absolutePath, "-c", "redsocks.conf"))
} }
override suspend fun startProcesses() { override suspend fun startProcesses() {
......
...@@ -22,19 +22,19 @@ BUILD_SHARED_EXECUTABLE := $(LOCAL_PATH)/build-shared-executable.mk ...@@ -22,19 +22,19 @@ BUILD_SHARED_EXECUTABLE := $(LOCAL_PATH)/build-shared-executable.mk
## libevent ## libevent
######################################################## ########################################################
include $(CLEAR_VARS) # include $(CLEAR_VARS)
#
LIBEVENT_SOURCES := \ # LIBEVENT_SOURCES := \
buffer.c bufferevent.c event.c \ # buffer.c bufferevent.c event.c \
bufferevent_sock.c bufferevent_ratelim.c \ # bufferevent_sock.c bufferevent_ratelim.c \
evthread.c log.c evutil.c evutil_rand.c evutil_time.c evmap.c epoll.c poll.c signal.c select.c # evthread.c log.c evutil.c evutil_rand.c evutil_time.c evmap.c epoll.c poll.c signal.c select.c
#
LOCAL_MODULE := event # LOCAL_MODULE := event
LOCAL_SRC_FILES := $(addprefix libevent/, $(LIBEVENT_SOURCES)) # LOCAL_SRC_FILES := $(addprefix libevent/, $(LIBEVENT_SOURCES))
LOCAL_CFLAGS := -I$(LOCAL_PATH)/libevent \ # LOCAL_CFLAGS := -I$(LOCAL_PATH)/libevent \
-I$(LOCAL_PATH)/libevent/include \ # -I$(LOCAL_PATH)/libevent/include \
#
include $(BUILD_STATIC_LIBRARY) # include $(BUILD_STATIC_LIBRARY)
######################################################## ########################################################
## libancillary ## libancillary
...@@ -55,23 +55,23 @@ include $(BUILD_STATIC_LIBRARY) ...@@ -55,23 +55,23 @@ include $(BUILD_STATIC_LIBRARY)
## redsocks ## redsocks
######################################################## ########################################################
include $(CLEAR_VARS) # include $(CLEAR_VARS)
#
REDSOCKS_SOURCES := base.c http-connect.c \ # REDSOCKS_SOURCES := base.c http-connect.c \
log.c md5.c socks5.c \ # log.c md5.c socks5.c \
base64.c http-auth.c http-relay.c main.c \ # base64.c http-auth.c http-relay.c main.c \
parser.c redsocks.c socks4.c utils.c # parser.c redsocks.c socks4.c utils.c
#
LOCAL_STATIC_LIBRARIES := libevent # LOCAL_STATIC_LIBRARIES := libevent
#
LOCAL_MODULE := redsocks # LOCAL_MODULE := redsocks
LOCAL_SRC_FILES := $(addprefix redsocks/, $(REDSOCKS_SOURCES)) # LOCAL_SRC_FILES := $(addprefix redsocks/, $(REDSOCKS_SOURCES))
LOCAL_CFLAGS := -std=gnu99 -DUSE_IPTABLES \ # LOCAL_CFLAGS := -std=gnu99 -DUSE_IPTABLES \
-I$(LOCAL_PATH)/redsocks \ # -I$(LOCAL_PATH)/redsocks \
-I$(LOCAL_PATH)/libevent/include \ # -I$(LOCAL_PATH)/libevent/include \
-I$(LOCAL_PATH)/libevent # -I$(LOCAL_PATH)/libevent
#
include $(BUILD_SHARED_EXECUTABLE) # include $(BUILD_SHARED_EXECUTABLE)
######################################################## ########################################################
## tun2socks ## tun2socks
......
...@@ -137,12 +137,13 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Callback, OnPref ...@@ -137,12 +137,13 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Callback, OnPref
profile.token = "e38daf39db56471cb8bfe2776b24059c" profile.token = "e38daf39db56471cb8bfe2776b24059c"
profile.remotePort = 8390 profile.remotePort = 8390
profile.proxyApps = true profile.proxyApps = true
val proxyGames = mutableListOf( val proxyGames = mutableSetOf(
"com.sec.android.app.sbrowser", "com.sec.android.app.sbrowser",
"com.nexon.maplem.global", "com.nexon.maplem.global",
"jp.co.cygames.umamusume", "jp.co.cygames.umamusume",
"com.ea.gp.apexlegendsmobilefps", "com.ea.gp.apexlegendsmobilefps",
"jp.konami.duellinks", "com.riotgames.league.wildrift" "jp.konami.duellinks",
"com.riotgames.league.wildrift"
) )
proxyGames.addAll(profile.individual.split("\n")) proxyGames.addAll(profile.individual.split("\n"))
profile.individual = proxyGames.joinToString("\n") profile.individual = proxyGames.joinToString("\n")
......
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