Obsolete code cleanup
This commit is contained in:
@@ -45,13 +45,11 @@ import java.util.Locale
|
||||
|
||||
import android.content._
|
||||
import android.content.pm.PackageManager.NameNotFoundException
|
||||
import android.content.pm.{PackageInfo, PackageManager}
|
||||
import android.net.VpnService
|
||||
import android.os._
|
||||
import android.util.Log
|
||||
import com.github.shadowsocks.aidl.Config
|
||||
import com.github.shadowsocks.utils._
|
||||
import org.apache.commons.net.util.SubnetUtils
|
||||
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
|
||||
@@ -69,27 +67,6 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
var pdnsdProcess: Process = _
|
||||
var tun2socksProcess: Process = _
|
||||
|
||||
def isByass(net: SubnetUtils): Boolean = {
|
||||
val info = net.getInfo
|
||||
info.isInRange(config.proxy)
|
||||
}
|
||||
|
||||
def isPrivateA(a: Int): Boolean = {
|
||||
if (a == 10 || a == 192 || a == 172) {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
def isPrivateB(a: Int, b: Int): Boolean = {
|
||||
if (a == 10 || (a == 192 && b == 168) || (a == 172 && b >= 16 && b < 32)) {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
override def onBind(intent: Intent): IBinder = {
|
||||
val action = intent.getAction
|
||||
if (VpnService.SERVICE_INTERFACE == action) {
|
||||
@@ -135,18 +112,6 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
super.stopRunner(stopService)
|
||||
}
|
||||
|
||||
def getVersionName: String = {
|
||||
var version: String = null
|
||||
try {
|
||||
val pi: PackageInfo = getPackageManager.getPackageInfo(getPackageName, 0)
|
||||
version = pi.versionName
|
||||
} catch {
|
||||
case e: PackageManager.NameNotFoundException =>
|
||||
version = "Package name not found"
|
||||
}
|
||||
version
|
||||
}
|
||||
|
||||
def killProcesses() {
|
||||
if (sslocalProcess != null) {
|
||||
sslocalProcess.destroy()
|
||||
@@ -311,8 +276,8 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
val ipv6 = if (config.isIpv6) "" else "reject = ::/0;"
|
||||
val conf = {
|
||||
if (config.route == Route.BYPASS_CHN || config.route == Route.BYPASS_LAN_CHN) {
|
||||
val reject = ConfigUtils.getRejectList(getContext)
|
||||
val blackList = ConfigUtils.getBlackList(getContext)
|
||||
val reject = ConfigUtils.getRejectList(this)
|
||||
val blackList = ConfigUtils.getBlackList(this)
|
||||
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
|
||||
"0.0.0.0", 8153, reject, blackList, 8163, ipv6)
|
||||
} else {
|
||||
@@ -330,8 +295,6 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
pdnsdProcess = new GuardedProcess(cmd.split(" ").toSeq).start()
|
||||
}
|
||||
|
||||
override def getContext = getBaseContext
|
||||
|
||||
def startVpn(): Int = {
|
||||
|
||||
val builder = new Builder()
|
||||
@@ -435,8 +398,4 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
override def getTag = TAG
|
||||
|
||||
override def getServiceMode = Mode.VPN
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user