Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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. Private Function

checkIpAddress

Private Function
std.crypto.Certificate.Parsed.checkIpAddress
fn checkIpAddress(host_name: []const u8, ip_address: []const u8) bool

Check IP address according to RFC 5280 §4.2.1.6.

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
        }
    }