Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › crypto › Certificate › Parsed › checkIpAddress Private Function checkIpAddress Doc Source Private Function std.crypto.Certificate.Parsed.checkIpAddress
fn checkIpAddress (host_name : []const u8 , ip_address : []const u8 ) bool Params host_name : []const u8 ip_address : []const u8 File crypto/Certificate.zig: 388
388
389
390
391
392
393
394
395
396
397
398
399
400
401 fn checkIpAddress (host_name : []const u8 , ip_address : []const u8 ) bool {
switch (ip_address .len ) {
4 => {
// port is irrelevant to SAN matching, so 0 is a harmless placeholder.
const address = net .Ip4Address .parse (host_name , 0 ) catch return false ;
return mem .eql (u8 , &address .bytes , ip_address );
},
16 => {
const address = net .Ip6Address .parse (host_name , 0 ) catch return false ;
return mem .eql (u8 , &address .bytes , ip_address );
},
else => return false , // a malformed certificate, neither 4 nor 16 octets
}
}
Check IP address according to RFC 5280 §4.2.1.6.