예제 #1
0
        private string configGen()
        {
            log.access     = "Vaccess.log";
            log.error      = "Verror.log";
            log.loglevel   = "debug";
            serverInfo.log = log;

            inbound.port     = Convert.ToInt32(upDownPort.Value);
            inbound.protocol = "socks";
            JObject setJson = new JObject();

            setJson["auth"]    = "noauth";
            inbound.settings   = setJson;
            serverInfo.inbound = inbound;

            outbound.protocol = comboBoxProtocol.Text;
            vnext.address     = textBoxHostName.Text;
            vnext.port        = mPort;
            clients.id        = mUUID;
            clients.alterId   = aID;
            JArray  clientsArray = new JArray();
            JObject clientsJson  = JObject.FromObject(clients);

            clientsJson.Remove("level");
            clientsJson["security"] = comboBoxSecurity.Text;
            clientsArray.Add(clientsJson);
            vnext.users = clientsArray;

            JObject vnextSetJson = new JObject();

            vnextSetJson["vnext"] = JArray.Parse(string.Format("[{0}]", JObject.FromObject(vnext).ToString()));
            outbound.settings     = vnextSetJson;

            JObject outJson = JObject.FromObject(outbound);

            if (checkBoxMux.Checked)
            {
                JObject enabled = new JObject();
                enabled["enabled"] = true;
                outJson["mux"]     = enabled;
            }

            serverInfo.outbound = outJson;

            JObject configJson = JObject.FromObject(serverInfo);

            return(MyJson.FormatJsonString(configJson.ToString()));
        }