Esempio n. 1
0
        public byte[] VeeConfig2Bytes(Models.Datas.VeeConfigs veeConfig)
        {
            var vee = new Models.VeeShareLinks.Ss1c();

            vee.CopyFromVeeConfig(veeConfig);
            return(vee.ToBytes());
        }
Esempio n. 2
0
        Models.VeeShareLinks.Ss1c Config2Vee(JObject config)
        {
            var bs = Comm.ExtractBasicConfig(config, @"shadowsocks", @"servers", out bool isUseV4, out string root);

            if (bs == null)
            {
                return(null);
            }

            var GetStr = Misc.Utils.GetStringByPrefixAndKeyHelper(config);
            var vmess  = new Models.VeeShareLinks.Ss1c(bs);

            var prefix = root + "." + "settings.servers.0";

            vmess.method   = GetStr(prefix, "method");
            vmess.password = GetStr(prefix, "password");
            return(vmess);
        }
Esempio n. 3
0
        Tuple <JObject, JToken> VeeToConfig(Models.VeeShareLinks.Ss1c vee)
        {
            if (vee == null)
            {
                return(null);
            }

            var outbSs = cache.tpl.LoadTemplate("outbVeeSs");

            outbSs["streamSettings"] = Comm.GenStreamSetting(cache, vee);
            var node = outbSs["settings"]["servers"][0];

            node["address"]  = vee.address;
            node["port"]     = vee.port;
            node["method"]   = string.IsNullOrEmpty(vee.method) ? "none" : vee.method;
            node["password"] = vee.password;

            var tpl = cache.tpl.LoadTemplate("tplImportSS") as JObject;

            tpl["v2raygcon"]["alias"]       = vee.alias;
            tpl["v2raygcon"]["description"] = vee.description;
            return(new Tuple <JObject, JToken>(tpl, outbSs));
        }
Esempio n. 4
0
        public Tuple <JObject, JToken> Bytes2Config(byte[] bytes)
        {
            var veeLink = new Models.VeeShareLinks.Ss1c(bytes);

            return(VeeToConfig(veeLink));
        }
Esempio n. 5
0
        public Models.Datas.VeeConfigs Bytes2VeeConfig(byte[] bytes)
        {
            var vee = new Models.VeeShareLinks.Ss1c(bytes);

            return(vee.ToVeeConfigs());
        }