mirror of
https://gitee.com/willfree/min-vpn-client_v2.git
synced 2026-10-04 19:42:00 +08:00
平安版本安卓VPN,注册、设置和登录的修改;VPN握手连接;
This commit is contained in:
1 parent
cea9a70622
commit
01e66f837c
17 files changed
+257
-240
No files matched your search
+1
-1
@@ -43,7 +43,7 @@ android {
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 30
|
||||
versionCode 2
|
||||
versionName "2.1.4"
|
||||
versionName "2.1.6"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
Binary file not shown.
@@ -11,7 +11,7 @@ public class GlobalSetting {
|
||||
public static boolean isSM4InExternal = false;
|
||||
|
||||
// 是否开启VPN服务器信息同步
|
||||
public static boolean openSyncVPNInfo = false;
|
||||
public static boolean openSyncVPNInfo = true;
|
||||
|
||||
// 控制是否开启翻墙访问,true表示可以访问
|
||||
public static boolean openFirewall = true;
|
||||
|
||||
@@ -79,7 +79,7 @@ public class LoginActivity extends MINVpnBaseActivity<LoginActivityPresenter>
|
||||
easyBar=findViewById(R.id.easyBar);
|
||||
imageView_imgLogo=findViewById(R.id.imgLogo);
|
||||
savePasswordBox=findViewById(R.id.savePasswordBox);
|
||||
tvLoginWithSMS = findViewById(R.id.tvLoginWithSMS);
|
||||
// tvLoginWithSMS = findViewById(R.id.tvLoginWithSMS);
|
||||
tvRegisterNow=findViewById(R.id.tvRegisterNow);
|
||||
tvResetNow=findViewById(R.id.tvResetNow);
|
||||
etUsername=findViewById(R.id.etUsername);
|
||||
@@ -128,10 +128,10 @@ public class LoginActivity extends MINVpnBaseActivity<LoginActivityPresenter>
|
||||
}
|
||||
|
||||
// 监听是否新设备登录
|
||||
tvLoginWithSMS.setOnClickListener(v -> {
|
||||
System.out.println("即将跳转到新设备登录界面");
|
||||
ContextExtensionKt.jumpTo(this, LoginSMSActivity.class);
|
||||
});
|
||||
// tvLoginWithSMS.setOnClickListener(v -> {
|
||||
// System.out.println("即将跳转到新设备登录界面");
|
||||
// ContextExtensionKt.jumpTo(this, LoginSMSActivity.class);
|
||||
// });
|
||||
|
||||
// 监听注册按钮
|
||||
tvRegisterNow.setOnClickListener(v -> {
|
||||
|
||||
@@ -109,6 +109,11 @@ public class LoginSMSActivity extends MINVpnBaseActivity<LoginSMSActivityPresent
|
||||
.circleCrop()
|
||||
.into(imageView_imgLogo);
|
||||
|
||||
// 测试时自动填充
|
||||
etUsername.setText("pinganTest");
|
||||
etPassword.setText("pkusz@123");
|
||||
SMSPhoneNumber.setText("17817733391");
|
||||
|
||||
// 获取验证码操作的监听器
|
||||
getSMScode.setOnClickListener(v -> {
|
||||
System.out.println("即将执行获取验证码的逻辑");
|
||||
@@ -150,12 +155,13 @@ public class LoginSMSActivity extends MINVpnBaseActivity<LoginSMSActivityPresent
|
||||
btnLogin.startAnimation();
|
||||
|
||||
this.rawUsername = Objects.requireNonNull(etUsername.getText()).toString();
|
||||
System.out.println("用户名:"+rawUsername);
|
||||
this.rawPassword = Objects.requireNonNull(etPassword.getText()).toString();
|
||||
this.phoenNumber = Objects.requireNonNull(SMSPhoneNumber.getText()).toString();
|
||||
this.verifyCode = Objects.requireNonNull(etSMSNumber.getText()).toString();
|
||||
|
||||
if (rawUsername.isEmpty() || rawPassword.isEmpty()
|
||||
|| phoenNumber.isEmpty() || verifyCode.isEmpty()) {
|
||||
|| phoenNumber.isEmpty()) {
|
||||
showWarning("请将信息填写完整");
|
||||
btnLogin.revertAnimation();
|
||||
return;
|
||||
@@ -175,11 +181,11 @@ public class LoginSMSActivity extends MINVpnBaseActivity<LoginSMSActivityPresent
|
||||
btnLogin.revertAnimation();
|
||||
return;
|
||||
}
|
||||
if (!AccountValidatorRegexUtil.INSTANCE.isInviteCode(verifyCode)) {
|
||||
showWarning("请输入有效的手机验证码,长度为0-6位");
|
||||
btnLogin.revertAnimation();
|
||||
return;
|
||||
}
|
||||
// if (!AccountValidatorRegexUtil.INSTANCE.isInviteCode(verifyCode)) {
|
||||
// showWarning("请输入有效的手机验证码,长度为0-6位");
|
||||
// btnLogin.revertAnimation();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 密码经md5哈希
|
||||
String password =DigestUtilKt.encodeToMD5(rawPassword);
|
||||
|
||||
+54
-53
@@ -59,9 +59,9 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
private ClearAbleEditText etEmail;
|
||||
private ClearAbleEditText etInviteCode;
|
||||
private ClearAbleEditText etRePassword;
|
||||
private VerificationCodeEditText etSMSNumber;
|
||||
private CountDownButton getSMScode;
|
||||
private ConstraintLayout SMSRegion;
|
||||
// private VerificationCodeEditText etSMSNumber;
|
||||
// private CountDownButton getSMScode;
|
||||
// private ConstraintLayout SMSRegion;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -77,9 +77,9 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
etEmail=findViewById(R.id.etEmail);
|
||||
etInviteCode=findViewById(R.id.etInviteCode);
|
||||
etRePassword=findViewById(R.id.etRePassword);
|
||||
etSMSNumber=findViewById(R.id.Register_etSMSNumber);
|
||||
getSMScode=findViewById(R.id.Register_getSMScode);
|
||||
SMSRegion=findViewById(R.id.Register_SMSRegion);
|
||||
// etSMSNumber=findViewById(R.id.Register_etSMSNumber);
|
||||
// getSMScode=findViewById(R.id.Register_getSMScode);
|
||||
// SMSRegion=findViewById(R.id.Register_SMSRegion);
|
||||
|
||||
initView();
|
||||
}
|
||||
@@ -104,45 +104,45 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
.circleCrop()
|
||||
.into(imgLogo);
|
||||
|
||||
// // 测试时自动填充
|
||||
// etUsername.setText("wefree");
|
||||
// etPassword.setText("free@1898");
|
||||
// etRePassword.setText("free@1898");
|
||||
// etPhoneNumber.setText("15239970973");
|
||||
// etEmail.setText("255526727@qq.com");
|
||||
// etInviteCode.setText("1234");
|
||||
// 测试时自动填充
|
||||
// etUsername.setText("pinganTest");
|
||||
// etPassword.setText("pkusz@123");
|
||||
// etRePassword.setText("pkusz@123");
|
||||
// etPhoneNumber.setText("17817733391");
|
||||
// etEmail.setText("1054468404@qq.com");
|
||||
// etInviteCode.setText("pkusz");
|
||||
|
||||
// 获取验证码操作的监听器
|
||||
getSMScode.setOnClickListener(v -> {
|
||||
System.out.println("即将执行获取验证码的逻辑");
|
||||
// 1. 构造请求包
|
||||
String rawUsername = Objects.requireNonNull(etUsername.getText()).toString();
|
||||
String phoenNumber = Objects.requireNonNull(etPhoneNumber.getText()).toString();
|
||||
if (rawUsername.isEmpty() || phoenNumber.isEmpty() ) {
|
||||
showWarning("请确认已经填写手机及名字");
|
||||
btnRegister.revertAnimation();
|
||||
return;
|
||||
}
|
||||
if (!AccountValidatorRegexUtil.INSTANCE.isUsername(rawUsername)) {
|
||||
showWarning("请输入有效的用户名,用户名为3-20位,包含字母、数字、下划线,且以字母开头");
|
||||
btnRegister.revertAnimation();
|
||||
return;
|
||||
}
|
||||
if (!AccountValidatorRegexUtil.INSTANCE.isMobile(phoenNumber)) {
|
||||
showWarning("请输入有效的手机号");
|
||||
btnRegister.revertAnimation();
|
||||
return;
|
||||
}
|
||||
MISAuthenticationRequest smsRequest=new MISAuthenticationRequest("/"+rawUsername,
|
||||
phoenNumber);
|
||||
try {
|
||||
System.out.println("!!!请求验证码: "+smsRequest.toJson());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 2. 向MIS发送网络请求
|
||||
mPresenter.getSMSCode(smsRequest);
|
||||
});
|
||||
// getSMScode.setOnClickListener(v -> {
|
||||
// System.out.println("即将执行获取验证码的逻辑");
|
||||
// // 1. 构造请求包
|
||||
// String rawUsername = Objects.requireNonNull(etUsername.getText()).toString();
|
||||
// String phoenNumber = Objects.requireNonNull(etPhoneNumber.getText()).toString();
|
||||
// if (rawUsername.isEmpty() || phoenNumber.isEmpty() ) {
|
||||
// showWarning("请确认已经填写手机及名字");
|
||||
// btnRegister.revertAnimation();
|
||||
// return;
|
||||
// }
|
||||
// if (!AccountValidatorRegexUtil.INSTANCE.isUsername(rawUsername)) {
|
||||
// showWarning("请输入有效的用户名,用户名为3-20位,包含字母、数字、下划线,且以字母开头");
|
||||
// btnRegister.revertAnimation();
|
||||
// return;
|
||||
// }
|
||||
// if (!AccountValidatorRegexUtil.INSTANCE.isMobile(phoenNumber)) {
|
||||
// showWarning("请输入有效的手机号");
|
||||
// btnRegister.revertAnimation();
|
||||
// return;
|
||||
// }
|
||||
// MISAuthenticationRequest smsRequest=new MISAuthenticationRequest("/"+rawUsername,
|
||||
// phoenNumber);
|
||||
// try {
|
||||
// System.out.println("!!!请求验证码: "+smsRequest.toJson());
|
||||
// } catch (IllegalAccessException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// // 2. 向MIS发送网络请求
|
||||
// mPresenter.getSMSCode(smsRequest);
|
||||
// });
|
||||
|
||||
btnRegister.setBackgroundResource(R.drawable.button_shape_default);
|
||||
btnRegister.setOnClickListener(v->{
|
||||
@@ -177,7 +177,8 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
String password= Objects.requireNonNull(etPassword.getText()).toString().trim();
|
||||
String rePassword= Objects.requireNonNull(etPassword.getText()).toString().trim();
|
||||
String inviteCode= Objects.requireNonNull(etInviteCode.getText()).toString().trim();
|
||||
String verifyCode= Objects.requireNonNull(etSMSNumber.getText()).toString().trim();
|
||||
// String verifyCode= Objects.requireNonNull(etSMSNumber.getText()).toString().trim();
|
||||
String verifyCode = "";
|
||||
if(username.length()==0 || password.length()==0 || rePassword.length()==0 || inviteCode.length()==0){
|
||||
showWarning("请将信息填写完整");
|
||||
btnRegister.revertAnimation();
|
||||
@@ -208,11 +209,11 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
btnRegister.revertAnimation();
|
||||
return;
|
||||
}
|
||||
if(!AccountValidatorRegexUtil.INSTANCE.isInviteCode(inviteCode)){
|
||||
showWarning("请输入有效的验证码,验证码长度需要大于0小于等于6");
|
||||
btnRegister.revertAnimation();
|
||||
return;
|
||||
}
|
||||
// if(!AccountValidatorRegexUtil.INSTANCE.isInviteCode(inviteCode)){
|
||||
// showWarning("请输入有效的验证码,验证码长度需要大于0小于等于6");
|
||||
// btnRegister.revertAnimation();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 密码经md5哈希
|
||||
String md5Password = DigestUtilKt.encodeToMD5(password);
|
||||
@@ -261,8 +262,8 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
0f, -DisplayUtils.dp2px(this, 90)),
|
||||
ViewExtensionKt.transYAnimation(etEmail,
|
||||
0f, -DisplayUtils.dp2px(this, 90)),
|
||||
ViewExtensionKt.transYAnimation(SMSRegion,
|
||||
0f, -DisplayUtils.dp2px(this, 90)),
|
||||
// ViewExtensionKt.transYAnimation(SMSRegion,
|
||||
// 0f, -DisplayUtils.dp2px(this, 90)),
|
||||
ViewExtensionKt.transYAnimation(btnRegister,
|
||||
0f, -DisplayUtils.dp2px(this, 90))
|
||||
);
|
||||
@@ -284,8 +285,8 @@ public class RegisterActivity extends MINVpnBaseActivity<RegisterActivityPresent
|
||||
-DisplayUtils.dp2px(this, 90),0f),
|
||||
ViewExtensionKt.transYAnimation(etEmail,
|
||||
-DisplayUtils.dp2px(this, 90),0f),
|
||||
ViewExtensionKt.transYAnimation(SMSRegion,
|
||||
-DisplayUtils.dp2px(this, 90),0f),
|
||||
// ViewExtensionKt.transYAnimation(SMSRegion,
|
||||
// -DisplayUtils.dp2px(this, 90),0f),
|
||||
ViewExtensionKt.transYAnimation(btnRegister,
|
||||
-DisplayUtils.dp2px(this, 90),0f)
|
||||
);
|
||||
|
||||
+11
-10
@@ -26,16 +26,17 @@ public class RegisterActivityModel implements RegisterActivityContract.Model{
|
||||
@Override
|
||||
public void register(MISRegisterRequest misRegisterRequest, OriginalRegisterRequest registerRequest) {
|
||||
// 1. 先在MIS进行注册,MIS托管了私钥
|
||||
Integer code=MISRequestAPI.INSTANCE.registerMIS(misRegisterRequest);
|
||||
if(code==null) {
|
||||
mPresenter.registerFailed("MIS注册失败,未成功收到的合法应答");
|
||||
return;
|
||||
}else if(code==200) {
|
||||
mPresenter.getCodeSuccess("MIS注册成功,接下来进行VMS上的注册");
|
||||
}else{
|
||||
mPresenter.registerFailed("MIS注册失败,应答码为"+code);
|
||||
return;
|
||||
}
|
||||
// Integer code=MISRequestAPI.INSTANCE.registerMIS(misRegisterRequest);
|
||||
// if(code==null) {
|
||||
// mPresenter.registerFailed("MIS注册失败,未成功收到的合法应答");
|
||||
// return;
|
||||
// }else if(code==200) {
|
||||
// mPresenter.getCodeSuccess("MIS注册成功,接下来进行VMS上的注册");
|
||||
// }else{
|
||||
// mPresenter.registerFailed("MIS注册失败,应答码为"+code);
|
||||
// return;
|
||||
// }
|
||||
mPresenter.getCodeSuccess("MIS注册成功,接下来进行VMS上的注册");
|
||||
// 2. 再通过VMS进行注册,VMS管理VPN用户权限
|
||||
Integer resCode=VMSRequestAPI.INSTANCE.register(registerRequest);
|
||||
if(resCode==null) {
|
||||
|
||||
@@ -47,9 +47,9 @@ public class SettingActivity extends MINVpnBaseActivity<SettingActivityPresenter
|
||||
private ClearAbleEditText etVMSTCPPort;
|
||||
private ClearAbleEditText etVMSSSLPort;
|
||||
// MIS
|
||||
private ClearAbleEditText etMISIp;
|
||||
private ClearAbleEditText etMISTCPPort;
|
||||
private ClearAbleEditText etMISSSLPort;
|
||||
// private ClearAbleEditText etMISIp;
|
||||
// private ClearAbleEditText etMISTCPPort;
|
||||
// private ClearAbleEditText etMISSSLPort;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -73,9 +73,9 @@ public class SettingActivity extends MINVpnBaseActivity<SettingActivityPresenter
|
||||
etVMSTCPPort=findViewById(R.id.etVMSTCPPort);
|
||||
etVMSSSLPort=findViewById(R.id.etVMSSSLPort);
|
||||
// MIS
|
||||
etMISIp=findViewById(R.id.etMISIp);
|
||||
etMISTCPPort=findViewById(R.id.etMISTCPPort);
|
||||
etMISSSLPort=findViewById(R.id.etMISSSLPort);
|
||||
// etMISIp=findViewById(R.id.etMISIp);
|
||||
// etMISTCPPort=findViewById(R.id.etMISTCPPort);
|
||||
// etMISSSLPort=findViewById(R.id.etMISSSLPort);
|
||||
|
||||
initView();
|
||||
}
|
||||
@@ -111,9 +111,9 @@ public class SettingActivity extends MINVpnBaseActivity<SettingActivityPresenter
|
||||
etBlockChainIp.setText(MINVpnSettingAPI.INSTANCE.getBlockChainIpAddress());
|
||||
etVMSTCPPort.setText(String.valueOf(MINVpnSettingAPI.INSTANCE.getBcTcpPort()));
|
||||
etVMSSSLPort.setText(String.valueOf(MINVpnSettingAPI.INSTANCE.getBcSslPort()));
|
||||
etMISIp.setText(MINVpnSettingAPI.INSTANCE.getMisIpAddress());
|
||||
etMISTCPPort.setText(String.valueOf(MINVpnSettingAPI.INSTANCE.getMisTcpPort()));
|
||||
etMISSSLPort.setText(String.valueOf(MINVpnSettingAPI.INSTANCE.getMisSslPort()));
|
||||
// etMISIp.setText(MINVpnSettingAPI.INSTANCE.getMisIpAddress());
|
||||
// etMISTCPPort.setText(String.valueOf(MINVpnSettingAPI.INSTANCE.getMisTcpPort()));
|
||||
// etMISSSLPort.setText(String.valueOf(MINVpnSettingAPI.INSTANCE.getMisSslPort()));
|
||||
|
||||
// 设置按钮的监听(点击动作)
|
||||
btnSaveSetting.setOnClickListener(v->{
|
||||
@@ -186,24 +186,24 @@ public class SettingActivity extends MINVpnBaseActivity<SettingActivityPresenter
|
||||
btnSaveSetting.revertAnimation();
|
||||
return;
|
||||
}
|
||||
String misIpAddress = Objects.requireNonNull(etMISIp.getText()).toString();
|
||||
if(!AccountValidatorRegexUtil.INSTANCE.isIPAddr(misIpAddress)){
|
||||
showWarning("请输入有效的MIS-IP地址");
|
||||
btnSaveSetting.revertAnimation();
|
||||
return;
|
||||
}
|
||||
String mistcpPort= Objects.requireNonNull(etMISTCPPort.getText()).toString();
|
||||
if(!AccountValidatorRegexUtil.INSTANCE.isPort(mistcpPort)){
|
||||
showWarning("请输入有效的MIS-TCP端口号");
|
||||
btnSaveSetting.revertAnimation();
|
||||
return;
|
||||
}
|
||||
String missslPort= Objects.requireNonNull(etMISSSLPort.getText()).toString();
|
||||
if(!AccountValidatorRegexUtil.INSTANCE.isPort(missslPort)){
|
||||
showWarning("请输入有效的MIS-SSL端口号");
|
||||
btnSaveSetting.revertAnimation();
|
||||
return;
|
||||
}
|
||||
// String misIpAddress = Objects.requireNonNull(etMISIp.getText()).toString();
|
||||
// if(!AccountValidatorRegexUtil.INSTANCE.isIPAddr(misIpAddress)){
|
||||
// showWarning("请输入有效的MIS-IP地址");
|
||||
// btnSaveSetting.revertAnimation();
|
||||
// return;
|
||||
// }
|
||||
// String mistcpPort= Objects.requireNonNull(etMISTCPPort.getText()).toString();
|
||||
// if(!AccountValidatorRegexUtil.INSTANCE.isPort(mistcpPort)){
|
||||
// showWarning("请输入有效的MIS-TCP端口号");
|
||||
// btnSaveSetting.revertAnimation();
|
||||
// return;
|
||||
// }
|
||||
// String missslPort= Objects.requireNonNull(etMISSSLPort.getText()).toString();
|
||||
// if(!AccountValidatorRegexUtil.INSTANCE.isPort(missslPort)){
|
||||
// showWarning("请输入有效的MIS-SSL端口号");
|
||||
// btnSaveSetting.revertAnimation();
|
||||
// return;
|
||||
// }
|
||||
boolean isEncrypted=true;
|
||||
|
||||
// 将属性字段更新到MINVpnAPI
|
||||
@@ -219,9 +219,9 @@ public class SettingActivity extends MINVpnBaseActivity<SettingActivityPresenter
|
||||
MINVpnSettingAPI.INSTANCE.updateBlockChainIpAddress(blockChainIpAddress);
|
||||
MINVpnSettingAPI.INSTANCE.updateBcTcpPort(Integer.parseInt(tcpPort));
|
||||
MINVpnSettingAPI.INSTANCE.updateBcSslPort(Integer.parseInt(sslPort));
|
||||
MINVpnSettingAPI.INSTANCE.updateMisIpAddress(misIpAddress);
|
||||
MINVpnSettingAPI.INSTANCE.updateMisTcpPort(Integer.parseInt(mistcpPort));
|
||||
MINVpnSettingAPI.INSTANCE.updateMisSslPort(Integer.parseInt(missslPort));
|
||||
MINVpnSettingAPI.INSTANCE.updateMisIpAddress(blockChainIpAddress);
|
||||
MINVpnSettingAPI.INSTANCE.updateMisTcpPort(Integer.parseInt(tcpPort));
|
||||
MINVpnSettingAPI.INSTANCE.updateMisSslPort(Integer.parseInt(sslPort));
|
||||
MINVpnSettingAPI.INSTANCE.updateEncryptedConfig(isEncrypted);
|
||||
System.out.println(MINVpnSettingAPI.INSTANCE);
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public enum MINVpnSettingAPI {
|
||||
ArrayList<VpnServerInfo> allServerInfo=list.getVpnServerInfoList();
|
||||
for (int i = 0; i < allServerInfo.size(); i++) {
|
||||
VpnServerInfo currentInfo=allServerInfo.get(i);
|
||||
if(currentInfo.IsInner){
|
||||
if(!currentInfo.IsInner){ //这里取决于后端的返回值,它的Inner为false,但是又是内网,所以……
|
||||
this.updateMirIpAddress(currentInfo.IP);
|
||||
this.updateMirPort(currentInfo.Port);
|
||||
this.updateFirstRouterPrefix(currentInfo.ClientPrefix);
|
||||
@@ -345,7 +345,7 @@ public enum MINVpnSettingAPI {
|
||||
// MIS通信地址
|
||||
public String getMisIpAddress(){
|
||||
return EncryptedSharedPreferenceUtil.get(context, // gdcni17
|
||||
SP_LOCAL_SETTING_MIS_IP_ADDRESS_TCP,"121.15.171.89");
|
||||
SP_LOCAL_SETTING_MIS_IP_ADDRESS_TCP,"113.105.122.178");
|
||||
}
|
||||
|
||||
public void updateMisIpAddress(String misIP){
|
||||
@@ -356,7 +356,7 @@ public enum MINVpnSettingAPI {
|
||||
|
||||
public Integer getMisTcpPort(){
|
||||
return EncryptedSharedPreferenceUtil.get(context,
|
||||
SP_LOCAL_SETTING_MIS_PORT_TCP,8888);
|
||||
SP_LOCAL_SETTING_MIS_PORT_TCP,12365);
|
||||
}
|
||||
|
||||
public void updateMisTcpPort(Integer misTcpPort){
|
||||
@@ -367,7 +367,7 @@ public enum MINVpnSettingAPI {
|
||||
|
||||
public Integer getMisSslPort(){
|
||||
return EncryptedSharedPreferenceUtil.get(context,
|
||||
SP_LOCAL_SETTING_MIS_PORT_SSL,7777);
|
||||
SP_LOCAL_SETTING_MIS_PORT_SSL,54231);
|
||||
}
|
||||
|
||||
public void updateMisSslPort(Integer misSslPort){
|
||||
|
||||
@@ -51,6 +51,7 @@ public enum MISRequestAPI {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
System.out.println(networkResponse);
|
||||
if(networkResponse.get()==null){
|
||||
System.out.println("获取验证码未收到合法应答信息");
|
||||
return null;
|
||||
|
||||
@@ -94,6 +94,7 @@ public enum VMSRequestAPI {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
System.out.println("注册返回结果:"+networkResponse.toString());
|
||||
if(networkResponse.get()==null){
|
||||
System.out.println("注册未收到合法应答信息");
|
||||
return null;
|
||||
|
||||
@@ -179,6 +179,7 @@ public class MINVpnService extends VpnService implements Handler.Callback{
|
||||
System.out.println("正在内访问...");
|
||||
// 1. 连接信息
|
||||
String allocateIP="10.254.0.88"; // 无用,只是凑参数
|
||||
// String allocateIP = MINVpnSettingAPI.INSTANCE.getMirIpAddress();
|
||||
VpnServerInfo vpnServerInfo=new VpnServerInfo();
|
||||
vpnServerInfo.IsInner=true;
|
||||
vpnServerInfo.IP=MINVpnSettingAPI.INSTANCE.getMirIpAddress();
|
||||
@@ -387,7 +388,9 @@ public class MINVpnService extends VpnService implements Handler.Callback{
|
||||
executorService.submit(new SendTask(readTunCPackets, vpnConnectionInfo.face));
|
||||
// 收包线程
|
||||
executorService.submit(new ReceiveQuickTask(writeTunLpPackets, vpnConnectionInfo.face));
|
||||
// executorService.submit(new ReceiveTask(writeTunLpPackets, vpnConnectionInfo.face));
|
||||
executorService.submit(new Min2IpQuickTask(writeTunLpPackets, writeTunDataQueue, vpnConnectionInfo.allocatedAddress));
|
||||
// executorService.submit(new Min2IpTask(writeTunLpPackets, writeTunDataQueue));
|
||||
executorService.submit(new WriteTunTask(writeTunDataQueue, tunOutput));
|
||||
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ public class ReceiveTask implements Runnable{
|
||||
// 读包入队 todo: 这里收包的时间要根据face收发是否互相影响来定!!!
|
||||
CPacket cPacket;
|
||||
try {
|
||||
cPacket = face.receiveCPacket(1000);
|
||||
cPacket = face.receiveCPacket(5000);
|
||||
}catch (LogicFaceException e){
|
||||
// e.printStackTrace();
|
||||
// System.out.println("error: face收包出现问题,请及时修复(inner)!!!");
|
||||
e.printStackTrace();
|
||||
// System.out.println("error: face收包出现问题,请及时修复(inner)!!! ReceiveTask");
|
||||
continue;
|
||||
}
|
||||
if(cPacket!=null){
|
||||
|
||||
@@ -172,6 +172,8 @@ public class VpnIntranetPreparation implements VpnPreparationInterface{
|
||||
vpnConnectionInfo.localFacePrefix=this.localFacePrefix;
|
||||
vpnConnectionInfo.realSecret=realSecret;
|
||||
this.vpnConnectionInfo=vpnConnectionInfo;
|
||||
|
||||
System.out.println("内网分配的IP地址:"+this.allocatedAddress);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -207,6 +209,7 @@ public class VpnIntranetPreparation implements VpnPreparationInterface{
|
||||
return null;
|
||||
}
|
||||
serverIdentifier.appendFragmentNumber(interestSeq++);
|
||||
|
||||
serverIdentifier.append(new IdentifierComponent(MINVpnSettingAPI.defraudString));
|
||||
// 构造本地标识:/{local_prefix}
|
||||
Identifier clientIdentifier;
|
||||
@@ -270,6 +273,7 @@ public class VpnIntranetPreparation implements VpnPreparationInterface{
|
||||
// 3. 发送兴趣包到服务器,接收服务器发回来的数据包
|
||||
String handshakeResponse;
|
||||
try {
|
||||
System.out.println("请求信息:"+new String(cPacket.payload.getValue()));
|
||||
face.sendCPacket(cPacket);
|
||||
CPacket data=face.receiveCPacket(10000);
|
||||
ByteBuffer respondBuf = ByteBuffer.allocate(1024);
|
||||
@@ -356,7 +360,7 @@ public class VpnIntranetPreparation implements VpnPreparationInterface{
|
||||
mOnEstablishListener.onEstablish(vpnInterface);
|
||||
}
|
||||
}
|
||||
LoggerHelper.finer(" New interface: " + vpnInterface + " (" + parameters + ")");
|
||||
LoggerHelper.finer(" : " + vpnInterface + " (" + parameters + ")");
|
||||
return vpnInterface;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:layout_marginRight="@dimen/dp_0"
|
||||
android:padding="5dp"
|
||||
android:text="v2.1.4"
|
||||
android:text="v2.1.6"
|
||||
android:textColor="@color/color_bg_name"
|
||||
android:textSize="17.5dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
@@ -141,16 +141,16 @@
|
||||
android:checked="true"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLoginWithSMS"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:padding="5dp"
|
||||
android:text="新设备登录"
|
||||
android:textColor="@color/colorPrimary"
|
||||
app:layout_constraintRight_toRightOf="@id/etPassword"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnLogin"
|
||||
/>
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tvLoginWithSMS"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_20"-->
|
||||
<!-- android:padding="5dp"-->
|
||||
<!-- android:text="新设备登录"-->
|
||||
<!-- android:textColor="@color/colorPrimary"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="@id/etPassword"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/btnLogin"-->
|
||||
<!-- />-->
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -130,54 +130,54 @@
|
||||
app:right_drawable="@drawable/delete"
|
||||
app:tinColor="@color/light_grey" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/Register_SMSRegion"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etInviteCode"
|
||||
>
|
||||
<com.jkb.vcedittext.VerificationCodeEditText
|
||||
android:id="@+id/Register_etSMSNumber"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:inputType="number"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:bottomLineHeight="2dp"
|
||||
app:bottomLineNormalColor="@color/grey"
|
||||
app:bottomLineSelectedColor="@color/grey"
|
||||
app:figures="6"
|
||||
app:selectedBackgroundColor="@color/transparent"
|
||||
app:verCodeMargin="10dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/Register_getSMScode"
|
||||
/>
|
||||
<com.white.countdownbutton.CountDownButton
|
||||
android:id="@+id/Register_getSMScode"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="42dp"
|
||||
android:text="获取验证码"
|
||||
android:textSize="17.5dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@drawable/countdownbutton_text"
|
||||
android:background="@color/transparent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="40dp"
|
||||
app:countDownFormat="%dS后重试"
|
||||
app:countDown="60000"
|
||||
app:countDownInterval="1000"
|
||||
app:enableCountDown="true"
|
||||
app:cdFinishText="重新获取"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
|
||||
<!-- android:id="@+id/Register_SMSRegion"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:orientation="horizontal"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_10"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/etInviteCode"-->
|
||||
<!-- >-->
|
||||
<!-- <com.jkb.vcedittext.VerificationCodeEditText-->
|
||||
<!-- android:id="@+id/Register_etSMSNumber"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="@dimen/dp_40"-->
|
||||
<!-- android:inputType="number"-->
|
||||
<!-- android:textColor="@color/black"-->
|
||||
<!-- android:textSize="20sp"-->
|
||||
<!-- android:layout_marginStart="40dp"-->
|
||||
<!-- android:layout_marginEnd="10dp"-->
|
||||
<!-- app:bottomLineHeight="2dp"-->
|
||||
<!-- app:bottomLineNormalColor="@color/grey"-->
|
||||
<!-- app:bottomLineSelectedColor="@color/grey"-->
|
||||
<!-- app:figures="6"-->
|
||||
<!-- app:selectedBackgroundColor="@color/transparent"-->
|
||||
<!-- app:verCodeMargin="10dp"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toStartOf="@id/Register_getSMScode"-->
|
||||
<!-- />-->
|
||||
<!-- <com.white.countdownbutton.CountDownButton-->
|
||||
<!-- android:id="@+id/Register_getSMScode"-->
|
||||
<!-- android:layout_width="@dimen/dp_100"-->
|
||||
<!-- android:layout_height="42dp"-->
|
||||
<!-- android:text="获取验证码"-->
|
||||
<!-- android:textSize="17.5dp"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:textColor="@drawable/countdownbutton_text"-->
|
||||
<!-- android:background="@color/transparent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- android:layout_marginEnd="40dp"-->
|
||||
<!-- app:countDownFormat="%dS后重试"-->
|
||||
<!-- app:countDown="10000"-->
|
||||
<!-- app:countDownInterval="1000"-->
|
||||
<!-- app:enableCountDown="true"-->
|
||||
<!-- app:cdFinishText="重新获取"-->
|
||||
<!-- />-->
|
||||
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tvSendVerifyCode"-->
|
||||
@@ -241,7 +241,7 @@
|
||||
app:spinning_bar_width="3dp"
|
||||
android:text="@string/register"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintLeft_toLeftOf="@id/Register_SMSRegion"
|
||||
app:layout_constraintRight_toRightOf="@id/Register_SMSRegion"
|
||||
app:layout_constraintTop_toBottomOf="@id/Register_SMSRegion" />
|
||||
app:layout_constraintLeft_toLeftOf="@id/etInviteCode"
|
||||
app:layout_constraintRight_toRightOf="@id/etInviteCode"
|
||||
app:layout_constraintTop_toBottomOf="@id/etInviteCode" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -280,76 +280,76 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDecoration7" />
|
||||
|
||||
<!-- MIS IP地址 -->
|
||||
<TextView
|
||||
android:id="@+id/tvDecoration8"
|
||||
style="@style/setting_title_decoration"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etVMSSSLPort" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tvDecoration8"-->
|
||||
<!-- style="@style/setting_title_decoration"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/etVMSSSLPort" />-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settingTvTitle8"
|
||||
style="@style/setting_title"
|
||||
android:text="@string/setting_title_mis_ip_address"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tvDecoration8"
|
||||
app:layout_constraintStart_toEndOf="@+id/tvDecoration8"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvDecoration8" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/settingTvTitle8"-->
|
||||
<!-- style="@style/setting_title"-->
|
||||
<!-- android:text="@string/setting_title_mis_ip_address"-->
|
||||
<!-- app:layout_constraintBottom_toTopOf="@+id/tvDecoration8"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/tvDecoration8"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/tvDecoration8" />-->
|
||||
|
||||
<cn.qjm253.quick_android_custom_view.other.ClearAbleEditText
|
||||
android:id="@+id/etMISIp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/setting_block_chain_ip_address_example"
|
||||
app:layout_constraintLeft_toLeftOf="@id/settingTvTitle8"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDecoration8" />
|
||||
<!-- <cn.qjm253.quick_android_custom_view.other.ClearAbleEditText-->
|
||||
<!-- android:id="@+id/etMISIp"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:hint="@string/setting_block_chain_ip_address_example"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="@id/settingTvTitle8"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/tvDecoration8" />-->
|
||||
|
||||
<!-- MIS TCP 端口号 -->
|
||||
<TextView
|
||||
android:id="@+id/tvDecoration9"
|
||||
style="@style/setting_title_decoration"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etMISIp" />
|
||||
<TextView
|
||||
android:id="@+id/settingTvTitle9"
|
||||
style="@style/setting_title"
|
||||
android:text="@string/setting_title_mis_tcp_port"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tvDecoration9"
|
||||
app:layout_constraintStart_toEndOf="@+id/tvDecoration9"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvDecoration9" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tvDecoration9"-->
|
||||
<!-- style="@style/setting_title_decoration"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/etMISIp" />-->
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/settingTvTitle9"-->
|
||||
<!-- style="@style/setting_title"-->
|
||||
<!-- android:text="@string/setting_title_mis_tcp_port"-->
|
||||
<!-- app:layout_constraintBottom_toTopOf="@+id/tvDecoration9"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/tvDecoration9"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/tvDecoration9" />-->
|
||||
|
||||
<cn.qjm253.quick_android_custom_view.other.ClearAbleEditText
|
||||
android:id="@+id/etMISTCPPort"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/setting_mis_tcp_port_example"
|
||||
android:inputType="number"
|
||||
app:layout_constraintLeft_toLeftOf="@id/settingTvTitle9"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDecoration9" />
|
||||
<!-- <cn.qjm253.quick_android_custom_view.other.ClearAbleEditText-->
|
||||
<!-- android:id="@+id/etMISTCPPort"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:hint="@string/setting_mis_tcp_port_example"-->
|
||||
<!-- android:inputType="number"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="@id/settingTvTitle9"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/tvDecoration9" />-->
|
||||
|
||||
<!-- MIS SSL 端口号 -->
|
||||
<TextView
|
||||
android:id="@+id/tvDecoration10"
|
||||
style="@style/setting_title_decoration"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etMISTCPPort" />
|
||||
<TextView
|
||||
android:id="@+id/settingTvTitle10"
|
||||
style="@style/setting_title"
|
||||
android:text="@string/setting_title_mis_ssl_port"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tvDecoration10"
|
||||
app:layout_constraintStart_toEndOf="@+id/tvDecoration10"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvDecoration10" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tvDecoration10"-->
|
||||
<!-- style="@style/setting_title_decoration"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/etMISTCPPort" />-->
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/settingTvTitle10"-->
|
||||
<!-- style="@style/setting_title"-->
|
||||
<!-- android:text="@string/setting_title_mis_ssl_port"-->
|
||||
<!-- app:layout_constraintBottom_toTopOf="@+id/tvDecoration10"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/tvDecoration10"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/tvDecoration10" />-->
|
||||
|
||||
<cn.qjm253.quick_android_custom_view.other.ClearAbleEditText
|
||||
android:id="@+id/etMISSSLPort"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/setting_mis_ssl_port_example"
|
||||
android:inputType="number"
|
||||
app:layout_constraintLeft_toLeftOf="@id/settingTvTitle10"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDecoration10" />
|
||||
<!-- <cn.qjm253.quick_android_custom_view.other.ClearAbleEditText-->
|
||||
<!-- android:id="@+id/etMISSSLPort"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:hint="@string/setting_mis_ssl_port_example"-->
|
||||
<!-- android:inputType="number"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="@id/settingTvTitle10"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/tvDecoration10" />-->
|
||||
|
||||
<br.com.simplepass.loadingbutton.customViews.CircularProgressButton
|
||||
android:id="@+id/btnSaveSetting"
|
||||
@@ -366,7 +366,7 @@
|
||||
app:initialCornerAngle="0dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etMISSSLPort"
|
||||
app:layout_constraintTop_toBottomOf="@id/etVMSSSLPort"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:spinning_bar_color="#FFFFFF"
|
||||
app:spinning_bar_padding="4dp"
|
||||
|
||||
Reference in new issue
Block a user