Added DHCPv4 Client
This adds a bare-bones DHCPv4 client. Currently leases are handled by a single callback which
can then be used to implement option observers and other ways to deal with them.
Test Plan: Some tests already here, more coming.
X-Origin-Diff: phab/D645
GitOrigin-RevId: 76fae7080cdd8ba59cf77368179cae0bc9c9c824
diff --git a/core/pkg/dhcp4c/BUILD.bazel b/core/pkg/dhcp4c/BUILD.bazel
new file mode 100644
index 0000000..6d79268
--- /dev/null
+++ b/core/pkg/dhcp4c/BUILD.bazel
@@ -0,0 +1,32 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "go_default_library",
+ srcs = [
+ "dhcpc.go",
+ "doc.go",
+ "lease.go",
+ ],
+ importpath = "git.monogon.dev/source/nexantic.git/core/pkg/dhcp4c",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//core/internal/common/supervisor:go_default_library",
+ "//core/pkg/dhcp4c/transport:go_default_library",
+ "@com_github_cenkalti_backoff_v4//:go_default_library",
+ "@com_github_insomniacslk_dhcp//dhcpv4:go_default_library",
+ "@com_github_insomniacslk_dhcp//iana:go_default_library",
+ ],
+)
+
+go_test(
+ name = "go_default_test",
+ srcs = ["dhcpc_test.go"],
+ embed = [":go_default_library"],
+ pure = "on",
+ deps = [
+ "//core/pkg/dhcp4c/transport:go_default_library",
+ "@com_github_cenkalti_backoff_v4//:go_default_library",
+ "@com_github_insomniacslk_dhcp//dhcpv4:go_default_library",
+ "@com_github_stretchr_testify//assert:go_default_library",
+ ],
+)