mirror of
https://gitee.com/willfree/min-vpn-client_v2.git
synced 2026-10-04 19:42:00 +08:00
在配置页面增加外网信息的设置
This commit is contained in:
1 parent
c034b0a54f
commit
3990869a94
3 files changed
+143
-1
No files matched your search
@@ -36,8 +36,12 @@ public class SettingActivity extends MINVpnBaseActivity<SettingActivityPresenter
|
||||
private ClearAbleEditText etIpAddress;
|
||||
private ClearAbleEditText etPort;
|
||||
private ClearAbleEditText etFirstRouterPrefix;
|
||||
private ClearAbleEditText etIpAddress_Extra;
|
||||
private ClearAbleEditText etPort_Extra;
|
||||
private ClearAbleEditText etFirstRouterPrefix_Extra;
|
||||
// VPN Server
|
||||
private ClearAbleEditText etServicePrefix;
|
||||
private ClearAbleEditText etServicePrefix_Extra;
|
||||
// VMS
|
||||
private ClearAbleEditText etBlockChainIp;
|
||||
private ClearAbleEditText etVMSTCPPort;
|
||||
@@ -54,8 +58,12 @@ public class SettingActivity extends MINVpnBaseActivity<SettingActivityPresenter
|
||||
etIpAddress=findViewById(R.id.etIpAddress);
|
||||
etPort=findViewById(R.id.etPort);
|
||||
etFirstRouterPrefix=findViewById(R.id.etFirstRouterPrefix);
|
||||
etIpAddress_Extra=findViewById(R.id.etIpAddressExtranet);
|
||||
etPort_Extra=findViewById(R.id.etPortExtranet);
|
||||
etFirstRouterPrefix_Extra=findViewById(R.id.etFirstRouterPrefixExtranet);
|
||||
// VPN Server
|
||||
etServicePrefix=findViewById(R.id.etServicePrefix);
|
||||
etServicePrefix_Extra=findViewById(R.id.etServicePrefixExtranet);
|
||||
// VMS
|
||||
etBlockChainIp=findViewById(R.id.etBlockChainIp);
|
||||
etVMSTCPPort=findViewById(R.id.etVMSTCPPort);
|
||||
@@ -119,6 +127,31 @@ public class SettingActivity extends MINVpnBaseActivity<SettingActivityPresenter
|
||||
btnSaveSetting.revertAnimation();
|
||||
return;
|
||||
}
|
||||
// --- 外网
|
||||
String mirIpAddressExtra= Objects.requireNonNull(etIpAddress_Extra.getText()).toString();
|
||||
if(!AccountValidatorRegexUtil.INSTANCE.isIPAddr(mirIpAddressExtra)){
|
||||
showWarning("请输入有效的外网接入IP地址");
|
||||
btnSaveSetting.revertAnimation();
|
||||
return;
|
||||
}
|
||||
String mirPortExtra= Objects.requireNonNull(etPort_Extra.getText()).toString();
|
||||
if(!AccountValidatorRegexUtil.INSTANCE.isPort(mirPortExtra)){
|
||||
showWarning("请输入有效的外网接入端口号");
|
||||
btnSaveSetting.revertAnimation();
|
||||
return;
|
||||
}
|
||||
String firstPrefixExtra = Objects.requireNonNull(etFirstRouterPrefix_Extra.getText()).toString();
|
||||
if(!AccountValidatorRegexUtil.INSTANCE.isndnPrefix(firstPrefixExtra)){
|
||||
showWarning("请输入有效的MIN外网接入服务前缀");
|
||||
btnSaveSetting.revertAnimation();
|
||||
return;
|
||||
}
|
||||
String servicePrefixExtra= Objects.requireNonNull(etServicePrefix_Extra.getText()).toString();
|
||||
if(!AccountValidatorRegexUtil.INSTANCE.isndnPrefix(servicePrefixExtra)){
|
||||
showWarning("请输入有效的外网VPN服务前缀");
|
||||
btnSaveSetting.revertAnimation();
|
||||
return;
|
||||
}
|
||||
String blockChainIpAddress = Objects.requireNonNull(etBlockChainIp.getText()).toString();
|
||||
if(!AccountValidatorRegexUtil.INSTANCE.isIPAddr(blockChainIpAddress)){
|
||||
showWarning("请输入有效的区块链IP地址");
|
||||
@@ -144,12 +177,20 @@ public class SettingActivity extends MINVpnBaseActivity<SettingActivityPresenter
|
||||
MINVpnSettingAPI.INSTANCE.updateMirPort(Integer.parseInt(mirPort));
|
||||
MINVpnSettingAPI.INSTANCE.updateFirstRouterPrefix(firstPrefix);
|
||||
MINVpnSettingAPI.INSTANCE.updateServicePrefix(servicePrefix);
|
||||
// 外网
|
||||
MINVpnSettingAPI.INSTANCE.updateExtranetMirIpAddress(mirIpAddressExtra);
|
||||
MINVpnSettingAPI.INSTANCE.updateExtranetMirPort(Integer.parseInt(mirPortExtra));
|
||||
MINVpnSettingAPI.INSTANCE.updateExtranetFirstRouterPrefix(firstPrefixExtra);
|
||||
MINVpnSettingAPI.INSTANCE.updateExtranetServicePrefix(servicePrefixExtra);
|
||||
MINVpnSettingAPI.INSTANCE.updateBlockChainIpAddress(blockChainIpAddress);
|
||||
MINVpnSettingAPI.INSTANCE.updateBcTcpPort(Integer.parseInt(tcpPort));
|
||||
MINVpnSettingAPI.INSTANCE.updateBcSslPort(Integer.parseInt(sslPort));
|
||||
MINVpnSettingAPI.INSTANCE.updateEncryptedConfig(isEncrypted);
|
||||
System.out.println(MINVpnSettingAPI.INSTANCE);
|
||||
|
||||
// 打印当前API值
|
||||
System.out.println("当前state: "+MINVpnSettingAPI.INSTANCE.toString());
|
||||
|
||||
// 显示保存成功的弹窗
|
||||
btnSaveSetting.postDelayed(() -> {
|
||||
btnSaveSetting.revertAnimation();
|
||||
|
||||
@@ -110,12 +110,109 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDecoration4" />
|
||||
|
||||
<!-- 外网的IP 端口号 第一跳前缀 服务器前缀(通常第二跳) -->
|
||||
<!-- 外网 VPNServer 第一跳路由 IP地址 -->
|
||||
<TextView
|
||||
android:id="@+id/tvDecoration21"
|
||||
style="@style/setting_title_decoration"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etServicePrefix" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settingTvTitle21"
|
||||
style="@style/setting_title"
|
||||
android:text="@string/setting_title_access_ip_address_extra"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tvDecoration21"
|
||||
app:layout_constraintStart_toEndOf="@+id/tvDecoration21"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvDecoration21" />
|
||||
|
||||
<cn.qjm253.quick_android_custom_view.other.ClearAbleEditText
|
||||
android:id="@+id/etIpAddressExtranet"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/setting_ip_address_example"
|
||||
app:layout_constraintLeft_toLeftOf="@id/settingTvTitle21"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDecoration21" />
|
||||
|
||||
<!-- 外网 VPNServer 第一跳路由 端口号 -->
|
||||
<TextView
|
||||
android:id="@+id/tvDecoration22"
|
||||
style="@style/setting_title_decoration"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etIpAddressExtranet" />
|
||||
<TextView
|
||||
android:id="@+id/settingTvTitle22"
|
||||
style="@style/setting_title"
|
||||
android:text="@string/setting_title_access_port_extra"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tvDecoration22"
|
||||
app:layout_constraintStart_toEndOf="@+id/tvDecoration22"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvDecoration22" />
|
||||
|
||||
<cn.qjm253.quick_android_custom_view.other.ClearAbleEditText
|
||||
android:id="@+id/etPortExtranet"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/setting_port_example"
|
||||
android:inputType="number"
|
||||
app:layout_constraintLeft_toLeftOf="@id/settingTvTitle22"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDecoration22" />
|
||||
|
||||
<!-- 外网 VPNServer 第一跳路由 服务前缀 -->
|
||||
<TextView
|
||||
android:id="@+id/tvDecoration23"
|
||||
style="@style/setting_title_decoration"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etPortExtranet" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settingTvTitle23"
|
||||
style="@style/setting_title"
|
||||
android:text="@string/setting_title_firstrouter_service_prefix_extra"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tvDecoration23"
|
||||
app:layout_constraintStart_toEndOf="@+id/tvDecoration23"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvDecoration23" />
|
||||
|
||||
<cn.qjm253.quick_android_custom_view.other.ClearAbleEditText
|
||||
android:id="@+id/etFirstRouterPrefixExtranet"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/setting_service_firstrouter_prefix_example"
|
||||
app:layout_constraintLeft_toLeftOf="@id/settingTvTitle23"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDecoration23" />
|
||||
|
||||
<!-- 外网 VPNServer 服务前缀 -->
|
||||
<TextView
|
||||
android:id="@+id/tvDecoration24"
|
||||
style="@style/setting_title_decoration"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etFirstRouterPrefixExtranet" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settingTvTitle24"
|
||||
style="@style/setting_title"
|
||||
android:text="@string/setting_title_service_prefix_extra"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tvDecoration24"
|
||||
app:layout_constraintStart_toEndOf="@+id/tvDecoration24"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvDecoration24" />
|
||||
|
||||
<cn.qjm253.quick_android_custom_view.other.ClearAbleEditText
|
||||
android:id="@+id/etServicePrefixExtranet"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/setting_service_prefix_example"
|
||||
app:layout_constraintLeft_toLeftOf="@id/settingTvTitle24"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDecoration24" />
|
||||
|
||||
<!-- VMS IP地址 -->
|
||||
<TextView
|
||||
android:id="@+id/tvDecoration5"
|
||||
style="@style/setting_title_decoration"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etServicePrefix" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/etServicePrefixExtranet" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settingTvTitle5"
|
||||
|
||||
@@ -53,12 +53,16 @@
|
||||
<string name="open">打开</string>
|
||||
<string name="download">下载</string>
|
||||
<string name="setting_title_access_ip_address">接入IP地址</string>
|
||||
<string name="setting_title_access_ip_address_extra">外网接入IP地址</string>
|
||||
<string name="setting_title_access_port">接入端口号</string>
|
||||
<string name="setting_title_access_port_extra">外网接入端口号</string>
|
||||
<string name="setting_ip_address_example">例如: 192.168.1.25</string>
|
||||
<string name="setting_port_example">例如:9748</string>
|
||||
<string name="setting_title_firstrouter_service_prefix">接入服务前缀</string>
|
||||
<string name="setting_title_firstrouter_service_prefix_extra">外网接入服务前缀</string>
|
||||
<string name="setting_service_firstrouter_prefix_example">例如:/min/gdcni19</string>
|
||||
<string name="setting_title_service_prefix">VPN服务前缀</string>
|
||||
<string name="setting_title_service_prefix_extra">外网VPN服务前缀</string>
|
||||
<string name="setting_service_prefix_example">例如:/min/gdcni12/vpnserver</string>
|
||||
<string name="setting_title_block_chain_ip_address">区块链IP地址</string>
|
||||
<string name="setting_block_chain_ip_address_example">例如:192.168.1.24</string>
|
||||
|
||||
Reference in new issue
Block a user