@@ -45,5 +45,4 @@ public class System {
|
||||
|
||||
public static native void exec(String cmd);
|
||||
public static native String getABI();
|
||||
public static native String getDNS1();
|
||||
}
|
||||
|
||||
+1
-10
@@ -6,18 +6,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <cpu-features.h>
|
||||
#include <sys/system_properties.h>
|
||||
|
||||
#define LOGI(...) do { __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__); } while(0)
|
||||
#define LOGW(...) do { __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__); } while(0)
|
||||
#define LOGE(...) do { __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__); } while(0)
|
||||
|
||||
jstring Java_com_github_shadowsocks_system_getdns1(JNIEnv *env, jobject thiz) {
|
||||
char dns1[PROP_VALUE_MAX];
|
||||
__system_property_get("net.dns1", dns1);
|
||||
return env->NewStringUTF(dns1);
|
||||
}
|
||||
|
||||
jstring Java_com_github_shadowsocks_system_getabi(JNIEnv *env, jobject thiz) {
|
||||
AndroidCpuFamily family = android_getCpuFamily();
|
||||
uint64_t features = android_getCpuFeatures();
|
||||
@@ -52,9 +45,7 @@ static JNINativeMethod method_table[] = {
|
||||
{ "exec", "(Ljava/lang/String;)V",
|
||||
(void*) Java_com_github_shadowsocks_system_exec },
|
||||
{ "getABI", "()Ljava/lang/String;",
|
||||
(void*) Java_com_github_shadowsocks_system_getabi },
|
||||
{ "getDNS1", "()Ljava/lang/String;",
|
||||
(void*) Java_com_github_shadowsocks_system_getdns1 }
|
||||
(void*) Java_com_github_shadowsocks_system_getabi }
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -118,7 +118,7 @@ class ShadowsocksNatService extends Service with BaseService {
|
||||
Path.BASE + "ss-local.pid")
|
||||
.format(config.proxy, config.remotePort, 8153, config.sitekey, config.encMethod)
|
||||
} else {
|
||||
val conf = ConfigUtils.PDNSD.format("127.0.0.1", getString(R.string.exclude), System.getDNS1);
|
||||
val conf = ConfigUtils.PDNSD.format("127.0.0.1", getString(R.string.exclude));
|
||||
ConfigUtils.printToFile(new File(Path.BASE + "pdnsd.conf"))(p => {
|
||||
p.println(conf)
|
||||
})
|
||||
|
||||
@@ -91,7 +91,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
Path.BASE + "ss-tunnel.pid")
|
||||
.format(config.proxy, config.remotePort, 8153, config.sitekey, config.encMethod)
|
||||
} else {
|
||||
val conf = ConfigUtils.PDNSD.format("0.0.0.0", getString(R.string.exclude), System.getDNS1)
|
||||
val conf = ConfigUtils.PDNSD.format("0.0.0.0", getString(R.string.exclude))
|
||||
ConfigUtils.printToFile(new File(Path.BASE + "pdnsd.conf"))(p => {
|
||||
p.println(conf)
|
||||
})
|
||||
|
||||
@@ -86,7 +86,7 @@ object ConfigUtils {
|
||||
|
|
||||
|server {
|
||||
| label = "china-servers";
|
||||
| ip = %s, 114.114.114.114, 114.114.115.115;
|
||||
| ip = 114.114.114.114, 114.114.115.115;
|
||||
| timeout = 5;
|
||||
|}
|
||||
|
|
||||
|
||||
Reference in New Issue
Block a user