package io.wdd.func.xray.persisit.cache;

import io.wdd.func.xray.beans.node.ProxyNode;

import java.util.HashMap;

public class ProxyNodeCache {

    /**
     * 保存 AgentName - ProxyNode 的全局缓存
     */
    public static final HashMap<String, ProxyNode> PROXY_NODE_MAP = new HashMap<>();

    /**
     * 保存 AgentTopicName - ProxyNode 的全局缓存
     */
    public static final HashMap<String, ProxyNode> PROXY_NODE_TOPIC_NAME_MAP = new HashMap<>();


    public static final HashMap<Integer, ProxyNode> PROXY_NODE_INDEX_MAP = new HashMap<>();

    /**
     * 订阅信息的虚拟节点，用于存储订阅内容的信息
     */
    public static final String SUBSCRIBE_NODE_NAME = "SUBSCRIBE";

    private static ProxyNode chengdu;
    private static ProxyNode shanghai;
    private static ProxyNode hongkong;
    private static ProxyNode seoul2;
    private static ProxyNode tokyo2;
    private static ProxyNode phoenix2;
    private static ProxyNode london2;


    private static ProxyNode chengduAgent;
    private static ProxyNode tokyoDev;
    private static ProxyNode seoul5;


    /*static {

        chengdu = ProxyNode
                .builder()
                .location("Chengdu")
                .num(0)
                .publicIPv4("43.136.177.228")
                .proxyNodeType(ProxyNodeType.INTERFACE)
                .name("cd-agent")
                .agentName("Chengdu-amd-01")
                .build();


        shanghai = ProxyNode
                .builder()
                .location("Shanghai")
                .num(1)
                .publicIPv4("42.192.52.227")
                .proxyNodeType(ProxyNodeType.RELAY)
                .name("tc-sh")
                .agentName("Shanghai-amd64-01")
                .build();

        hongkong = ProxyNode
                .builder()
                .location("Hongkong")
                .num(2)
                .publicIPv4("43.154.83.213")
                .proxyNodeType(ProxyNodeType.EXTERNAL)
                .name("tc-hk")
                .agentName("Hongkong-amd64-01")
                .build();


        seoul2 = ProxyNode
                .builder()
                .location("Seoul")
                .num(3)
                .publicIPv4("140.238.30.110")
                .proxyNodeType(ProxyNodeType.EXTERNAL)
                .name("seoul-2")
                .agentName("Seoul-amd64-02")
                .build();


        tokyo2 = ProxyNode
                .builder()
                .location("Tokyo")
                .num(4)
                .publicIPv4("140.238.52.228")
                .proxyNodeType(ProxyNodeType.EXTERNAL)
                .name("tokyo-2")
                .agentName("Tokyo-amd64-02")
                .build();

        phoenix2 = ProxyNode
                .builder()
                .location("Phoenix")
                .num(5)
                .publicIPv4("129.146.171.163")
                .proxyNodeType(ProxyNodeType.EXTERNAL)
                .name("phoenix-2")
                .agentName("Phoenix-amd64-02")
                .build();

        london2 = ProxyNode
                .builder()
                .location("London")
                .num(6)
                .publicIPv4("141.147.106.62")
                .proxyNodeType(ProxyNodeType.EXTERNAL)
                .name("london-2")
                .agentName("London-amd64-02")
                .build();

        tokyoDev = ProxyNode
                .builder()
                .location("Tokyo")
                .num(99)
                .publicIPv4("34.146.3.239")
                .proxyNodeType(ProxyNodeType.EXTERNAL)
                .name("tokyo-07")
                .agentName("Tokyo-amd64-07")
                .agentTopicName("Tokyo-amd64-07-f66a41")
                .build();


        chengduAgent = ProxyNode
                .builder()
                .location("Chengdu")
                .num(90)
                .publicIPv4("183.220.9.13")
                .proxyNodeType(ProxyNodeType.EXTERNAL)
                .name("chengdu-agent")
                .agentName("Chengdu-amd64-77")
                .agentTopicName("Chengdu-amd64-77-remote")
                .build();


        seoul5 = ProxyNode
                .builder()
                .location("Seoul")
                .num(97)
                .publicIPv4("146.56.159.175")
                .proxyNodeType(ProxyNodeType.EXTERNAL)
                .name("oracle-seoul5")
                .agentName("Seoul-arm64-02")
                .agentTopicName("Seoul-arm64-02-oracle")
                .build();

        PROXY_NODE_INDEX_MAP.put(
                chengdu.getNum(),
                chengdu
        );
        PROXY_NODE_INDEX_MAP.put(
                hongkong.getNum(),
                hongkong
        );
        PROXY_NODE_INDEX_MAP.put(
                shanghai.getNum(),
                shanghai
        );
        PROXY_NODE_INDEX_MAP.put(
                seoul2.getNum(),
                seoul2
        );
        PROXY_NODE_INDEX_MAP.put(
                tokyo2.getNum(),
                tokyo2
        );
        PROXY_NODE_INDEX_MAP.put(
                phoenix2.getNum(),
                phoenix2
        );
        PROXY_NODE_INDEX_MAP.put(
                london2.getNum(),
                london2
        );
        PROXY_NODE_INDEX_MAP.put(
                chengduAgent.getNum(),
                chengduAgent
        );
        PROXY_NODE_INDEX_MAP.put(
                tokyoDev.getNum(),
                tokyoDev
        );
        PROXY_NODE_INDEX_MAP.put(
                seoul5.getNum(),
                seoul5
        );

    }*/

}
