package io.wdd.func.xray.beans.config;

import io.wdd.func.xray.beans.xray.transport.HttpHeaderObject;
import io.wdd.func.xray.beans.xray.transport.InboundObject;
import io.wdd.func.xray.beans.xray.transport.StreamSettingsObject;
import io.wdd.func.xray.beans.xray.transport.TcpObject;
import io.wdd.func.xray.beans.xray.protocol.inbound.vmess.VMESS;

import static io.wdd.func.xray.beans.config.TcpHttpHeaderTemplate.HttpResponseTemplate;

public class InboundVmessHTTPTemplateClass {

    public static InboundObject InboundVmessHTTPTemplate;

    public static final String ListenAddress = "0.0.0.0";

    static {

        InboundVmessHTTPTemplate = new VMESS();

        // 构建 settings- vmess-tcp-http的对象
        TcpObject tcpObject = new TcpObject();

        // 构建RequestHttp属性对象
        HttpHeaderObject httpHeaderObject = new HttpHeaderObject();
//        httpHeaderObject.setRequest(HttpRequestTemplate);
        // 服务端接收VMESS才是用Response
        httpHeaderObject.setResponse(HttpResponseTemplate);

        tcpObject.setHeader(httpHeaderObject);

        // 设置 settings属性
        StreamSettingsObject streamSettingsObject = new StreamSettingsObject();
        streamSettingsObject.setTcpSettings(tcpObject);
        InboundVmessHTTPTemplate.setStreamSettings(streamSettingsObject);

    }
}
