feat:新增mockData,以及一些逻辑的修复
This commit is contained in:
parent
ae04f35bb1
commit
da91340bcf
3
src/assets/svg/anti-forensics-forwarding/LineLeft.svg
Normal file
3
src/assets/svg/anti-forensics-forwarding/LineLeft.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg width="218" height="148" viewBox="0 0 218 148" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path id="Vector 330" d="M0.855469 0.683594L95.828 147.041H217.718" stroke="white" stroke-width="0.458267" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 239 B |
File diff suppressed because it is too large
Load Diff
447
src/pages/anti-forensics-forwarding/data/mockData.ts
Normal file
447
src/pages/anti-forensics-forwarding/data/mockData.ts
Normal file
@ -0,0 +1,447 @@
|
||||
|
||||
export const TRAFFIC_OBFUSCATION = {
|
||||
type: "NESTED_ENCRYPTION",
|
||||
name: "流量混淆",
|
||||
code: "BR",
|
||||
data: [
|
||||
{
|
||||
country_code: "gl",
|
||||
ingress_country_code: "za",
|
||||
},
|
||||
{
|
||||
country_code: "za",
|
||||
ingress_country_code: "dz",
|
||||
},
|
||||
{
|
||||
country_code: "dz",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "dz",
|
||||
ingress_country_code: "cn",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
};
|
||||
export const NESTED_ENCRYPTION = {
|
||||
type: "NESTED_ENCRYPTION",
|
||||
name: "嵌套加密",
|
||||
code: "GL",
|
||||
data: [
|
||||
{
|
||||
country_code: "gl",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "dz",
|
||||
},
|
||||
{
|
||||
country_code: "dz",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "dz",
|
||||
ingress_country_code: "cn",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
};
|
||||
|
||||
export const DYNAMIC_ROUTE_GENERATOR = [
|
||||
{
|
||||
type: "DYNAMIC_ROUTE_GENERATOR",
|
||||
name: "动态路由生成",
|
||||
data: [
|
||||
{
|
||||
country_code: "us",
|
||||
ingress_country_code: "ca",
|
||||
},
|
||||
{
|
||||
country_code: "ca",
|
||||
ingress_country_code: "gl",
|
||||
},
|
||||
{
|
||||
country_code: "gl",
|
||||
ingress_country_code: "by",
|
||||
},
|
||||
{
|
||||
country_code: "dz",
|
||||
ingress_country_code: "cn",
|
||||
},
|
||||
],
|
||||
color: "#48D3D5",
|
||||
isLine: true,
|
||||
},
|
||||
{
|
||||
type: "DYNAMIC_ROUTE_GENERATOR",
|
||||
name: "动态路由生成2",
|
||||
data: [
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "ml",
|
||||
},
|
||||
{
|
||||
country_code: "ml",
|
||||
ingress_country_code: "ly",
|
||||
},
|
||||
{
|
||||
country_code: "ly",
|
||||
ingress_country_code: "cn",
|
||||
},
|
||||
{
|
||||
country_code: "cn",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
],
|
||||
color: "#50FE35",
|
||||
isLine: true,
|
||||
},
|
||||
];
|
||||
|
||||
export const APP_DIVERSION = [
|
||||
{
|
||||
name: "Netflix",
|
||||
color: "#DC2626",
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
},
|
||||
{
|
||||
name: "Spotify",
|
||||
color: "#22C55E",
|
||||
data: [
|
||||
{
|
||||
country_code: "jp",
|
||||
ingress_country_code: "au",
|
||||
},
|
||||
{
|
||||
country_code: "au",
|
||||
ingress_country_code: "za",
|
||||
},
|
||||
{
|
||||
country_code: "za",
|
||||
ingress_country_code: "de",
|
||||
},
|
||||
{
|
||||
country_code: "de",
|
||||
ingress_country_code: "ca",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
},
|
||||
{
|
||||
name: "Instagram",
|
||||
color: "#8B5CF6",
|
||||
data: [
|
||||
{
|
||||
country_code: "it",
|
||||
ingress_country_code: "in",
|
||||
},
|
||||
{
|
||||
country_code: "in",
|
||||
ingress_country_code: "mx",
|
||||
},
|
||||
{
|
||||
country_code: "mx",
|
||||
ingress_country_code: "se",
|
||||
},
|
||||
{
|
||||
country_code: "se",
|
||||
ingress_country_code: "sg",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
},
|
||||
{
|
||||
name: "Telegram",
|
||||
color: "#2563EB",
|
||||
data: [
|
||||
{
|
||||
country_code: "ar",
|
||||
ingress_country_code: "nl",
|
||||
},
|
||||
{
|
||||
country_code: "nl",
|
||||
ingress_country_code: "kr",
|
||||
},
|
||||
{
|
||||
country_code: "kr",
|
||||
ingress_country_code: "eg",
|
||||
},
|
||||
{
|
||||
country_code: "eg",
|
||||
ingress_country_code: "nz",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
},
|
||||
{
|
||||
name: "Google",
|
||||
color: "#3B82F6",
|
||||
data: [
|
||||
{
|
||||
country_code: "ch",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "hk",
|
||||
},
|
||||
{
|
||||
country_code: "hk",
|
||||
ingress_country_code: "no",
|
||||
},
|
||||
{
|
||||
country_code: "no",
|
||||
ingress_country_code: "ae",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
},
|
||||
{
|
||||
name: "Gmail",
|
||||
color: "#22C55E",
|
||||
data: [
|
||||
{
|
||||
country_code: "es",
|
||||
ingress_country_code: "cn",
|
||||
},
|
||||
{
|
||||
country_code: "cn",
|
||||
ingress_country_code: "co",
|
||||
},
|
||||
{
|
||||
country_code: "co",
|
||||
ingress_country_code: "fi",
|
||||
},
|
||||
{
|
||||
country_code: "fi",
|
||||
ingress_country_code: "id",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
},
|
||||
{
|
||||
name: "Amazon",
|
||||
color: "#EAB308",
|
||||
data: [
|
||||
{
|
||||
country_code: "gb",
|
||||
ingress_country_code: "th",
|
||||
},
|
||||
{
|
||||
country_code: "th",
|
||||
ingress_country_code: "cl",
|
||||
},
|
||||
{
|
||||
country_code: "cl",
|
||||
ingress_country_code: "be",
|
||||
},
|
||||
{
|
||||
country_code: "be",
|
||||
ingress_country_code: "ph",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
},
|
||||
{
|
||||
name: "Ebay",
|
||||
color: "#3B82F6",
|
||||
data: [
|
||||
{
|
||||
country_code: "pl",
|
||||
ingress_country_code: "my",
|
||||
},
|
||||
{
|
||||
country_code: "my",
|
||||
ingress_country_code: "pe",
|
||||
},
|
||||
{
|
||||
country_code: "pe",
|
||||
ingress_country_code: "dk",
|
||||
},
|
||||
{
|
||||
country_code: "dk",
|
||||
ingress_country_code: "ng",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
},
|
||||
{
|
||||
name: "AppleNews",
|
||||
color: "#EF4444",
|
||||
data: [
|
||||
{
|
||||
country_code: "ie",
|
||||
ingress_country_code: "vn",
|
||||
},
|
||||
{
|
||||
country_code: "vn",
|
||||
ingress_country_code: "ma",
|
||||
},
|
||||
{
|
||||
country_code: "ma",
|
||||
ingress_country_code: "at",
|
||||
},
|
||||
{
|
||||
country_code: "at",
|
||||
ingress_country_code: "tw",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
},
|
||||
{
|
||||
name: "CNN",
|
||||
color: "#EF4444",
|
||||
data: [
|
||||
{
|
||||
country_code: "ua",
|
||||
ingress_country_code: "sa",
|
||||
},
|
||||
{
|
||||
country_code: "sa",
|
||||
ingress_country_code: "gr",
|
||||
},
|
||||
{
|
||||
country_code: "gr",
|
||||
ingress_country_code: "pk",
|
||||
},
|
||||
{
|
||||
country_code: "pk",
|
||||
ingress_country_code: "pt",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
},
|
||||
{
|
||||
name: "Browser",
|
||||
color: "#8B5CF6",
|
||||
data: [
|
||||
{
|
||||
country_code: "il",
|
||||
ingress_country_code: "ro",
|
||||
},
|
||||
{
|
||||
country_code: "ro",
|
||||
ingress_country_code: "nz",
|
||||
},
|
||||
{
|
||||
country_code: "nz",
|
||||
ingress_country_code: "tr",
|
||||
},
|
||||
{
|
||||
country_code: "tr",
|
||||
ingress_country_code: "ca",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
},
|
||||
{
|
||||
name: "YouTube",
|
||||
color: "#EF4444",
|
||||
data: [
|
||||
{
|
||||
country_code: "cz",
|
||||
ingress_country_code: "sg",
|
||||
},
|
||||
{
|
||||
country_code: "sg",
|
||||
ingress_country_code: "ar",
|
||||
},
|
||||
{
|
||||
country_code: "ar",
|
||||
ingress_country_code: "hu",
|
||||
},
|
||||
{
|
||||
country_code: "hu",
|
||||
ingress_country_code: "jp",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
},
|
||||
{
|
||||
name: "Facebook",
|
||||
color: "#3B82F6",
|
||||
data: [
|
||||
{
|
||||
country_code: "is",
|
||||
ingress_country_code: "za",
|
||||
},
|
||||
{
|
||||
country_code: "za",
|
||||
ingress_country_code: "mx",
|
||||
},
|
||||
{
|
||||
country_code: "mx",
|
||||
ingress_country_code: "it",
|
||||
},
|
||||
{
|
||||
country_code: "it",
|
||||
ingress_country_code: "kr",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
},
|
||||
];
|
||||
|
||||
export const PASS_AUTHENTICATION = {
|
||||
type: "PASS_AUTHENTICATION",
|
||||
name: "通行认证",
|
||||
authenticationPoint: [
|
||||
[-103.346771, 54.130366],
|
||||
[-120.346771, 52.130366],
|
||||
[-108.346771, 48.130366],
|
||||
[-98.346771, 46.130366],
|
||||
[-106.346771, 48.450366],
|
||||
[-101.346771, 53.130366],
|
||||
[-123.346771, 58.130366],
|
||||
[-111.346771, 65.443366],
|
||||
[-108.346771, 54.130366],
|
||||
[-116.346771, 59.130366],
|
||||
[-97.346771, 61.130366],
|
||||
[-95.346771, 63.130366],
|
||||
[-113.346771, 58.840366],
|
||||
[-99.346771, 59.130366],
|
||||
[-102.346771, 68.130366],
|
||||
],
|
||||
data: [
|
||||
{
|
||||
country_code: "gl",
|
||||
ingress_country_code: "dz",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "dz",
|
||||
},
|
||||
{
|
||||
country_code: "dz",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "dz",
|
||||
ingress_country_code: "cn",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "za",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
};
|
||||
@ -131,6 +131,11 @@
|
||||
width: 312.221px;
|
||||
}
|
||||
|
||||
.line-img-left{
|
||||
width: 216.86px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.fill {
|
||||
width: 9.165px;
|
||||
height: 9.165px;
|
||||
@ -141,6 +146,17 @@
|
||||
top: 77.5px;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.fill-left {
|
||||
width: 9.165px;
|
||||
height: 9.165px;
|
||||
border-radius: 50%;
|
||||
background-color: #18E4FF;
|
||||
position: absolute;
|
||||
right:210.5px;
|
||||
top: 82.5px;
|
||||
z-index: 99;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -30,501 +30,270 @@ import FacebookSvg from "@/assets/svg/anti-forensics-forwarding/Facebook.svg?rea
|
||||
import FacebookActiveSvg from "@/assets/svg/anti-forensics-forwarding/FacebookActive.svg?react";
|
||||
import { RootState } from "@/store";
|
||||
|
||||
import {
|
||||
TRAFFIC_OBFUSCATION,
|
||||
NESTED_ENCRYPTION,
|
||||
DYNAMIC_ROUTE_GENERATOR,
|
||||
APP_DIVERSION,
|
||||
PASS_AUTHENTICATION,
|
||||
} from "./data/mockData";
|
||||
|
||||
import "./index.scss";
|
||||
import { color } from "echarts";
|
||||
import { App } from "antd";
|
||||
|
||||
export const DIALOGTYPE = {
|
||||
ADDNode: {
|
||||
title: "添加节点",
|
||||
desc: "",
|
||||
successText: "添加",
|
||||
},
|
||||
AddNetwork: {
|
||||
title: "构建网络",
|
||||
desc: "",
|
||||
successText: "构建",
|
||||
},
|
||||
ADDNode: {
|
||||
title: "添加节点",
|
||||
desc: "",
|
||||
successText: "添加",
|
||||
},
|
||||
AddNetwork: {
|
||||
title: "构建网络",
|
||||
desc: "",
|
||||
successText: "构建",
|
||||
},
|
||||
};
|
||||
|
||||
export const NODEDIALOGTYPE = {
|
||||
ClearFailNode: {
|
||||
title: "清除掉线节点",
|
||||
desc: "",
|
||||
successText: "清除",
|
||||
},
|
||||
ClearWargingNode: {
|
||||
title: "恶意节点",
|
||||
desc: "",
|
||||
successText: "清除",
|
||||
},
|
||||
ClearFailNode: {
|
||||
title: "清除掉线节点",
|
||||
desc: "",
|
||||
successText: "清除",
|
||||
},
|
||||
ClearWargingNode: {
|
||||
title: "恶意节点",
|
||||
desc: "",
|
||||
successText: "清除",
|
||||
},
|
||||
};
|
||||
|
||||
export const Apps = [
|
||||
{
|
||||
name: "Netflix",
|
||||
icon: NetflixSvg,
|
||||
activeIcon: NetflixActiveSvg,
|
||||
color: "#DC2626",
|
||||
jumpList: {
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "Netflix",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Spotify",
|
||||
icon: SpotifySvg,
|
||||
activeIcon: SpotifyActiveSvg,
|
||||
color: "#22C55E",
|
||||
jumpList: {
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "Spotify",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Instagram",
|
||||
icon: InstagramSvg,
|
||||
activeIcon: InstagramActiveSvg,
|
||||
color: "#8B5CF6",
|
||||
jumpList: {
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "Instagram",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Telegram",
|
||||
icon: TelegramSvg,
|
||||
activeIcon: TelegramActiveSvg,
|
||||
color: "#2563EB",
|
||||
jumpList: {
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "Telegram",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Google",
|
||||
icon: GoogleSvg,
|
||||
activeIcon: GoogleActiveSvg,
|
||||
color: "#3B82F6",
|
||||
jumpList: {
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "Google",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Gmail",
|
||||
icon: GmailSvg,
|
||||
activeIcon: GmailActiveSvg,
|
||||
color: "#22C55E",
|
||||
jumpList: {
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "Gmail",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Amazon",
|
||||
icon: AmazonSvg,
|
||||
activeIcon: AmazonActiveSvg,
|
||||
color: "#EAB308",
|
||||
jumpList: {
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "Amazon",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Ebay",
|
||||
icon: EbaySvg,
|
||||
activeIcon: EbayActiveSvg,
|
||||
color: "#3B82F6",
|
||||
jumpList: {
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "Ebay",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "AppleNews",
|
||||
icon: AppleNewsSvg,
|
||||
activeIcon: AppleNewsActiveSvg,
|
||||
color: "#EF4444",
|
||||
jumpList: {
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "AppleNews",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "CNN",
|
||||
icon: CNNSvg,
|
||||
activeIcon: CNNActiveSvg,
|
||||
color: "#EF4444",
|
||||
jumpList: {
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "CNN",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Browser",
|
||||
icon: BrowserSvg,
|
||||
activeIcon: BrowserActiveSvg,
|
||||
color: "#8B5CF6",
|
||||
jumpList: {
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "Browser",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "YouTube",
|
||||
icon: YouTubeSvg,
|
||||
activeIcon: YouTubeActiveSvg,
|
||||
color: "#EF4444",
|
||||
jumpList: {
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "YouTube",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Facebook",
|
||||
icon: FacebookSvg,
|
||||
activeIcon: FacebookActiveSvg,
|
||||
color: "#3B82F6",
|
||||
jumpList: {
|
||||
data: [
|
||||
{
|
||||
country_code: "mg",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "fr",
|
||||
},
|
||||
{
|
||||
country_code: "fr",
|
||||
ingress_country_code: "br",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "us",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "Facebook",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Netflix",
|
||||
icon: NetflixSvg,
|
||||
activeIcon: NetflixActiveSvg,
|
||||
},
|
||||
{
|
||||
name: "Spotify",
|
||||
icon: SpotifySvg,
|
||||
activeIcon: SpotifyActiveSvg,
|
||||
},
|
||||
{
|
||||
name: "Instagram",
|
||||
icon: InstagramSvg,
|
||||
activeIcon: InstagramActiveSvg,
|
||||
},
|
||||
{
|
||||
name: "Telegram",
|
||||
icon: TelegramSvg,
|
||||
activeIcon: TelegramActiveSvg,
|
||||
},
|
||||
{
|
||||
name: "Google",
|
||||
icon: GoogleSvg,
|
||||
activeIcon: GoogleActiveSvg,
|
||||
},
|
||||
{
|
||||
name: "Gmail",
|
||||
icon: GmailSvg,
|
||||
activeIcon: GmailActiveSvg,
|
||||
},
|
||||
{
|
||||
name: "Amazon",
|
||||
icon: AmazonSvg,
|
||||
activeIcon: AmazonActiveSvg,
|
||||
},
|
||||
{
|
||||
name: "Ebay",
|
||||
icon: EbaySvg,
|
||||
activeIcon: EbayActiveSvg,
|
||||
},
|
||||
{
|
||||
name: "AppleNews",
|
||||
icon: AppleNewsSvg,
|
||||
activeIcon: AppleNewsActiveSvg,
|
||||
},
|
||||
{
|
||||
name: "CNN",
|
||||
icon: CNNSvg,
|
||||
activeIcon: CNNActiveSvg,
|
||||
},
|
||||
{
|
||||
name: "Browser",
|
||||
icon: BrowserSvg,
|
||||
activeIcon: BrowserActiveSvg,
|
||||
},
|
||||
{
|
||||
name: "YouTube",
|
||||
icon: YouTubeSvg,
|
||||
activeIcon: YouTubeActiveSvg,
|
||||
},
|
||||
{
|
||||
name: "Facebook",
|
||||
icon: FacebookSvg,
|
||||
activeIcon: FacebookActiveSvg,
|
||||
},
|
||||
];
|
||||
|
||||
export const CONST_TOOLTIP_TYPE = {
|
||||
NESTED_ENCRYPTION: {
|
||||
type: "NESTED_ENCRYPTION",
|
||||
title: "嵌套加密",
|
||||
},
|
||||
TRAFFIC_OBFUSCATION: {
|
||||
type: "TRAFFIC_OBFUSCATION",
|
||||
title: "流量混淆",
|
||||
},
|
||||
NESTED_ENCRYPTION: {
|
||||
type: "NESTED_ENCRYPTION",
|
||||
title: "嵌套加密",
|
||||
},
|
||||
TRAFFIC_OBFUSCATION: {
|
||||
type: "TRAFFIC_OBFUSCATION",
|
||||
title: "流量混淆",
|
||||
},
|
||||
DYNAMIC_ROUTE_GENERATOR: {
|
||||
type: "DYNAMIC_ROUTE_GENERATOR",
|
||||
title: "动态路由生成",
|
||||
},
|
||||
// 应用分流
|
||||
APP_DIVERSION: {
|
||||
type: "APP_DIVERSION",
|
||||
title: "应用分流",
|
||||
},
|
||||
// 通行认证
|
||||
PASS_AUTHENTICATION: {
|
||||
type: "PASS_AUTHENTICATION",
|
||||
title: "通行认证",
|
||||
},
|
||||
};
|
||||
|
||||
const DecentralizedElasticNetwork = () => {
|
||||
const { proxy_info, path_list } = useSelector(
|
||||
(state: RootState) => state.web3Reducer
|
||||
);
|
||||
const { proxy_info, path_list, newHomeProxies } = useSelector(
|
||||
(state: RootState) => state.web3Reducer
|
||||
);
|
||||
|
||||
const [tooltipType, setTooltipType] = useState(
|
||||
CONST_TOOLTIP_TYPE.NESTED_ENCRYPTION.type
|
||||
);
|
||||
const [tooltipClosed, setTooltipClosed] = useState(false);
|
||||
const [tooltipType, setTooltipType] = useState(
|
||||
CONST_TOOLTIP_TYPE.PASS_AUTHENTICATION.type
|
||||
);
|
||||
const [tooltipClosed, setTooltipClosed] = useState(false);
|
||||
|
||||
const [selectedApp, setSelectedApp] = useState<any>(null);
|
||||
const [selectedApp, setSelectedApp] = useState<any>(null);
|
||||
const appDiversion = useMemo(() => {
|
||||
return Apps.map((item) => {
|
||||
const findApp = APP_DIVERSION.find(
|
||||
(appItem) => item.name === appItem.name
|
||||
);
|
||||
return {
|
||||
...item,
|
||||
...findApp,
|
||||
};
|
||||
});
|
||||
}, []);
|
||||
const currentValue = useMemo(() => {
|
||||
let value = null;
|
||||
switch (tooltipType) {
|
||||
case CONST_TOOLTIP_TYPE.NESTED_ENCRYPTION.type:
|
||||
value = [NESTED_ENCRYPTION];
|
||||
break;
|
||||
case CONST_TOOLTIP_TYPE.TRAFFIC_OBFUSCATION.type:
|
||||
value = [TRAFFIC_OBFUSCATION];
|
||||
break;
|
||||
case CONST_TOOLTIP_TYPE.DYNAMIC_ROUTE_GENERATOR.type:
|
||||
value = DYNAMIC_ROUTE_GENERATOR
|
||||
break;
|
||||
case CONST_TOOLTIP_TYPE.APP_DIVERSION.type:
|
||||
value = selectedApp ? [selectedApp] : []
|
||||
break;
|
||||
case CONST_TOOLTIP_TYPE.PASS_AUTHENTICATION.type:
|
||||
value = [PASS_AUTHENTICATION]
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return value;
|
||||
}, [tooltipType,selectedApp]);
|
||||
|
||||
const handleClickApp = (item: any) => {
|
||||
console.log("item", item);
|
||||
setSelectedApp(item);
|
||||
};
|
||||
const handleClickApp = (item: any) => {
|
||||
console.log("item", item);
|
||||
setSelectedApp(item);
|
||||
};
|
||||
|
||||
const screenData = useMemo(() => {
|
||||
return {
|
||||
path_list,
|
||||
proxy_info,
|
||||
};
|
||||
}, [path_list, proxy_info]);
|
||||
|
||||
return (
|
||||
<div className="decentralized w-full h-full flex flex-col relative">
|
||||
<div className="flex items-center gap-[60px] absolute top-12 left-12 z-10">
|
||||
{Apps.map((item) => {
|
||||
return (
|
||||
<div
|
||||
key={item.name}
|
||||
className="flex items-center justify-center w-16 h-16 relative rounded-[4.95px] shadow-[0px_0px_3.299999952316284px_0px_rgba(84,87,255,1.00)] outline outline-[0.50px] outline-offset-[-0.50px] outline-indigo-50/60 overflow-hidden"
|
||||
onClick={() => handleClickApp(item)}
|
||||
>
|
||||
{selectedApp?.name === item?.name ? (
|
||||
<item.activeIcon />
|
||||
) : (
|
||||
<item.icon />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div className="mt-2 w-full h-full flex-1">
|
||||
<WorldGeo
|
||||
screenData={screenData}
|
||||
selectedApp={selectedApp}
|
||||
tooltipType={tooltipType}
|
||||
tooltipClosed={tooltipClosed}
|
||||
setTooltipClosed={setTooltipClosed}
|
||||
/>
|
||||
</div>
|
||||
<div className="absolute bottom-6 left-[50%] translate-x-[-50%] w-[calc(100%-51px)] p-6 bg-indigo-950 bg-opacity-10 rounded-md outline outline-1 outline-zinc-200 outline-opacity-40 backdrop-blur-lg inline-flex justify-start items-center gap-4">
|
||||
<div className="bt1 cursor-pointer" onClick={() => {}}>
|
||||
通行认证
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="bt1 cursor-pointer"
|
||||
onClick={() => {
|
||||
setTooltipType(
|
||||
CONST_TOOLTIP_TYPE.NESTED_ENCRYPTION.type
|
||||
);
|
||||
setTooltipClosed(true);
|
||||
}}
|
||||
>
|
||||
嵌套加密
|
||||
</div>
|
||||
<div className="bt1 cursor-pointer" onClick={() => {}}>
|
||||
动态路由生成
|
||||
</div>
|
||||
<div
|
||||
className="bt1 cursor-pointer"
|
||||
onClick={() => {
|
||||
setTooltipType(
|
||||
CONST_TOOLTIP_TYPE.TRAFFIC_OBFUSCATION.type
|
||||
);
|
||||
setTooltipClosed(true);
|
||||
}}
|
||||
>
|
||||
流量混淆
|
||||
</div>
|
||||
<div className="bt1 cursor-pointer" onClick={() => {}}>
|
||||
应用分流
|
||||
</div>
|
||||
useEffect(()=>{
|
||||
()=>{
|
||||
setTooltipClosed(false);
|
||||
}
|
||||
},[])
|
||||
|
||||
return (
|
||||
<div className="decentralized w-full h-full flex flex-col relative">
|
||||
<div className="flex items-center gap-[60px] absolute top-12 left-12 z-10">
|
||||
{tooltipType === CONST_TOOLTIP_TYPE.APP_DIVERSION.type && appDiversion.map((item) => {
|
||||
return (
|
||||
<div
|
||||
key={item.name}
|
||||
className="flex items-center justify-center w-16 h-16 relative rounded-[4.95px] shadow-[0px_0px_3.299999952316284px_0px_rgba(84,87,255,1.00)] outline outline-[0.50px] outline-offset-[-0.50px] outline-indigo-50/60 overflow-hidden"
|
||||
onClick={() => handleClickApp(item)}
|
||||
>
|
||||
{selectedApp?.name === item?.name ? (
|
||||
<item.activeIcon />
|
||||
) : (
|
||||
<item.icon />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div className="mt-2 w-full h-full flex-1">
|
||||
<WorldGeo
|
||||
currentValue={currentValue}
|
||||
newHomeProxies={newHomeProxies}
|
||||
selectedApp={selectedApp}
|
||||
tooltipType={tooltipType}
|
||||
tooltipClosed={tooltipClosed}
|
||||
setTooltipClosed={setTooltipClosed}
|
||||
/>
|
||||
</div>
|
||||
<div className="absolute bottom-6 left-[50%] translate-x-[-50%] w-[calc(100%-51px)] p-6 bg-indigo-950 bg-opacity-10 rounded-md outline outline-1 outline-zinc-200 outline-opacity-40 backdrop-blur-lg inline-flex justify-start items-center gap-4">
|
||||
<div
|
||||
className="bt1 cursor-pointer"
|
||||
onClick={() => {
|
||||
setTooltipType(CONST_TOOLTIP_TYPE.PASS_AUTHENTICATION.type);
|
||||
}}
|
||||
>
|
||||
通行认证
|
||||
</div>
|
||||
);
|
||||
|
||||
<div
|
||||
className="bt1 cursor-pointer"
|
||||
onClick={() => {
|
||||
setTooltipType(CONST_TOOLTIP_TYPE.NESTED_ENCRYPTION.type);
|
||||
setTooltipClosed(true);
|
||||
}}
|
||||
>
|
||||
嵌套加密
|
||||
</div>
|
||||
<div
|
||||
className="bt1 cursor-pointer"
|
||||
onClick={() => {
|
||||
setTooltipType(CONST_TOOLTIP_TYPE.DYNAMIC_ROUTE_GENERATOR.type);
|
||||
}}
|
||||
>
|
||||
动态路由生成
|
||||
</div>
|
||||
<div
|
||||
className="bt1 cursor-pointer"
|
||||
onClick={() => {
|
||||
setTooltipType(CONST_TOOLTIP_TYPE.TRAFFIC_OBFUSCATION.type);
|
||||
setTooltipClosed(true);
|
||||
}}
|
||||
>
|
||||
流量混淆
|
||||
</div>
|
||||
<div
|
||||
className="bt1 cursor-pointer"
|
||||
onClick={() => {
|
||||
setTooltipType(CONST_TOOLTIP_TYPE.APP_DIVERSION.type);
|
||||
}}
|
||||
>
|
||||
应用分流
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default DecentralizedElasticNetwork;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -9,9 +9,7 @@ import Web3Box2Png from "@/assets/image/home/web3-box2.png";
|
||||
import OpenProxyPng from "@/assets/image/home/open-proxy.png";
|
||||
import web3BoxGif from "@/assets/gif/web3-box-bg.gif";
|
||||
import VectorSlideSvg from "@/assets/svg/home/vector-solide.svg?react";
|
||||
import AddSvg from "@/assets/svg/home/add.svg?react";
|
||||
import InterSvg from "@/assets/svg/home/inter.svg?react";
|
||||
import TrashSvg from "@/assets/svg/home/trash.svg?react";
|
||||
|
||||
|
||||
import { Apps, CONST_TOOLTIP_TYPE } from "@/pages/anti-forensics-forwarding";
|
||||
import { cn } from "@/lib/utils";
|
||||
@ -20,13 +18,13 @@ import {
|
||||
setProxyInfoProxies,
|
||||
setProxiesList1,
|
||||
setProxiesList2,
|
||||
setProxiesLine,
|
||||
} from "@/store/web3Slice";
|
||||
import type { AppDispatch, RootState } from "@/store";
|
||||
import "./index.scss";
|
||||
import { DialogConfig, FormAlertDialog } from "./components/FormAlertDialog";
|
||||
import { ClearNodeDialog } from "./components/ClearNodeDialog";
|
||||
import { blockChainApi } from "@/api/block";
|
||||
import { APP_DIVERSION } from "../anti-forensics-forwarding/data/mockData";
|
||||
|
||||
export const DIALOGTYPE = {
|
||||
ADDNode: {
|
||||
@ -71,12 +69,24 @@ const NewHome = () => {
|
||||
|
||||
const [blockChain, setBlockChain] = useState<any>(null);
|
||||
|
||||
const [tooltipClosed, setTooltipClosed] = useState(false);
|
||||
const [tooltipClosed, setTooltipClosed] = useState(true);
|
||||
|
||||
const [tooltipType, setTooltipType] = useState(
|
||||
CONST_TOOLTIP_TYPE.NESTED_ENCRYPTION.type
|
||||
);
|
||||
|
||||
const appDiversion = useMemo(() => {
|
||||
return Apps.map((item) => {
|
||||
const findApp = APP_DIVERSION.find(
|
||||
(appItem) => item.name === appItem.name
|
||||
);
|
||||
return {
|
||||
...item,
|
||||
...findApp,
|
||||
};
|
||||
});
|
||||
}, []);
|
||||
|
||||
const newWeb3List = useMemo(() => {
|
||||
// 展示最新的6个节点
|
||||
return web3List.slice(-6);
|
||||
@ -102,7 +112,6 @@ const NewHome = () => {
|
||||
};
|
||||
|
||||
const handleClickApp = (item: any) => {
|
||||
console.log("item", item);
|
||||
setSelectedApp(item);
|
||||
};
|
||||
|
||||
@ -178,12 +187,14 @@ const NewHome = () => {
|
||||
console.log("res",res)
|
||||
setBlockChain(res)
|
||||
})
|
||||
|
||||
},[])
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div className="decentralized w-full h-full flex flex-col relative">
|
||||
<div className="box"></div>
|
||||
<div className="text-red-300">{blockChain?.block_id?.hash || "111"}</div>
|
||||
<div className="w-full flex items-center justify-center relative">
|
||||
{/* <img
|
||||
className="w-[1693px] h-[271px] absolute top-[160px] left-[50%] translate-x-[-50%] z-10"
|
||||
@ -307,7 +318,7 @@ const NewHome = () => {
|
||||
</div>
|
||||
<div className="absolute bottom-[10px] left-[50%] translate-x-[-50%] w-[calc(100%-51px)] p-6 inline-flex justify-start items-center gap-10">
|
||||
<img src={OpenProxyPng} className="w-[193px] h-[90px] cursor-pointer" alt="" />
|
||||
<div
|
||||
{/* <div
|
||||
className="bt1 cursor-pointer"
|
||||
onClick={() => {
|
||||
setTooltipType(
|
||||
@ -328,8 +339,8 @@ const NewHome = () => {
|
||||
}}
|
||||
>
|
||||
流量混淆
|
||||
</div>
|
||||
{Apps.map((item) => {
|
||||
</div> */}
|
||||
{appDiversion.map((item) => {
|
||||
return (
|
||||
<div
|
||||
key={item.name}
|
||||
|
||||
@ -2,280 +2,291 @@ import { createSlice } from "@reduxjs/toolkit";
|
||||
import { v4 as uuid } from "uuid";
|
||||
import { data1, data2 } from "./datas";
|
||||
export interface Iweb3 {
|
||||
id?: string;
|
||||
name?: string;
|
||||
payType?: string;
|
||||
status?: string;
|
||||
createdAt?: number;
|
||||
upDatedAt?: number;
|
||||
balance?: number | string;
|
||||
address?: string;
|
||||
privateKey?: string;
|
||||
publicKey?: string;
|
||||
numberTransactions?: string;
|
||||
// 交易次数
|
||||
transactions?: number | string;
|
||||
id?: string;
|
||||
name?: string;
|
||||
payType?: string;
|
||||
status?: string;
|
||||
createdAt?: number;
|
||||
upDatedAt?: number;
|
||||
balance?: number | string;
|
||||
address?: string;
|
||||
privateKey?: string;
|
||||
publicKey?: string;
|
||||
numberTransactions?: string;
|
||||
// 交易次数
|
||||
transactions?: number | string;
|
||||
}
|
||||
|
||||
interface Iweb3Slice {
|
||||
web3List: Iweb3[]; // 代表状态一
|
||||
web3List2: Iweb3[]; // 代表状态二
|
||||
newHomeProxies:any[];
|
||||
path_list: any;
|
||||
proxy_info: any;
|
||||
clearWarningTimer: number | null;
|
||||
clearFailTimer: number | null;
|
||||
isLine: boolean;
|
||||
web3List: Iweb3[]; // 代表状态一
|
||||
web3List2: Iweb3[]; // 代表状态二
|
||||
newHomeProxies: any[];
|
||||
path_list: any;
|
||||
proxy_info: any;
|
||||
clearWarningTimer: number | null;
|
||||
clearFailTimer: number | null;
|
||||
isLine: boolean;
|
||||
}
|
||||
|
||||
// 随机生成 0-100 之间的数字,保留一位小数或整数
|
||||
const randomBalance = (): string => {
|
||||
const value = Math.random() * 100;
|
||||
// 50% 的概率返回整数,50% 的概率返回一位小数
|
||||
return Math.random() > 0.5
|
||||
? Math.floor(value).toString()
|
||||
: value.toFixed(1);
|
||||
const value = Math.random() * 100;
|
||||
// 50% 的概率返回整数,50% 的概率返回一位小数
|
||||
return Math.random() > 0.5 ? Math.floor(value).toString() : value.toFixed(1);
|
||||
};
|
||||
|
||||
// 随机生成 1-60 的整数
|
||||
const randomUpdatedAt = (): number => {
|
||||
return Math.floor(Math.random() * 60) + 1;
|
||||
return Math.floor(Math.random() * 60) + 1;
|
||||
};
|
||||
|
||||
// 随机生成 20-100 的整数
|
||||
const randomTransactionCount = (): string => {
|
||||
return (Math.floor(Math.random() * 100) + 20).toString();
|
||||
return (Math.floor(Math.random() * 100) + 20).toString();
|
||||
};
|
||||
|
||||
// 随机生成20-100的整数
|
||||
const randomTransactionCount2 = (): string => {
|
||||
return (Math.floor(Math.random() * 80) + 20).toString();
|
||||
return (Math.floor(Math.random() * 80) + 20).toString();
|
||||
};
|
||||
|
||||
// 更新钱包数据的函数
|
||||
const updateWalletData = (wallet: Iweb3): Iweb3 => {
|
||||
return {
|
||||
...wallet,
|
||||
balance: randomBalance(),
|
||||
upDatedAt: randomUpdatedAt(),
|
||||
transactions: randomTransactionCount2(),
|
||||
numberTransactions: randomTransactionCount(),
|
||||
};
|
||||
return {
|
||||
...wallet,
|
||||
balance: randomBalance(),
|
||||
upDatedAt: randomUpdatedAt(),
|
||||
transactions: randomTransactionCount2(),
|
||||
numberTransactions: randomTransactionCount(),
|
||||
};
|
||||
};
|
||||
|
||||
const initialState: Iweb3Slice = {
|
||||
isLine: false,
|
||||
web3List: [],
|
||||
web3List2: [
|
||||
isLine: false,
|
||||
web3List: [],
|
||||
web3List2: [
|
||||
{
|
||||
id: "6",
|
||||
name: "Cardano Wallet",
|
||||
payType: "ADA",
|
||||
status: "active",
|
||||
createdAt: 1737436420,
|
||||
upDatedAt: 5,
|
||||
balance: "65",
|
||||
address:
|
||||
"addr1qxck6ztj8lrxd0j2jz8f7tznzfu9wqv9qrplrh3r9eq8g9n0n3anjy2a4x54kd2sort3qvnc7mct82krlnpnxvl7v3sxmrv3f",
|
||||
privateKey:
|
||||
"xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi",
|
||||
publicKey:
|
||||
"addr1qxck6ztj8lrxd0j2jz8f7tznzfu9wqv9qrplrh3r9eq8g9n0n3anjy2a4x54kd2sort3qvnc7mct82krlnpnxvl7v3sxmrv3f",
|
||||
numberTransactions: "35",
|
||||
transactions: 1,
|
||||
},
|
||||
],
|
||||
path_list: [
|
||||
{
|
||||
account: "admin",
|
||||
account_is_admin: true,
|
||||
exclusive: "none",
|
||||
name: "default(10.66.66.234)-c250",
|
||||
proxies: [],
|
||||
proxies_code: [],
|
||||
use: true,
|
||||
current_ip_use: false,
|
||||
},
|
||||
],
|
||||
|
||||
proxy_info: {
|
||||
exclusive: "",
|
||||
name: "default(10.66.66.234)-c250",
|
||||
wg: false,
|
||||
change_time: 0,
|
||||
change_at: 0,
|
||||
proxies: [],
|
||||
},
|
||||
clearWarningTimer: null,
|
||||
clearFailTimer: null,
|
||||
newHomeProxies: [
|
||||
{
|
||||
authenticationPoint: [
|
||||
[-103.346771, 54.130366],
|
||||
[-120.346771, 52.130366],
|
||||
[-108.346771, 48.130366],
|
||||
[-98.346771, 46.130366],
|
||||
[-106.346771, 48.450366],
|
||||
[-101.346771, 53.130366],
|
||||
[-123.346771, 58.130366],
|
||||
[-111.346771, 65.443366],
|
||||
[-108.346771, 54.130366],
|
||||
[-116.346771, 59.130366],
|
||||
[-97.346771, 61.130366],
|
||||
[-95.346771, 63.130366],
|
||||
[-113.346771, 58.840366],
|
||||
[-99.346771, 59.130366],
|
||||
[-102.346771, 68.130366],
|
||||
],
|
||||
data: [
|
||||
{
|
||||
id: "6",
|
||||
country_code: "gl",
|
||||
ingress_country_code: "dz",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "dz",
|
||||
},
|
||||
{
|
||||
country_code: "dz",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "dz",
|
||||
ingress_country_code: "cn",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "za",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "newHomeProxies",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const appSlice = createSlice({
|
||||
name: "web3",
|
||||
initialState,
|
||||
reducers: {
|
||||
setProxiesList1: (state) => {
|
||||
// state.proxy_info.prox
|
||||
// 判断是否已经存在
|
||||
const proxies = state.proxy_info.proxies.find(
|
||||
(item: any) => item.name === "data1"
|
||||
);
|
||||
if (!proxies) {
|
||||
state.proxy_info.proxies.push(data1);
|
||||
}
|
||||
},
|
||||
setProxiesList2: (state) => {
|
||||
// state.proxy_info.prox
|
||||
// 判断是否已经存在
|
||||
const proxies = state.proxy_info.proxies.find(
|
||||
(item: any) => item.name === "data2"
|
||||
);
|
||||
if (!proxies) {
|
||||
state.proxy_info.proxies.push(data2);
|
||||
}
|
||||
},
|
||||
setProxiesLine: (state) => {
|
||||
if (state.proxy_info.proxies.length === 0) return;
|
||||
// 判断一下如果state.proxy_info.proxies.lengt === 2并且 web3List.length ===1 那么 添加一个web3
|
||||
// 如果state.proxy_info.proxies.lengt === 2并且 web3List.length ===2 那么不添加web3
|
||||
// 如果state.proxy_info.proxies.lengt === 1并且 web3List.length ===1 那么添加一个web3
|
||||
// 如果state.proxy_info.proxies.lengt === 2并且 web3List.length ===0 那么添加两个web3
|
||||
// 如果state.proxy_info.proxies.lengt === 1并且 web3List.length ===0 那么添加一个web3
|
||||
|
||||
// 进一步优化的代码
|
||||
if (state.proxy_info.proxies.length === 0) return;
|
||||
|
||||
// 标记所有代理为在线 - 这个操作仍然需要
|
||||
state.proxy_info.proxies = state.proxy_info.proxies.map((item: any) => {
|
||||
item.isLine = true;
|
||||
return item;
|
||||
});
|
||||
|
||||
// 计算需要添加的钱包数量
|
||||
const proxiesCount = state.proxy_info.proxies.length;
|
||||
const currentWeb3Count = state.web3List.length;
|
||||
|
||||
// 检查是否需要添加钱包
|
||||
if (
|
||||
(proxiesCount === 2 && currentWeb3Count >= 2) ||
|
||||
(proxiesCount === 1 && currentWeb3Count >= 1)
|
||||
) {
|
||||
// 已满足条件,不需要任何操作
|
||||
return;
|
||||
}
|
||||
|
||||
// 计算需要添加的钱包数量
|
||||
let walletsToAdd = 0;
|
||||
if (proxiesCount === 2) {
|
||||
walletsToAdd = 2 - currentWeb3Count; // 最多添加到2个
|
||||
} else if (proxiesCount === 1) {
|
||||
walletsToAdd = 1 - currentWeb3Count; // 最多添加到1个
|
||||
}
|
||||
|
||||
// 确保不会添加负数的钱包
|
||||
walletsToAdd = Math.max(0, walletsToAdd);
|
||||
|
||||
// 只有在需要添加钱包时才创建新钱包
|
||||
if (walletsToAdd > 0) {
|
||||
const newWallets: Iweb3[] = [];
|
||||
for (let i = 0; i < walletsToAdd; i++) {
|
||||
const id = uuid();
|
||||
newWallets.push({
|
||||
id,
|
||||
name: "Cardano Wallet",
|
||||
payType: "ADA",
|
||||
status: "active",
|
||||
createdAt: 1737436420,
|
||||
upDatedAt: 5,
|
||||
balance: "65",
|
||||
address:
|
||||
"addr1qxck6ztj8lrxd0j2jz8f7tznzfu9wqv9qrplrh3r9eq8g9n0n3anjy2a4x54kd2sort3qvnc7mct82krlnpnxvl7v3sxmrv3f",
|
||||
privateKey:
|
||||
"xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi",
|
||||
publicKey:
|
||||
"addr1qxck6ztj8lrxd0j2jz8f7tznzfu9wqv9qrplrh3r9eq8g9n0n3anjy2a4x54kd2sort3qvnc7mct82krlnpnxvl7v3sxmrv3f",
|
||||
numberTransactions: "35",
|
||||
transactions: 1,
|
||||
},
|
||||
],
|
||||
path_list: [
|
||||
{
|
||||
account: "admin",
|
||||
account_is_admin: true,
|
||||
exclusive: "none",
|
||||
name: "default(10.66.66.234)-c250",
|
||||
proxies: [],
|
||||
proxies_code: [],
|
||||
use: true,
|
||||
current_ip_use: false,
|
||||
},
|
||||
],
|
||||
balance: randomBalance(),
|
||||
upDatedAt: randomUpdatedAt(),
|
||||
transactions: randomTransactionCount2(),
|
||||
numberTransactions: randomTransactionCount(),
|
||||
});
|
||||
}
|
||||
|
||||
proxy_info: {
|
||||
exclusive: "",
|
||||
name: "default(10.66.66.234)-c250",
|
||||
wg: false,
|
||||
change_time: 0,
|
||||
change_at: 0,
|
||||
proxies: [],
|
||||
// 更新状态
|
||||
state.web3List = [...state.web3List, ...newWallets];
|
||||
console.log(state.web3List, "state.web3List");
|
||||
}
|
||||
},
|
||||
clearWarningTimer: null,
|
||||
clearFailTimer: null,
|
||||
newHomeProxies:[
|
||||
{
|
||||
data: [
|
||||
{
|
||||
country_code: "gl",
|
||||
ingress_country_code: "dz",
|
||||
},
|
||||
{
|
||||
country_code: "br",
|
||||
ingress_country_code: "dz",
|
||||
},
|
||||
{
|
||||
country_code: "dz",
|
||||
ingress_country_code: "ru",
|
||||
},
|
||||
{
|
||||
country_code: "dz",
|
||||
ingress_country_code: "cn",
|
||||
},
|
||||
{
|
||||
country_code: "ru",
|
||||
ingress_country_code: "za",
|
||||
},
|
||||
],
|
||||
isLine: true,
|
||||
name: "newHomeProxies",
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
export const appSlice = createSlice({
|
||||
name: "web3",
|
||||
initialState,
|
||||
reducers: {
|
||||
setProxiesList1: (state) => {
|
||||
// state.proxy_info.prox
|
||||
// 判断是否已经存在
|
||||
const proxies = state.proxy_info.proxies.find(
|
||||
(item: any) => item.name === "data1"
|
||||
);
|
||||
if (!proxies) {
|
||||
state.proxy_info.proxies.push(data1);
|
||||
}
|
||||
},
|
||||
setProxiesList2: (state) => {
|
||||
// state.proxy_info.prox
|
||||
// 判断是否已经存在
|
||||
const proxies = state.proxy_info.proxies.find(
|
||||
(item: any) => item.name === "data2"
|
||||
);
|
||||
if (!proxies) {
|
||||
state.proxy_info.proxies.push(data2);
|
||||
}
|
||||
},
|
||||
setProxiesLine: (state) => {
|
||||
if (state.proxy_info.proxies.length === 0) return;
|
||||
// 判断一下如果state.proxy_info.proxies.lengt === 2并且 web3List.length ===1 那么 添加一个web3
|
||||
// 如果state.proxy_info.proxies.lengt === 2并且 web3List.length ===2 那么不添加web3
|
||||
// 如果state.proxy_info.proxies.lengt === 1并且 web3List.length ===1 那么添加一个web3
|
||||
// 如果state.proxy_info.proxies.lengt === 2并且 web3List.length ===0 那么添加两个web3
|
||||
// 如果state.proxy_info.proxies.lengt === 1并且 web3List.length ===0 那么添加一个web3
|
||||
|
||||
// 进一步优化的代码
|
||||
if (state.proxy_info.proxies.length === 0) return;
|
||||
|
||||
// 标记所有代理为在线 - 这个操作仍然需要
|
||||
state.proxy_info.proxies = state.proxy_info.proxies.map(
|
||||
(item: any) => {
|
||||
item.isLine = true;
|
||||
return item;
|
||||
}
|
||||
);
|
||||
|
||||
// 计算需要添加的钱包数量
|
||||
const proxiesCount = state.proxy_info.proxies.length;
|
||||
const currentWeb3Count = state.web3List.length;
|
||||
|
||||
// 检查是否需要添加钱包
|
||||
if (
|
||||
(proxiesCount === 2 && currentWeb3Count >= 2) ||
|
||||
(proxiesCount === 1 && currentWeb3Count >= 1)
|
||||
) {
|
||||
// 已满足条件,不需要任何操作
|
||||
return;
|
||||
}
|
||||
|
||||
// 计算需要添加的钱包数量
|
||||
let walletsToAdd = 0;
|
||||
if (proxiesCount === 2) {
|
||||
walletsToAdd = 2 - currentWeb3Count; // 最多添加到2个
|
||||
} else if (proxiesCount === 1) {
|
||||
walletsToAdd = 1 - currentWeb3Count; // 最多添加到1个
|
||||
}
|
||||
|
||||
// 确保不会添加负数的钱包
|
||||
walletsToAdd = Math.max(0, walletsToAdd);
|
||||
|
||||
// 只有在需要添加钱包时才创建新钱包
|
||||
if (walletsToAdd > 0) {
|
||||
const newWallets: Iweb3[] = [];
|
||||
for (let i = 0; i < walletsToAdd; i++) {
|
||||
const id = uuid();
|
||||
newWallets.push({
|
||||
id,
|
||||
name: "Cardano Wallet",
|
||||
payType: "ADA",
|
||||
status: "active",
|
||||
createdAt: 1737436420,
|
||||
balance: randomBalance(),
|
||||
upDatedAt: randomUpdatedAt(),
|
||||
transactions: randomTransactionCount2(),
|
||||
numberTransactions: randomTransactionCount(),
|
||||
});
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
state.web3List = [...state.web3List, ...newWallets];
|
||||
console.log(state.web3List, "state.web3List");
|
||||
}
|
||||
},
|
||||
setIsLine: (state, action) => {
|
||||
state.isLine = action.payload;
|
||||
},
|
||||
setClearWarningTimer: (state, action) => {
|
||||
state.clearWarningTimer = action.payload;
|
||||
},
|
||||
setClearFailTimer: (state, action) => {
|
||||
state.clearFailTimer = action.payload;
|
||||
},
|
||||
setWeb3List: (state, action) => {
|
||||
state.web3List = action.payload;
|
||||
},
|
||||
setWeb3List2: (state, action) => {
|
||||
state.web3List2 = action.payload;
|
||||
},
|
||||
setProxyInfoProxies: (state, action) => {
|
||||
state.proxy_info.proxies[0].data.push(action.payload);
|
||||
console.log(action.payload, "action");
|
||||
// state.proxy_info.proxies = action.payload;
|
||||
},
|
||||
randomUpdateWeb3List: (state) => {
|
||||
state.web3List = state.web3List.map((wallet) =>
|
||||
updateWalletData(wallet)
|
||||
);
|
||||
},
|
||||
randomUpdateWeb3List2: (state) => {
|
||||
state.web3List2 = state.web3List2.map((wallet) =>
|
||||
updateWalletData(wallet)
|
||||
);
|
||||
},
|
||||
reset: () => {
|
||||
return initialState;
|
||||
},
|
||||
setIsLine: (state, action) => {
|
||||
state.isLine = action.payload;
|
||||
},
|
||||
setClearWarningTimer: (state, action) => {
|
||||
state.clearWarningTimer = action.payload;
|
||||
},
|
||||
setClearFailTimer: (state, action) => {
|
||||
state.clearFailTimer = action.payload;
|
||||
},
|
||||
setWeb3List: (state, action) => {
|
||||
state.web3List = action.payload;
|
||||
},
|
||||
setWeb3List2: (state, action) => {
|
||||
state.web3List2 = action.payload;
|
||||
},
|
||||
setProxyInfoProxies: (state, action) => {
|
||||
state.proxy_info.proxies[0].data.push(action.payload);
|
||||
console.log(action.payload, "action");
|
||||
// state.proxy_info.proxies = action.payload;
|
||||
},
|
||||
randomUpdateWeb3List: (state) => {
|
||||
state.web3List = state.web3List.map((wallet) => updateWalletData(wallet));
|
||||
},
|
||||
randomUpdateWeb3List2: (state) => {
|
||||
state.web3List2 = state.web3List2.map((wallet) =>
|
||||
updateWalletData(wallet)
|
||||
);
|
||||
},
|
||||
reset: () => {
|
||||
return initialState;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const {
|
||||
setWeb3List,
|
||||
setWeb3List2,
|
||||
setProxyInfoProxies,
|
||||
randomUpdateWeb3List,
|
||||
randomUpdateWeb3List2,
|
||||
setClearWarningTimer,
|
||||
setClearFailTimer,
|
||||
reset,
|
||||
setIsLine,
|
||||
setProxiesList1,
|
||||
setProxiesList2,
|
||||
setProxiesLine,
|
||||
setWeb3List,
|
||||
setWeb3List2,
|
||||
setProxyInfoProxies,
|
||||
randomUpdateWeb3List,
|
||||
randomUpdateWeb3List2,
|
||||
setClearWarningTimer,
|
||||
setClearFailTimer,
|
||||
reset,
|
||||
setIsLine,
|
||||
setProxiesList1,
|
||||
setProxiesList2,
|
||||
setProxiesLine,
|
||||
} = appSlice.actions;
|
||||
export default appSlice.reducer;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user