Exemplo n.º 1
0
        public Ss1a(byte[] bytes) :
            this()
        {
            var ver = VgcApis.Libs.Streams.BitStream.ReadVersion(bytes);

            if (ver != version)
            {
                throw new NotSupportedException(
                          $"Not supported version ${ver}");
            }

            using (var bs = new VgcApis.Libs.Streams.BitStream(bytes))
            {
                var readString = Utils.GenReadStringHelper(bs, strTable);

                alias       = bs.Read <string>();
                description = readString();

                address     = bs.ReadAddress();
                port        = bs.Read <int>();
                password    = bs.Read <string>();
                method      = readString();
                networkType = bs.ReadTinyInt(networkTypeLenInBits);
                isUseOta    = bs.Read <bool>();

                isUseTls     = bs.Read <bool>();
                streamType   = readString();
                streamParam1 = readString();
                streamParam2 = readString();
                streamParam3 = readString();
            }
        }
Exemplo n.º 2
0
        public Socks2a(byte[] bytes) :
            this()
        {
            var ver = VgcApis.Libs.Streams.BitStream.ReadVersion(bytes);

            if (ver != version)
            {
                throw new NotSupportedException($"Not supported version ${ver}");
            }

            using (var bs = new VgcApis.Libs.Streams.BitStream(bytes))
            {
                var readString = Utils.GenReadStringHelper(bs, strTable);

                alias        = bs.Read <string>();
                description  = readString();
                isUseTls     = bs.Read <bool>();
                isSecTls     = bs.Read <bool>();
                port         = bs.Read <int>();
                address      = bs.ReadAddress();
                userName     = readString();
                userPassword = readString();
                streamType   = readString();
                streamParam1 = readString();
                streamParam2 = readString();
                streamParam3 = readString();
            }
        }
Exemplo n.º 3
0
        public Vless4a(byte[] bytes) :
            this()
        {
            var ver = VgcApis.Libs.Streams.BitStream.ReadVersion(bytes);

            if (ver != version)
            {
                throw new NotSupportedException($"Not supported version ${ver}");
            }

            using (var bs = new VgcApis.Libs.Streams.BitStream(bytes))
            {
                var readString = Utils.GenReadStringHelper(bs, strTable);

                alias        = bs.Read <string>();
                description  = readString();
                isUseTls     = bs.Read <bool>();
                isSecTls     = bs.Read <bool>();
                port         = bs.Read <int>();
                encryption   = bs.Read <string>();
                uuid         = bs.Read <Guid>();
                address      = bs.ReadAddress();
                streamType   = readString();
                streamParam1 = readString();
                streamParam2 = readString();
                streamParam3 = readString();
            }

            if (string.IsNullOrEmpty(encryption))
            {
                encryption = "none";
            }
        }
Exemplo n.º 4
0
        public void AddressTest(string str)
        {
            bs.Clear();
            bs.WriteAddress(str);
            var result = bs.ReadAddress();

            Assert.AreEqual(str, result);
        }