Ejemplo n.º 1
0
        Tuple <JObject, JToken> VeeToConfig(Models.VeeShareLinks.Vless4b vee)
        {
            if (vee == null)
            {
                return(null);
            }

            var outVmess = cache.tpl.LoadTemplate("outbVeeVmess");

            outVmess["streamSettings"] = Comm.GenStreamSetting(cache, vee);

            outVmess["protocol"] = "vless";
            var node = outVmess["settings"]["vnext"][0];

            node["address"]                = vee.address;
            node["port"]                   = vee.port;
            node["users"][0]["id"]         = vee.uuid;
            node["users"][0]["flow"]       = vee.flow;
            node["users"][0]["encryption"] = vee.encryption;
            var tpl = cache.tpl.LoadTemplate("tplImportVmess") as JObject;

            tpl["v2raygcon"]["alias"]       = vee.alias;
            tpl["v2raygcon"]["description"] = vee.description;
            return(new Tuple <JObject, JToken>(tpl, outVmess));
        }
Ejemplo n.º 2
0
        public byte[] VeeConfig2Bytes(Models.Datas.VeeConfigs veeConfig)
        {
            var vee = new Models.VeeShareLinks.Vless4b();

            vee.CopyFromVeeConfig(veeConfig);
            return(vee.ToBytes());
        }
Ejemplo n.º 3
0
        Models.VeeShareLinks.Vless4b Config2Vee(JObject config)
        {
            var bs = Comm.ExtractBasicConfig(config, @"vless", @"vnext", out bool isUseV4, out string root);

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

            var GetStr         = Misc.Utils.GetStringByPrefixAndKeyHelper(config);
            var vless          = new Models.VeeShareLinks.Vless4b(bs);
            var userInfoPrefix = root + ".settings.vnext.0.users.0";
            var enc            = GetStr(userInfoPrefix, "encryption");

            vless.encryption = string.IsNullOrEmpty(enc) ? "none" : enc;
            vless.uuid       = Guid.Parse(GetStr(userInfoPrefix, "id"));
            vless.flow       = GetStr(userInfoPrefix, "flow");
            return(vless);
        }
Ejemplo n.º 4
0
        public Tuple <JObject, JToken> Bytes2Config(byte[] bytes)
        {
            var veeLink = new Models.VeeShareLinks.Vless4b(bytes);

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

            return(vee.ToVeeConfigs());
        }