Commit 972d4f23 authored by jinliang's avatar jinliang

add vps feature

parent c04edc45
scp ./target/browser-backend-0.0.1-SNAPSHOT.jar root@47.119.25.86:/opt/project/
# pwd: i54EDNbD#ehbnl$4
...@@ -16,6 +16,7 @@ public enum Vendor { ...@@ -16,6 +16,7 @@ public enum Vendor {
awscn("亚马逊中国"), awscn("亚马逊中国"),
tencent("腾讯云"), tencent("腾讯云"),
isp("住宅"), isp("住宅"),
remote("远程设备"),
/** /**
* 本地ip,即 ip 地址没有设置任何代理 * 本地ip,即 ip 地址没有设置任何代理
......
...@@ -303,7 +303,7 @@ public class BrowserTask { ...@@ -303,7 +303,7 @@ public class BrowserTask {
return; return;
} }
CloudPlatformConfig config = cloudPlatformConfigRepository.findByPlatformAndRegionId( CloudPlatformConfig config = cloudPlatformConfigRepository.findByPlatformAndRegionId(
"ali", "remote",
aliRegion); aliRegion);
if (Objects.isNull(config)) { if (Objects.isNull(config)) {
log.error( log.error(
...@@ -766,7 +766,7 @@ public class BrowserTask { ...@@ -766,7 +766,7 @@ public class BrowserTask {
cloudPlatformOrder.getPlatformOrderId(), cloudPlatformOrder.getPlatformOrderId(),
cloudPlatformOrder.getRegionId()); cloudPlatformOrder.getRegionId());
CloudPlatformConfig config = cloudPlatformConfigRepository.findByPlatformAndRegionId( CloudPlatformConfig config = cloudPlatformConfigRepository.findByPlatformAndRegionId(
"ali", "remote",
cloudPlatformOrder.getRegionId()); cloudPlatformOrder.getRegionId());
RunInstancesResponse response1 = AliEcsRemoteClient.runInstances( RunInstancesResponse response1 = AliEcsRemoteClient.runInstances(
ipResource.getOwner(), ipResource.getUsername(), ipResource.getOwner(), ipResource.getUsername(),
......
...@@ -35,28 +35,40 @@ public class AliEcsRemoteClient { ...@@ -35,28 +35,40 @@ public class AliEcsRemoteClient {
//access_key_id //access_key_id
private static String getAccessKeyId() { private static String getAccessKeyId() {
return "LTAI5tEdz1DY4A4oYUawUuNH"; return "LTAI5tKAfESNNtYqtnE3FRvf";
} }
//access_key_secret //access_key_secret
private static String getAccessKeySecret() { private static String getAccessKeySecret() {
return "8KWmYgO0QIicZpyulhEwUhZqStrTwe"; return "mcYJAxCHqMAWKRlY3dZs55AUqOpXIb";
} }
//launch_template_id //launch_template_id
//脚本userData // PowerShell UserData for Windows ECS
private static String getUserData() { private static String getUserData() {
return "#!/bin/sh\n" return "$script = @\"\n"
+ "echo \"users %s:CL:%s\n" + "Set-ExecutionPolicy Bypass -Scope Process -Force;\n"
+ "allow %s *\n" + "$ErrorActionPreference = 'Stop';\n"
+ "auth strong\n" + "# Configure 3proxy\n"
+ "proxy -p8880\n" + "$configContent = @\"\n"
+ "proxy -p8881 -a\n" + "users %s:CL:%s\n"
+ "socks -p8882\n" + "allow %s *\n"
+ "flush\" | tee /etc/3proxy.cfg\n" + "auth strong\n"
+ "systemctl restart 3proxy"; + "proxy -p8880\n"
+ "proxy -p8881 -a\n"
+ "socks -p8882\n"
+ "flush\n"
+ "\";\n"
+ "Set-Content -Path 'C:\\3proxy-0.9.4-x64\\bin64\\3proxy.cfg' -Value $configContent -Force;\n"
+ "\n"
+ "# Start 3proxy service\n"
+ "Start-Process 'net' -ArgumentList 'start 3proxy' -NoNewWindow -Wait;\n"
+ "\"@;\n"
+ "$script | Out-File -FilePath 'C:\\Windows\\Temp\\userdata.ps1' -Force;\n"
+ "Start-Process PowerShell -ArgumentList 'C:\\Windows\\Temp\\userdata.ps1' -NoNewWindow -Wait;";
} }
/* /*
* @Description //创建链接 * @Description //创建链接
* @Date 2024/7/25 10:32 * @Date 2024/7/25 10:32
......
...@@ -82,7 +82,7 @@ public enum RegionMappingEnum { ...@@ -82,7 +82,7 @@ public enum RegionMappingEnum {
Random random = new Random(); Random random = new Random();
int randomNumber = random.nextInt(2); int randomNumber = random.nextInt(2);
if(randomNumber == 0){ if(randomNumber == 0){
return RegionMappingEnum.US_CALIFORNIA; return RegionMappingEnum.SILICON;
}else { }else {
return RegionMappingEnum.US_VIRGINIA; return RegionMappingEnum.US_VIRGINIA;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment