Make TLS work.
This commit is contained in:
parent
55fc4c7260
commit
cb88f3c3b3
|
@ -50,6 +50,7 @@ pub const Client = struct {
|
|||
.cert_verifier = .none,
|
||||
.ciphersuites = tls.ciphersuites.all,
|
||||
}, "quassel.owo.monster");
|
||||
tlsConnected = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,8 +138,8 @@ pub const Client = struct {
|
|||
try s.writeFrame(data);
|
||||
|
||||
var varient = try s.readFrame();
|
||||
tlsAllowed = varient.QVariantMap.get("SupportSsl").?.Byte == 1;
|
||||
prettyPrintQVariant(varient, 0);
|
||||
tlsAllowed = varient.QVariantMap.get("SupportSsl").?.Byte == 1;
|
||||
freeQVariant(varient, s.allocator);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,18 +18,25 @@ pub fn main() !void {
|
|||
|
||||
std.debug.print("host={s} port={d}\n", .{ host, portInt });
|
||||
|
||||
while (true) {
|
||||
var sock = try std.net.tcpConnectToHost(allocator, host, portInt);
|
||||
var client = initClient(allocator, &sock);
|
||||
try client.handshake();
|
||||
try client.quassel_init_packet();
|
||||
try client.quassel_login(username, password);
|
||||
|
||||
while (true) {
|
||||
client.read_quassel_packet() catch |err| {
|
||||
if (err == error.DecodeError) {
|
||||
std.debug.print("Decode Error.\n", .{});
|
||||
} else if (err == error.EndOfStream) {
|
||||
std.debug.print("EOS.\n", .{});
|
||||
std.time.sleep(1000 * std.time.ns_per_ms);
|
||||
continue;
|
||||
} else {
|
||||
return err;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue