Skip to content

A cross-platform library to retrieve the MAC address from your network interfaces without libc.

License

Notifications You must be signed in to change notification settings

weskoerber/mac_address

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

test docs

mac_address

A cross-platform library to retrieve the MAC address from your network interfaces without libc.

Requirements

  • zig compiler (0.12.0 or newer)1

Install

First, add the dependency to your build.zig.zon using zig fetch:

zig fetch --save git+https://github.com/weskoerber/mac_address#main

Then, import mac_address into your build.zig:

const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const mac_address = b.dependency("mac_address", .{
            .target = target,
            .optimize = optimize,
    }).module("mac_address");

    const my_exe = b.addExecutable(.{
        .name = "my_exe",
        .root_source_file = b.path("src/main.zig"),
        .target = target,
        .optimize = optimize,
    });

    my_exe.root_module.addImport(mac_address);
}

Usage

See the examples directory for example usage. Example executables can be built by setting the examples option to true:

    const mac_address = b.dependency("mac_address", .{
            .target = target,
            .optimize = optimize,
            .examples = true,
    }).module("mac_address");

Cross-platform support

mac_address API Linux Windows
getAll
getAllNoLoopback
  • ✅ = supported
  • 📝 = planned
  • ❌ = not supported

Footnotes

  1. Shameless plug: if you're using a unix-like operating system or WSL on Windows, consider using a Zig compiler version manager I wrote called zvm. Once downloaded and in your PATH, just run zvm install 0.12.0 (or zvm install master to get the latest nightly).

About

A cross-platform library to retrieve the MAC address from your network interfaces without libc.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages