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(); } }
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(); } }
public void StringTest(string str) { bs.Clear(); bs.Write(str); var result = bs.Read <string>(); Assert.AreEqual(str, result); }
public static string ReadString( VgcApis.Libs.Streams.BitStream bitStream, List <string> strTable) { var lenInBits = VgcApis.Misc.Utils.GetLenInBitsOfInt(strTable.Count); if (bitStream.Read <bool>()) { // using string table var index = bitStream.ReadTinyInt(lenInBits); return(strTable[index]); } else { return(bitStream.Read <string>()); } }
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"; } }