-
{blockChain?.block_id?.hash || "111"}
{/*
![]()
{

-
{
setTooltipType(
@@ -328,8 +339,8 @@ const NewHome = () => {
}}
>
流量混淆
-
- {Apps.map((item) => {
+
*/}
+ {appDiversion.map((item) => {
return (
{
- 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;