diff --git a/app/build.gradle b/app/build.gradle index 2bd417d..5832684 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,7 +9,7 @@ android { ndk { abiFilters 'arm64-v8a', 'x86_64' } - versionName "1.2.4.4" + versionName "1.2.7" } buildTypes { diff --git a/app/libs/arm64-v8a/libvnt_jni.so b/app/libs/arm64-v8a/libvnt_jni.so index 84040d3..23cfb4c 100644 Binary files a/app/libs/arm64-v8a/libvnt_jni.so and b/app/libs/arm64-v8a/libvnt_jni.so differ diff --git a/app/libs/x86_64/libvnt_jni.so b/app/libs/x86_64/libvnt_jni.so index 4894471..b6db16c 100644 Binary files a/app/libs/x86_64/libvnt_jni.so and b/app/libs/x86_64/libvnt_jni.so differ diff --git a/app/src/main/java/top/wherewego/vnt/AddActivity.java b/app/src/main/java/top/wherewego/vnt/AddActivity.java index 4b99d87..6658f18 100644 --- a/app/src/main/java/top/wherewego/vnt/AddActivity.java +++ b/app/src/main/java/top/wherewego/vnt/AddActivity.java @@ -29,6 +29,8 @@ public class AddActivity extends AppActivity { private Spinner mCipherModel; private Spinner mConnectType; private Spinner mFinger; + private Spinner mPriority; + private EditText mPort; @Override protected int getLayoutId() { @@ -68,6 +70,8 @@ public void onRightClick(TitleBar titleBar) { mCipherModel = findViewById(R.id.et_add_cipher_model_value); mConnectType = findViewById(R.id.et_add_connect_type_value); mFinger = findViewById(R.id.et_add_finger_value); + mPriority = findViewById(R.id.et_add_priority_value); + mPort = findViewById(R.id.et_add_port_value); } @Override @@ -106,7 +110,23 @@ private void save() { String cipherModel = mCipherModel.getSelectedItem().toString().trim(); String connectType = mConnectType.getSelectedItem().toString().trim(); String finger = mFinger.getSelectedItem().toString().trim(); + String priority = mPriority.getSelectedItem().toString().trim(); String inIps = mInIps.getText().toString().trim(); + String portStr = mPort.getText().toString().trim(); + int port = 0; + if (!portStr.isEmpty()) { + try { + port = Integer.parseInt(portStr); + if (port < 0 || port >= 65535) { + Toast.makeText(this, "port错误", Toast.LENGTH_SHORT).show(); + return; + } + } catch (Exception e) { + Toast.makeText(this, "port错误", Toast.LENGTH_SHORT).show(); + return; + } + } + if (inIps.isEmpty()) { inIps = null; } @@ -116,7 +136,8 @@ private void save() { } ConfigurationInfoBean configurationInfoBean = new ConfigurationInfoBean( token, name, deviceId, password, server, stun, - cipherModel, "TCP".equalsIgnoreCase(connectType), "OPEN".equalsIgnoreCase(finger), inIps, outIps + cipherModel, "TCP".equalsIgnoreCase(connectType), "OPEN".equalsIgnoreCase(finger), inIps, outIps, + "latency".equalsIgnoreCase(priority),port ); try { String err = check(configurationInfoBean); diff --git a/app/src/main/java/top/wherewego/vnt/MyVpnService.java b/app/src/main/java/top/wherewego/vnt/MyVpnService.java index 6a388ae..2997dee 100644 --- a/app/src/main/java/top/wherewego/vnt/MyVpnService.java +++ b/app/src/main/java/top/wherewego/vnt/MyVpnService.java @@ -82,8 +82,10 @@ public synchronized int onStartCommand(Intent intent, int flags, int startId) { boolean finger = selectConfigurationInfoBean.isFinger(); String inIps = selectConfigurationInfoBean.getInIps(); String outIps = selectConfigurationInfoBean.getOutIps(); + boolean firstLatency = selectConfigurationInfoBean.isFirstLatency(); + int port = selectConfigurationInfoBean.getPort(); config = new Config(token, name, deviceId, server, stunServer, password.isEmpty() ? null : password, - cipherModel, tcp, finger,inIps,outIps); + cipherModel, tcp, finger,inIps,outIps,firstLatency,port); if (mThread == null) { mThread = new Thread(this, "VntVPN"); mThread.start(); diff --git a/app/src/main/java/top/wherewego/vnt/jni/Config.java b/app/src/main/java/top/wherewego/vnt/jni/Config.java index 6699da7..1bdcf39 100644 --- a/app/src/main/java/top/wherewego/vnt/jni/Config.java +++ b/app/src/main/java/top/wherewego/vnt/jni/Config.java @@ -10,13 +10,15 @@ public class Config { private String cipherModel; private boolean tcp; private boolean finger; + private boolean firstLatency; + private int port; private String inIps; private String outIps; public Config(String token, String name, String deviceId, String server, String stunServer, String password, String cipherModel, boolean tcp,boolean finger, - String inIps,String outIps) { + String inIps,String outIps,boolean firstLatency,int port) { this.token = token; this.name = name; this.deviceId = deviceId; @@ -28,6 +30,8 @@ public Config(String token, String name, String deviceId, String server, this.finger = finger; this.inIps = inIps; this.outIps = outIps; + this.firstLatency = firstLatency; + this.port = port; } public String getToken() { @@ -117,4 +121,20 @@ public String getOutIps() { public void setOutIps(String outIps) { this.outIps = outIps; } + + public boolean isFirstLatency() { + return firstLatency; + } + + public void setFirstLatency(boolean firstLatency) { + this.firstLatency = firstLatency; + } + + public int getPort() { + return port; + } + + public void setPort(int port) { + this.port = port; + } } diff --git a/app/src/main/java/top/wherewego/vnt/jni/ConfigurationInfoBean.java b/app/src/main/java/top/wherewego/vnt/jni/ConfigurationInfoBean.java index ec1c3a2..b1af5ea 100644 --- a/app/src/main/java/top/wherewego/vnt/jni/ConfigurationInfoBean.java +++ b/app/src/main/java/top/wherewego/vnt/jni/ConfigurationInfoBean.java @@ -15,10 +15,12 @@ public class ConfigurationInfoBean implements Serializable { private boolean finger; private String inIps; private String outIps; + private boolean firstLatency; + private int port; public ConfigurationInfoBean(String token, String name, String deviceId, String password, String server, String stun, String cipherModel, boolean tcp, boolean finger, - String inIps, String outIps) { + String inIps, String outIps,boolean firstLatency,int port) { this.key = String.valueOf(System.currentTimeMillis()); this.token = token; this.name = name; @@ -31,6 +33,8 @@ public ConfigurationInfoBean(String token, String name, String deviceId, String this.finger = finger; this.inIps = inIps; this.outIps = outIps; + this.firstLatency = firstLatency; + this.port = port; } public String getKey() { @@ -124,4 +128,20 @@ public String getOutIps() { public void setOutIps(String outIps) { this.outIps = outIps; } + + public boolean isFirstLatency() { + return firstLatency; + } + + public void setFirstLatency(boolean firstLatency) { + this.firstLatency = firstLatency; + } + + public int getPort() { + return port; + } + + public void setPort(int port) { + this.port = port; + } } diff --git a/app/src/main/res/layout/activity_add.xml b/app/src/main/res/layout/activity_add.xml index f2a3519..f81ce0c 100644 --- a/app/src/main/res/layout/activity_add.xml +++ b/app/src/main/res/layout/activity_add.xml @@ -216,6 +216,62 @@ android:entries="@array/finger" android:singleLine="true" /> + + + + + + + + + + + + + + + + + + close open + + p2p + latency + 加载中… 未知错误