Repository navigation
Expand file tree
/
Copy pathbuild.zig
More file actions
2256 lines (2079 loc) · 94.3 KB
/
Copy pathbuild.zig
File metadata and controls
2256 lines (2079 loc) · 94.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
const std = @import("std");
const builtin = @import("builtin");
const required_zig_version = "0.16.0";
// Build script for the current Zig stable template.
// - Builds the current example executables.
// - Uses src/lib.zig as a shared module imported by both executables.
pub fn build(b: *std.Build) void {
// Keep build semantics tied to the Zig version this repository is tested with.
comptime {
if (!std.mem.eql(u8, builtin.zig_version_string, required_zig_version)) {
@compileError("quicz requires Zig " ++ required_zig_version ++ "; found " ++ builtin.zig_version_string);
}
}
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Shared quicz module (library logic lives in src/lib.zig).
// link_libc: the library uses std.c / std.heap.c_allocator (fuzz targets,
// tests) and needs libc for clock/malloc on Linux; macOS links it by default.
// This is a system library, not a C-code dependency.
const quicz_mod = b.addModule("quicz", .{
.root_source_file = b.path("src/lib.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
// Shared loopback identity (DER cert + P-256 key) used by examples and
// downstream tools such as the CLI package.
const quicz_test_cert_mod = b.addModule("quicz-test-cert", .{
.root_source_file = b.path("examples/test_certs.zig"),
.target = target,
.optimize = optimize,
});
// Disposable Mons runtime probe. The override preserves a pristine baseline.
const mvp_source = b.option([]const u8, "mvp-quicz-source", "Local baseline source for the disposable Mons NAT probe");
const mvp_quicz = b.createModule(.{
.root_source_file = if (mvp_source) |root| .{ .cwd_relative = b.pathJoin(&.{ root, "src/lib.zig" }) } else b.path("src/lib.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
const mons_nat_mvp = b.addExecutable(.{
.name = "mons-nat-mvp",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/mons_nat_mvp.zig"),
.target = target,
.optimize = optimize,
.imports = &.{.{ .name = "quicz", .module = mvp_quicz }},
}),
});
b.step("build-mons-nat-mvp", "Build the disposable Mons NAT rebinding probe")
.dependOn(&b.addInstallArtifact(mons_nat_mvp, .{}).step);
// Benchmark executables must measure production-like throughput, so force
// ReleaseFast instead of inheriting the default (Debug) optimize. Without
// this, `zig build bench-suite` reports misleadingly low numbers (~50 MB/s
// Debug vs ~470 MB/s ReleaseFast).
const quicz_bench_mod = b.addModule("quicz_bench", .{
.root_source_file = b.path("src/lib.zig"),
.target = target,
.optimize = .ReleaseFast,
});
const lib = b.addLibrary(.{
.name = "quicz",
.root_module = quicz_mod,
});
b.installArtifact(lib);
const mobile_abi_mod = b.createModule(.{
.root_source_file = b.path("src/mobile_abi.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
});
const mobile_abi_lib = b.addLibrary(.{
.name = "quicz_mobile",
.root_module = mobile_abi_mod,
});
const install_mobile_abi = b.addInstallArtifact(mobile_abi_lib, .{});
const install_mobile_header = b.addInstallFileWithDir(
b.path("include/quicz_mobile.h"),
.header,
"quicz_mobile.h",
);
const mobile_abi_step = b.step("mobile-static", "Build the mobile C ABI static library and header");
mobile_abi_step.dependOn(&install_mobile_abi.step);
mobile_abi_step.dependOn(&install_mobile_header.step);
const shared_socket_connectivity = b.addExecutable(.{
.name = "quicz-shared-socket-connectivity-loopback",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/shared_socket_connectivity_loopback.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
const run_shared_socket_connectivity = b.step(
"run-shared-socket-connectivity-loopback",
"Run STUN discovery and QUIC on one client UDP socket",
);
run_shared_socket_connectivity.dependOn(&b.addRunArtifact(shared_socket_connectivity).step);
const mobile_abi_loopback = b.addExecutable(.{
.name = "quicz-mobile-abi-loopback",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/mobile_abi_loopback.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
.{ .name = "quicz_mobile", .module = mobile_abi_mod },
},
}),
});
const run_mobile_abi_loopback = b.step(
"run-mobile-abi-loopback",
"Run the blocking mobile C ABI against the native QUIC server",
);
run_mobile_abi_loopback.dependOn(&b.addRunArtifact(mobile_abi_loopback).step);
const mobile_ipv6_header = b.addTranslateC(.{
.root_source_file = b.path("include/quicz_mobile.h"),
.target = target,
.optimize = optimize,
});
const mobile_ipv6_abi_loopback = b.addExecutable(.{
.name = "quicz-mobile-ipv6-abi-loopback",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/mobile_ipv6_abi_loopback.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
.{ .name = "quicz_mobile", .module = mobile_abi_mod },
.{ .name = "quicz_mobile_c", .module = mobile_ipv6_header.createModule() },
},
}),
});
b.step("build-mobile-ipv6-abi-loopback", "Compile native IPv6 C ABI layout and loopback checks")
.dependOn(&mobile_ipv6_abi_loopback.step);
b.step("run-mobile-ipv6-abi-loopback", "Verify native IPv6 STUN, authenticated punch, TLS and stream through the C ABI")
.dependOn(&b.addRunArtifact(mobile_ipv6_abi_loopback).step);
const mobile_deadline_regression = b.addExecutable(.{
.name = "quicz-mobile-deadline-regression",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/mobile_deadline_regression.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
.{ .name = "quicz_mobile", .module = mobile_abi_mod },
},
}),
});
b.step("run-mobile-deadline-regression", "Check hosted C ABI deadline and cleanup latency")
.dependOn(&b.addRunArtifact(mobile_deadline_regression).step);
const p2p_quic_loopback = b.addExecutable(.{
.name = "quicz-p2p-quic-loopback",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/p2p_quic_loopback.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
const run_p2p_quic_loopback = b.step(
"run-p2p-quic-loopback",
"Run authenticated UDP probing and verified QUIC on the same sockets",
);
run_p2p_quic_loopback.dependOn(&b.addRunArtifact(p2p_quic_loopback).step);
const mobile_latency_server = b.addExecutable(.{
.name = "quicz-mobile-latency-server",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/mobile_latency_server.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
const run_mobile_latency_server = b.step(
"run-mobile-latency-server",
"Run the QUIC echo server for iOS latency measurements",
);
const run_mobile_latency_server_command = b.addRunArtifact(mobile_latency_server);
if (b.args) |args| run_mobile_latency_server_command.addArgs(args);
run_mobile_latency_server.dependOn(&run_mobile_latency_server_command.step);
// Echo server executable
const exe_server = b.addExecutable(.{
.name = "quicz-echo-server",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/echo_server.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_server);
// Echo client executable
const exe_client = b.addExecutable(.{
.name = "quicz-echo-client",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/echo_client.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_client);
const exe_tls13_process_echo_server = b.addExecutable(.{
.name = "quicz-tls13-process-echo-server",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/tls13_process_echo_server.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_tls13_process_echo_server);
const exe_tls13_process_echo_client = b.addExecutable(.{
.name = "quicz-tls13-process-echo-client",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/tls13_process_echo_client.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_tls13_process_echo_client);
// QUIC echo server/client (practical examples)
const exe_quic_echo_server = b.addExecutable(.{
.name = "quicz-quic-echo-server",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/quic_echo_server.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_quic_echo_server);
const run_quic_echo_server = b.step("run-quic-echo-server", "Run QUIC echo server on 127.0.0.1:4433");
const run_quic_echo_server_cmd = b.addRunArtifact(exe_quic_echo_server);
run_quic_echo_server.dependOn(&run_quic_echo_server_cmd.step);
const exe_quic_echo_client = b.addExecutable(.{
.name = "quicz-quic-echo-client",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/quic_echo_client.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_quic_echo_client);
const run_quic_echo_client = b.step("run-quic-echo-client", "Run QUIC echo client (connects to 127.0.0.1:4433)");
const run_quic_echo_client_cmd = b.addRunArtifact(exe_quic_echo_client);
run_quic_echo_client.dependOn(&run_quic_echo_client_cmd.step);
// Connection migration demo
const exe_connection_migration = b.addExecutable(.{
.name = "quicz-connection-migration",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/connection_migration.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_connection_migration);
const run_connection_migration = b.step("run-connection-migration", "Run QUIC connection migration demo (PATH_CHALLENGE/RESPONSE)");
const run_connection_migration_cmd = b.addRunArtifact(exe_connection_migration);
run_connection_migration.dependOn(&run_connection_migration_cmd.step);
// H3 server on the production runtime (runtime.Server.serveH3)
const exe_h3_server = b.addExecutable(.{
.name = "quicz-h3-server",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/h3_server.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_h3_server);
const run_h3_server = b.step("run-h3-server", "Run HTTP/3 static file server on 127.0.0.1:4433");
const run_h3_server_cmd = b.addRunArtifact(exe_h3_server);
run_h3_server.dependOn(&run_h3_server_cmd.step);
// Cookie-jar demo HTTP/3 server (Set-Cookie + redirect + cookie echo)
const exe_h3_cookie_server = b.addExecutable(.{
.name = "quicz-h3-cookie-server",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/h3_cookie_server.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_h3_cookie_server);
const run_h3_cookie_server = b.step("run-h3-cookie-server", "Run HTTP/3 cookie demo server on 127.0.0.1:4434");
const run_h3_cookie_server_cmd = b.addRunArtifact(exe_h3_cookie_server);
run_h3_cookie_server.dependOn(&run_h3_cookie_server_cmd.step);
// DATAGRAM echo (RFC 9221)
const exe_datagram_echo = b.addExecutable(.{
.name = "quicz-datagram-echo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/datagram_echo.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_datagram_echo);
const run_datagram_echo = b.step("run-datagram-echo", "Run QUIC DATAGRAM echo (--server or --client)");
const run_datagram_echo_cmd = b.addRunArtifact(exe_datagram_echo);
run_datagram_echo.dependOn(&run_datagram_echo_cmd.step);
// Post-quantum echo
const exe_post_quantum_echo = b.addExecutable(.{
.name = "quicz-post-quantum-echo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/post_quantum_echo.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_post_quantum_echo);
const run_post_quantum_echo = b.step("run-post-quantum-echo", "Run X25519Kyber768 post-quantum echo (--server or --client)");
const run_post_quantum_echo_cmd = b.addRunArtifact(exe_post_quantum_echo);
run_post_quantum_echo.dependOn(&run_post_quantum_echo_cmd.step);
// 0-RTT echo
const exe_zero_rtt_echo = b.addExecutable(.{
.name = "quicz-zero-rtt-echo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/zero_rtt_echo.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_zero_rtt_echo);
const run_zero_rtt_echo = b.step("run-zero-rtt-echo", "Run 0-RTT session resumption echo demo");
const run_zero_rtt_echo_cmd = b.addRunArtifact(exe_zero_rtt_echo);
run_zero_rtt_echo.dependOn(&run_zero_rtt_echo_cmd.step);
// Congestion control benchmark
const exe_congestion_bench = b.addExecutable(.{
.name = "quicz-congestion-bench",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/congestion_bench.zig"),
.target = target,
.optimize = .ReleaseFast,
.imports = &.{
.{ .name = "quicz", .module = quicz_bench_mod },
},
}),
});
b.installArtifact(exe_congestion_bench);
const run_congestion_bench = b.step("run-congestion-bench", "Run congestion control comparison benchmark (NewReno/CUBIC)");
const run_congestion_bench_cmd = b.addRunArtifact(exe_congestion_bench);
run_congestion_bench.dependOn(&run_congestion_bench_cmd.step);
const exe_quic_bench = b.addExecutable(.{
.name = "quicz-quic-bench",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/quic_bench.zig"),
.target = target,
.optimize = .ReleaseFast,
.imports = &.{
.{ .name = "quicz", .module = quicz_bench_mod },
},
}),
});
b.installArtifact(exe_quic_bench);
const run_quic_bench = b.step("run-quic-bench", "Run QUIC transport micro-benchmark (throughput + latency)");
const run_quic_bench_cmd = b.addRunArtifact(exe_quic_bench);
run_quic_bench.dependOn(&run_quic_bench_cmd.step);
const exe_quic_bench_hs = b.addExecutable(.{
.name = "quicz-quic-bench-hs",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/quic_bench_hs.zig"),
.target = target,
.optimize = .ReleaseFast,
.imports = &.{
.{ .name = "quicz", .module = quicz_bench_mod },
},
}),
});
b.installArtifact(exe_quic_bench_hs);
const run_quic_bench_hs = b.step("run-quic-bench-hs", "Run QUIC benchmark with real TLS 1.3 handshakes (throughput + latency)");
const run_quic_bench_hs_cmd = b.addRunArtifact(exe_quic_bench_hs);
run_quic_bench_hs.dependOn(&run_quic_bench_hs_cmd.step);
const exe_quic_bench_simple = b.addExecutable(.{
.name = "quicz-quic-bench-simple",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/quic_bench_simple.zig"),
.target = target,
.optimize = .ReleaseFast,
.imports = &.{
.{ .name = "quicz", .module = quicz_bench_mod },
},
}),
});
b.installArtifact(exe_quic_bench_simple);
const run_quic_bench_simple = b.step("run-quic-bench-simple", "Run single-threaded raw QUIC processing benchmark");
const run_quic_bench_simple_cmd = b.addRunArtifact(exe_quic_bench_simple);
run_quic_bench_simple.dependOn(&run_quic_bench_simple_cmd.step);
const exe_quic_bench_datagram = b.addExecutable(.{
.name = "quicz-quic-bench-datagram",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/quic_bench_datagram.zig"),
.target = target,
.optimize = .ReleaseFast,
.imports = &.{
.{ .name = "quicz", .module = quicz_bench_mod },
},
}),
});
b.installArtifact(exe_quic_bench_datagram);
const run_quic_bench_datagram = b.step("run-quic-bench-datagram", "Run RFC 9221 DATAGRAM throughput benchmark");
const run_quic_bench_datagram_cmd = b.addRunArtifact(exe_quic_bench_datagram);
run_quic_bench_datagram.dependOn(&run_quic_bench_datagram_cmd.step);
const exe_quic_bench_profile = b.addExecutable(.{
.name = "quicz-quic-bench-profile",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/quic_bench_profile.zig"),
.target = target,
.optimize = .ReleaseFast,
.imports = &.{
.{ .name = "quicz", .module = quicz_bench_mod },
},
}),
});
b.installArtifact(exe_quic_bench_profile);
const run_quic_bench_profile = b.step("run-quic-bench-profile", "Run per-phase QUIC profiling benchmark");
const run_quic_bench_profile_cmd = b.addRunArtifact(exe_quic_bench_profile);
run_quic_bench_profile.dependOn(&run_quic_bench_profile_cmd.step);
// Standardized benchmark suite: build + run every benchmark in fixed order.
const bench_suite = b.step("bench-suite", "Run the full standardized benchmark suite");
bench_suite.dependOn(&run_quic_bench_cmd.step);
bench_suite.dependOn(&run_quic_bench_hs_cmd.step);
bench_suite.dependOn(&run_quic_bench_simple_cmd.step);
bench_suite.dependOn(&run_quic_bench_datagram_cmd.step);
bench_suite.dependOn(&run_quic_bench_profile_cmd.step);
bench_suite.dependOn(&run_congestion_bench_cmd.step);
// I/O runtime - async streaming echo (std.Io)
const exe_io_echo = b.addExecutable(.{
.name = "quicz-io-echo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/io_echo.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_io_echo);
const run_io_echo = b.step("run-io-echo", "Run I/O runtime async streaming echo demo");
const run_io_echo_cmd = b.addRunArtifact(exe_io_echo);
run_io_echo.dependOn(&run_io_echo_cmd.step);
// I/O runtime - multi-connection test (std.http model)
const exe_multi_conn = b.addExecutable(.{
.name = "quicz-multi-conn-test",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/multi_conn_test.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_multi_conn);
const run_multi_conn = b.step("run-multi-conn-test", "Run I/O runtime multi-connection echo test");
const run_multi_conn_cmd = b.addRunArtifact(exe_multi_conn);
run_multi_conn.dependOn(&run_multi_conn_cmd.step);
const exe_interop_external_client = b.addExecutable(.{
.name = "quicz-interop-external-client",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/interop_external_client.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_interop_external_client);
// Runtime-based interop client (validates production API path)
const exe_interop_runtime_client = b.addExecutable(.{
.name = "quicz-interop-runtime-client",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/interop_runtime_client.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_interop_runtime_client);
const run_interop_runtime_client = b.step("run-interop-runtime-client", "Run runtime-based interop client");
const run_interop_runtime_client_cmd = b.addRunArtifact(exe_interop_runtime_client);
run_interop_runtime_client.dependOn(&run_interop_runtime_client_cmd.step);
if (b.args) |args| {
run_interop_runtime_client_cmd.addArgs(args);
}
// Runtime-based interop server (validates production API path)
const exe_interop_runtime_server = b.addExecutable(.{
.name = "quicz-interop-runtime-server",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/interop_runtime_server.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_interop_runtime_server);
const run_interop_runtime_server = b.step("run-interop-runtime-server", "Run runtime-based interop server");
const run_interop_runtime_server_cmd = b.addRunArtifact(exe_interop_runtime_server);
run_interop_runtime_server.dependOn(&run_interop_runtime_server_cmd.step);
if (b.args) |args| {
run_interop_runtime_server_cmd.addArgs(args);
}
// zig build run-fuzz — run the fuzz harness
const exe_fuzz = b.addExecutable(.{
.name = "quicz-fuzz",
.root_module = b.createModule(.{
.root_source_file = b.path("fuzz.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_fuzz);
const run_fuzz = b.step("run-fuzz", "Run QUIC fuzz harness");
const run_fuzz_cmd = b.addRunArtifact(exe_fuzz);
run_fuzz.dependOn(&run_fuzz_cmd.step);
if (b.args) |args| {
run_fuzz_cmd.addArgs(args);
}
// Codec roundtrip executable
const exe_codec = b.addExecutable(.{
.name = "quicz-codec-roundtrip",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/codec_roundtrip.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_codec);
// Transport parameters executable
const exe_transport_parameters = b.addExecutable(.{
.name = "quicz-transport-parameters",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/transport_parameters.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_transport_parameters);
// Flow-control executable
const exe_flow_control = b.addExecutable(.{
.name = "quicz-flow-control",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/flow_control.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_flow_control);
// Unidirectional stream executable
const exe_uni_stream = b.addExecutable(.{
.name = "quicz-uni-stream",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/uni_stream.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_uni_stream);
// Stream reset executable
const exe_stream_reset = b.addExecutable(.{
.name = "quicz-stream-reset",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/stream_reset.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_stream_reset);
// STOP_SENDING executable
const exe_stop_sending = b.addExecutable(.{
.name = "quicz-stop-sending",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/stop_sending.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_stop_sending);
// Crypto stream executable
const exe_crypto_stream = b.addExecutable(.{
.name = "quicz-crypto-stream",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/crypto_stream.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_crypto_stream);
// TLS backend adapter executable
const exe_tls_backend_adapter = b.addExecutable(.{
.name = "quicz-tls-backend-adapter",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/tls_backend_adapter.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_tls_backend_adapter);
// Pure-Zig TLS 1.3 backend loopback executable
const exe_tls13_backend_loopback = b.addExecutable(.{
.name = "quicz-tls13-backend-loopback",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/tls13_backend_loopback.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_tls13_backend_loopback);
// Pure-Zig TLS 1.3 over UDP loopback executable
const exe_tls13_udp_loopback = b.addExecutable(.{
.name = "quicz-tls13-udp-loopback",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/tls13_udp_loopback.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_tls13_udp_loopback);
const exe_h3_loopback = b.addExecutable(.{
.name = "quicz-h3-loopback",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/h3_loopback.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_h3_loopback);
const exe_h3_runtime_loopback = b.addExecutable(.{
.name = "quicz-h3-runtime-loopback",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/h3_runtime_loopback.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_h3_runtime_loopback);
const exe_h3_external_client = b.addExecutable(.{
.name = "quicz-h3-external-client",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/h3_external_client.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_h3_external_client);
const exe_multi_client_bench = b.addExecutable(.{
.name = "quicz-multi-client-bench",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/multi_client_bench.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_multi_client_bench);
const run_multi_client_bench = b.step("run-multi-client-bench", "Multi-client concurrent connection benchmark (handshake + aggregate throughput)");
const run_multi_client_bench_cmd = b.addRunArtifact(exe_multi_client_bench);
run_multi_client_bench.dependOn(&run_multi_client_bench_cmd.step);
const exe_stability_bench = b.addExecutable(.{
.name = "quicz-stability-bench",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/stability_bench.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_stability_bench);
const run_stability_bench = b.step("run-stability-bench", "Long-run stability benchmark (multi-connection, multi-stream, leak-checked)");
const run_stability_bench_cmd = b.addRunArtifact(exe_stability_bench);
run_stability_bench.dependOn(&run_stability_bench_cmd.step);
if (b.args) |args| {
run_stability_bench_cmd.addArgs(args);
}
const exe_scale_bench = b.addExecutable(.{
.name = "quicz-scale-bench",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/scale_bench.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_scale_bench);
const run_scale_bench = b.step("run-scale-bench", "Connection-scale benchmark (N concurrent handshakes + echo, leak-checked)");
const run_scale_bench_cmd = b.addRunArtifact(exe_scale_bench);
run_scale_bench.dependOn(&run_scale_bench_cmd.step);
// Pure-Zig TLS 1.3 with EndpointConnectionLifecycle ownership
const exe_tls13_lifecycle_loopback = b.addExecutable(.{
.name = "quicz-tls13-lifecycle-loopback",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/tls13_lifecycle_loopback.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_tls13_lifecycle_loopback);
// Pure-Zig TLS 1.3 stateless reset over UDP loopback executable
const exe_tls13_stateless_reset_loopback = b.addExecutable(.{
.name = "quicz-tls13-stateless-reset-loopback",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/tls13_stateless_reset_loopback.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_tls13_stateless_reset_loopback);
// Pure-Zig TLS 1.3 path validation over UDP loopback executable
const exe_tls13_path_validation_loopback = b.addExecutable(.{
.name = "quicz-tls13-path-validation-loopback",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/tls13_path_validation_loopback.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_tls13_path_validation_loopback);
// Pure-Zig TLS 1.3 Retry over UDP loopback executable
const exe_tls13_retry_loopback = b.addExecutable(.{
.name = "quicz-tls13-retry-loopback",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/tls13_retry_loopback.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_tls13_retry_loopback);
// QUIC-Interop-Runner 风格 interop client executable(M7 外部互通起步)
const exe_interop_client = b.addExecutable(.{
.name = "quicz-interop-client",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/interop_client.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_interop_client);
// 事件驱动 interop loopback executable(deadline 驱动收发循环)
const exe_interop_event_loopback = b.addExecutable(.{
.name = "quicz-interop-event-loopback",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/interop_event_loopback.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_interop_event_loopback);
// P5-C: QUIC-Interop-Runner server/client binaries
const exe_interop_server = b.addExecutable(.{
.name = "quicz-interop-server",
.root_module = b.createModule(.{
.root_source_file = b.path("interop/server.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_interop_server);
const exe_interop_runner_client = b.addExecutable(.{
.name = "quicz-interop-runner-client",
.root_module = b.createModule(.{
.root_source_file = b.path("interop/client.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
b.installArtifact(exe_interop_runner_client);
// TLS C ABI adapter executable
const exe_tls_c_abi_adapter = b.addExecutable(.{
.name = "quicz-tls-c-abi-adapter",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/tls_c_abi_adapter.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "quicz", .module = quicz_mod },
},
}),
});
const translate_tls_c_abi_adapter = b.addTranslateC(.{
.root_source_file = b.path("examples/tls_c_abi_demo_backend.h"),
.target = target,
.optimize = optimize,
});
exe_tls_c_abi_adapter.root_module.addImport("c", translate_tls_c_abi_adapter.createModule());
exe_tls_c_abi_adapter.root_module.addCSourceFile(.{
.file = b.path("examples/tls_c_abi_demo_backend.c"),
.flags = &.{},
});
exe_tls_c_abi_adapter.root_module.link_libc = true;
b.installArtifact(exe_tls_c_abi_adapter);
// OpenSSL QUIC TLS API probe executable
const exe_tls_openssl_probe = b.addExecutable(.{
.name = "quicz-tls-openssl-probe",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/tls_openssl_probe.zig"),
.target = target,
.optimize = optimize,
}),
});
const translate_tls_openssl_probe = b.addTranslateC(.{
.root_source_file = b.path("examples/tls_openssl_probe.h"),
.target = target,
.optimize = optimize,
});
exe_tls_openssl_probe.root_module.addImport("c", translate_tls_openssl_probe.createModule());
exe_tls_openssl_probe.root_module.addCSourceFile(.{
.file = b.path("examples/tls_openssl_probe.c"),
.flags = &.{},
});
exe_tls_openssl_probe.root_module.link_libc = true;
exe_tls_openssl_probe.root_module.linkSystemLibrary("ssl", .{});
exe_tls_openssl_probe.root_module.linkSystemLibrary("crypto", .{});
// Not installed by default: requires OpenSSL 3.4+ QUIC API (probe tool).
// b.installArtifact(exe_tls_openssl_probe);
// OpenSSL-backed TLS backend adapter executable
const exe_tls_openssl_backend_adapter = b.addExecutable(.{