1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const std = @import("std");
const fetched_car = @import("internal/ingest/backfill/fetched_car.zig");
pub fn main(init: std.process.Init) !void {
const allocator = init.gpa;
const io = init.io;
for ([_][]const u8{
"https://dv-g3b-emudhra.we-have-a-problem.com",
"https://dv-g3b-aaa-emudhra.we-have-a-problem.com",
"https://emudhra.divy.zone",
"https://atproto.com",
}, 0..) |url, index| {
var host: fetched_car.FinalHost = .{};
var outcome = fetched_car.fetchOnce(allocator, io, "/tmp/stream-tls-probe", url, "did:plc:tlsprobe", &host) catch |err| {
if (index == 3 or (err != error.TlsCertificateNotVerified and err != error.TlsInitializationFailed)) return err;
std.debug.print("{s}: TLS rejected ({s})\n", .{ url, @errorName(err) });
continue;
};
if (outcome == .ok) outcome.ok.deinit(io);
if (index != 3) return error.CompromisedCertificateAccepted;
std.debug.print("{s}: valid control accepted\n", .{url});
}
}