From: Dan Fuhry Date: Thu, 6 Nov 2025 11:17:47 +0000 (-0500) Subject: initial effort to migrate to bazel X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=7cd1c423aeed073e0328aad3f3f8095720240ee6;p=runtime.git initial effort to migrate to bazel --- diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000..b3438d3 --- /dev/null +++ b/.bazelrc @@ -0,0 +1,3 @@ +common --enable_bzlmod +build --workspace_status_command="bazel/workspace-status" + diff --git a/.gitignore b/.gitignore index a3fd46e..99f2a7d 100644 --- a/.gitignore +++ b/.gitignore @@ -24,37 +24,10 @@ /attestation/php/.phpunit.result.cache /attestation/php.ini -attestation/client/client -machines/event_monitor/event_monitor -machines/machines_agent/machines_agent -sase/ws_proxy_client/ws_proxy_client -sase/ws_tcp_proxy/ws_tcp_proxy -sd/health_exporter/health_exporter -sd/sd_register/sd_register -sd/sd_publish/sd_publish -sd/sd_watcher/sd_watcher -echo/server/server -echo/client/client -attestation/rpc_server/rpc_server -attestation/rpc_client/rpc_client -thirdparty/registry/registry -metrics/metricbus/mbclient/example/example -metrics/metricbus/mbserver/mbserver -mtls/verify_tool/main -metrics/apcups_exporter/apcups_exporter -ansible/client/client -ansible/admin_tool/admin_tool -ansible/server/server -mtls/verify_tool/verify_tool -ldap/health_exporter/health_exporter -envoy/xds/envoy_xds/envoy_xds -mtls/mtls_exporter/mtls_exporter -http/proxy/proxy -automation/bryston_ctl/cli/cli -automation/bryston_ctl/client/client -automation/bryston_ctl/server/server -metrics/prometheus_http_discovery/prometheus_http_discovery -mtls/supervisor/supervisor - /vendor/ +bazel-bin +bazel-out +bazel-runtime +bazel-testlogs +bazel/workspace-status.local diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..624b25a --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,19 @@ +load("@gazelle//:def.bzl", "gazelle") +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +# gazelle:proto legacy + +gazelle(name = "gazelle") + +go_library( + name = "runtime_lib", + srcs = ["setdomainname.go"], + importpath = "go.fuhry.dev/runtime", + visibility = ["//visibility:private"], +) + +go_binary( + name = "runtime", + embed = [":runtime_lib"], + visibility = ["//visibility:public"], +) diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000..4899c4a --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,117 @@ +module(name = "runtime") + +http_archive = use_repo_rule( + "@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", +) + +bazel_dep( + name = "gazelle", + version = "0.46.0", +) + +bazel_dep( + name = "rules_go", + version = "0.59.0", + # repo_name = "io_bazel_rules_go", +) + +bazel_dep( + name = "protobuf", + version = "33.0", + repo_name = "com_google_protobuf", +) + +bazel_dep( + name = "rules_proto", + version = "7.1.0", +) + +http_archive( + name = "gogoproto", + url = "https://github.com/gogo/protobuf/archive/refs/tags/v1.3.2.tar.gz", + strip_prefix = "gogoproto-1.3.2", + sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + build_file = "//thirdparty/gogoproto:BUILD.bazel", +) + +http_archive( + name = "io_bazel_rules_go", + url = "https://github.com/bazel-contrib/rules_go/releases/download/v0.58.3/rules_go-v0.58.3.zip", + sha256 = "82f0af253fc61c7f06b005c67c079573776111185b7c3742563f751178aaa4c0", +) + +http_archive( + name = "bazel_skylib", + url = "https://github.com/bazelbuild/bazel-skylib/releases/download/1.8.2/bazel-skylib-1.8.2.tar.gz", + sha256 = "6e78f0e57de26801f6f564fa7c4a48dc8b36873e416257a92bbb0937eeac8446", +) + +go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") +go_sdk.from_file(go_mod = "//:go.mod") +# go_sdk.host() +# go_sdk.nogo(nogo = "//:my_nogo") + +go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") +go_deps.from_file(go_mod = "//:go.mod") + +go_deps.gazelle_override( + directives = [ + "gazelle:proto disable_global", + ], + path = "go.etcd.io/etcd/api/v3" +) + +# go_repository = use_repo_rule("@gazelle//:def.bzl", "go_repository") + +use_repo( + go_deps, + "com_github_coredns_caddy", + "com_github_coredns_coredns", + "com_github_coreos_go_systemd", + "com_github_coreos_go_systemd_v22", + "com_github_crewjam_saml", + "com_github_distribution_distribution_v3", + "com_github_eclipse_paho_mqtt_golang", + "com_github_go_kit_log", + "com_github_go_ldap_ldap_v3", + "com_github_godbus_dbus_v5", + "com_github_google_certificate_transparency_go", + "com_github_google_go_attestation", + "com_github_gorilla_websocket", + "com_github_hashicorp_golang_lru", + "com_github_hashicorp_golang_lru_v2", + "com_github_keybase_go_keychain", + "com_github_mdlayher_apcupsd", + "com_github_miekg_dns", + "com_github_minio_minio_go_v7", + "com_github_mitchellh_go_ps", + "com_github_nikolalohinski_gonja", + "com_github_nyaruka_phonenumbers", + "com_github_prometheus_client_golang", + "com_github_prometheus_exporter_toolkit", + "com_github_quic_go_quic_go", + "com_github_sirupsen_logrus", + "com_github_stretchr_testify", + "com_github_thalesignite_crypto11", + "com_github_urfave_cli_v2", + "com_github_urfave_cli_v3", + "com_github_vishvananda_netlink", + "dev_fuhry_go_fsnotify", + "dev_fuhry_go_grpc_quic", + "in_gopkg_check_v1", + "in_gopkg_ini_v1", + "in_gopkg_yaml_v3", + "io_etcd_go_etcd_api_v3", + "io_etcd_go_etcd_client_pkg_v3", + "io_etcd_go_etcd_client_v3", + "net_howett_plist", + "org_golang_google_grpc", + "org_golang_google_protobuf", + "org_golang_x_exp", + "org_golang_x_sync", + "org_golang_x_sys", + "org_golang_x_term", + "org_golang_x_text", + "org_uber_go_atomic", + "st_bug_go_serial", +) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock new file mode 100644 index 0000000..6ec882a --- /dev/null +++ b/MODULE.bazel.lock @@ -0,0 +1,608 @@ +{ + "lockFileVersion": 18, + "registryFileHashes": { + "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", + "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", + "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589", + "https://bcr.bazel.build/modules/abseil-cpp/20230125.1/MODULE.bazel": "89047429cb0207707b2dface14ba7f8df85273d484c2572755be4bab7ce9c3a0", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.0.bcr.1/MODULE.bazel": "1c8cec495288dccd14fdae6e3f95f772c1c91857047a098fad772034264cc8cb", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.0/MODULE.bazel": "d253ae36a8bd9ee3c5955384096ccb6baf16a1b1e93e858370da0a3b94f77c16", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.1/MODULE.bazel": "fa92e2eb41a04df73cdabeec37107316f7e5272650f81d6cc096418fe647b915", + "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/MODULE.bazel": "37bcdb4440fbb61df6a1c296ae01b327f19e9bb521f9b8e26ec854b6f97309ed", + "https://bcr.bazel.build/modules/abseil-cpp/20240116.2/MODULE.bazel": "73939767a4686cd9a520d16af5ab440071ed75cec1a876bf2fcfaf1f71987a16", + "https://bcr.bazel.build/modules/abseil-cpp/20250127.1/MODULE.bazel": "c4a89e7ceb9bf1e25cf84a9f830ff6b817b72874088bf5141b314726e46a57c1", + "https://bcr.bazel.build/modules/abseil-cpp/20250512.1/MODULE.bazel": "d209fdb6f36ffaf61c509fcc81b19e81b411a999a934a032e10cd009a0226215", + "https://bcr.bazel.build/modules/abseil-cpp/20250512.1/source.json": "d725d73707d01bb46ab3ca59ba408b8e9bd336642ca77a2269d4bfb8bbfd413d", + "https://bcr.bazel.build/modules/apple_support/1.11.1/MODULE.bazel": "1843d7cd8a58369a444fc6000e7304425fba600ff641592161d9f15b179fb896", + "https://bcr.bazel.build/modules/apple_support/1.15.1/MODULE.bazel": "a0556fefca0b1bb2de8567b8827518f94db6a6e7e7d632b4c48dc5f865bc7c85", + "https://bcr.bazel.build/modules/apple_support/1.23.1/MODULE.bazel": "53763fed456a968cf919b3240427cf3a9d5481ec5466abc9d5dc51bc70087442", + "https://bcr.bazel.build/modules/apple_support/1.23.1/source.json": "d888b44312eb0ad2c21a91d026753f330caa48a25c9b2102fae75eb2b0dcfdd2", + "https://bcr.bazel.build/modules/bazel_features/1.1.0/MODULE.bazel": "cfd42ff3b815a5f39554d97182657f8c4b9719568eb7fded2b9135f084bf760b", + "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd", + "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", + "https://bcr.bazel.build/modules/bazel_features/1.15.0/MODULE.bazel": "d38ff6e517149dc509406aca0db3ad1efdd890a85e049585b7234d04238e2a4d", + "https://bcr.bazel.build/modules/bazel_features/1.17.0/MODULE.bazel": "039de32d21b816b47bd42c778e0454217e9c9caac4a3cf8e15c7231ee3ddee4d", + "https://bcr.bazel.build/modules/bazel_features/1.18.0/MODULE.bazel": "1be0ae2557ab3a72a57aeb31b29be347bcdc5d2b1eb1e70f39e3851a7e97041a", + "https://bcr.bazel.build/modules/bazel_features/1.19.0/MODULE.bazel": "59adcdf28230d220f0067b1f435b8537dd033bfff8db21335ef9217919c7fb58", + "https://bcr.bazel.build/modules/bazel_features/1.21.0/MODULE.bazel": "675642261665d8eea09989aa3b8afb5c37627f1be178382c320d1b46afba5e3b", + "https://bcr.bazel.build/modules/bazel_features/1.27.0/MODULE.bazel": "621eeee06c4458a9121d1f104efb80f39d34deff4984e778359c60eaf1a8cb65", + "https://bcr.bazel.build/modules/bazel_features/1.28.0/MODULE.bazel": "4b4200e6cbf8fa335b2c3f43e1d6ef3e240319c33d43d60cc0fbd4b87ece299d", + "https://bcr.bazel.build/modules/bazel_features/1.3.0/MODULE.bazel": "cdcafe83ec318cda34e02948e81d790aab8df7a929cec6f6969f13a489ccecd9", + "https://bcr.bazel.build/modules/bazel_features/1.30.0/MODULE.bazel": "a14b62d05969a293b80257e72e597c2da7f717e1e69fa8b339703ed6731bec87", + "https://bcr.bazel.build/modules/bazel_features/1.33.0/MODULE.bazel": "8b8dc9d2a4c88609409c3191165bccec0e4cb044cd7a72ccbe826583303459f6", + "https://bcr.bazel.build/modules/bazel_features/1.33.0/source.json": "13617db3930328c2cd2807a0f13d52ca870ac05f96db9668655113265147b2a6", + "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7", + "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a", + "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", + "https://bcr.bazel.build/modules/bazel_skylib/1.1.1/MODULE.bazel": "1add3e7d93ff2e6998f9e118022c84d163917d912f5afafb3058e3d2f1545b5e", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", + "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.1/MODULE.bazel": "a0dcb779424be33100dcae821e9e27e4f2901d9dfd5333efe5ac6a8d7ab75e1d", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651", + "https://bcr.bazel.build/modules/bazel_skylib/1.5.0/MODULE.bazel": "32880f5e2945ce6a03d1fbd588e9198c0a959bb42297b2cfaf1685b7bc32e138", + "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.0/MODULE.bazel": "0db596f4563de7938de764cc8deeabec291f55e8ec15299718b93c4423e9796d", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b", + "https://bcr.bazel.build/modules/bazel_skylib/1.8.1/MODULE.bazel": "88ade7293becda963e0e3ea33e7d54d3425127e0a326e0d17da085a5f1f03ff6", + "https://bcr.bazel.build/modules/bazel_skylib/1.8.1/source.json": "7ebaefba0b03efe59cac88ed5bbc67bcf59a3eff33af937345ede2a38b2d368a", + "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", + "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", + "https://bcr.bazel.build/modules/gazelle/0.32.0/MODULE.bazel": "b499f58a5d0d3537f3cf5b76d8ada18242f64ec474d8391247438bf04f58c7b8", + "https://bcr.bazel.build/modules/gazelle/0.33.0/MODULE.bazel": "a13a0f279b462b784fb8dd52a4074526c4a2afe70e114c7d09066097a46b3350", + "https://bcr.bazel.build/modules/gazelle/0.34.0/MODULE.bazel": "abdd8ce4d70978933209db92e436deb3a8b737859e9354fb5fd11fb5c2004c8a", + "https://bcr.bazel.build/modules/gazelle/0.36.0/MODULE.bazel": "e375d5d6e9a6ca59b0cb38b0540bc9a05b6aa926d322f2de268ad267a2ee74c0", + "https://bcr.bazel.build/modules/gazelle/0.46.0/MODULE.bazel": "3dec215dacf2427df87b524a2c99da387882a18d753f0b1b38675992bd0a99c6", + "https://bcr.bazel.build/modules/gazelle/0.46.0/source.json": "f255441117f6c63a3cbc0d4fd84c09c047e54a9bdaaf6aedf66e3b4218ddebd4", + "https://bcr.bazel.build/modules/google_benchmark/1.8.2/MODULE.bazel": "a70cf1bba851000ba93b58ae2f6d76490a9feb74192e57ab8e8ff13c34ec50cb", + "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", + "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/MODULE.bazel": "22c31a561553727960057361aa33bf20fb2e98584bc4fec007906e27053f80c6", + "https://bcr.bazel.build/modules/googletest/1.14.0/MODULE.bazel": "cfbcbf3e6eac06ef9d85900f64424708cc08687d1b527f0ef65aa7517af8118f", + "https://bcr.bazel.build/modules/googletest/1.15.2/MODULE.bazel": "6de1edc1d26cafb0ea1a6ab3f4d4192d91a312fd2d360b63adaa213cd00b2108", + "https://bcr.bazel.build/modules/googletest/1.17.0/MODULE.bazel": "dbec758171594a705933a29fcf69293d2468c49ec1f2ebca65c36f504d72df46", + "https://bcr.bazel.build/modules/googletest/1.17.0/source.json": "38e4454b25fc30f15439c0378e57909ab1fd0a443158aa35aec685da727cd713", + "https://bcr.bazel.build/modules/jsoncpp/1.9.5/MODULE.bazel": "31271aedc59e815656f5736f282bb7509a97c7ecb43e927ac1a37966e0578075", + "https://bcr.bazel.build/modules/jsoncpp/1.9.6/MODULE.bazel": "2f8d20d3b7d54143213c4dfc3d98225c42de7d666011528dc8fe91591e2e17b0", + "https://bcr.bazel.build/modules/jsoncpp/1.9.6/source.json": "a04756d367a2126c3541682864ecec52f92cdee80a35735a3cb249ce015ca000", + "https://bcr.bazel.build/modules/libpfm/4.11.0/MODULE.bazel": "45061ff025b301940f1e30d2c16bea596c25b176c8b6b3087e92615adbd52902", + "https://bcr.bazel.build/modules/nlohmann_json/3.6.1/MODULE.bazel": "6f7b417dcc794d9add9e556673ad25cb3ba835224290f4f848f8e2db1e1fca74", + "https://bcr.bazel.build/modules/nlohmann_json/3.6.1/source.json": "f448c6e8963fdfa7eb831457df83ad63d3d6355018f6574fb017e8169deb43a9", + "https://bcr.bazel.build/modules/package_metadata/0.0.5/MODULE.bazel": "ef4f9439e3270fdd6b9fd4dbc3d2f29d13888e44c529a1b243f7a31dfbc2e8e4", + "https://bcr.bazel.build/modules/package_metadata/0.0.5/source.json": "2326db2f6592578177751c3e1f74786b79382cd6008834c9d01ec865b9126a85", + "https://bcr.bazel.build/modules/platforms/0.0.10/MODULE.bazel": "8cb8efaf200bdeb2150d93e162c40f388529a25852b332cec879373771e48ed5", + "https://bcr.bazel.build/modules/platforms/0.0.11/MODULE.bazel": "0daefc49732e227caa8bfa834d65dc52e8cc18a2faf80df25e8caea151a9413f", + "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee", + "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37", + "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615", + "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814", + "https://bcr.bazel.build/modules/platforms/0.0.8/MODULE.bazel": "9f142c03e348f6d263719f5074b21ef3adf0b139ee4c5133e2aa35664da9eb2d", + "https://bcr.bazel.build/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc", + "https://bcr.bazel.build/modules/platforms/1.0.0/MODULE.bazel": "f05feb42b48f1b3c225e4ccf351f367be0371411a803198ec34a389fb22aa580", + "https://bcr.bazel.build/modules/platforms/1.0.0/source.json": "f4ff1fd412e0246fd38c82328eb209130ead81d62dcd5a9e40910f867f733d96", + "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7", + "https://bcr.bazel.build/modules/protobuf/27.0/MODULE.bazel": "7873b60be88844a0a1d8f80b9d5d20cfbd8495a689b8763e76c6372998d3f64c", + "https://bcr.bazel.build/modules/protobuf/27.1/MODULE.bazel": "703a7b614728bb06647f965264967a8ef1c39e09e8f167b3ca0bb1fd80449c0d", + "https://bcr.bazel.build/modules/protobuf/29.0-rc2.bcr.1/MODULE.bazel": "52f4126f63a2f0bbf36b99c2a87648f08467a4eaf92ba726bc7d6a500bbf770c", + "https://bcr.bazel.build/modules/protobuf/29.0-rc2/MODULE.bazel": "6241d35983510143049943fc0d57937937122baf1b287862f9dc8590fc4c37df", + "https://bcr.bazel.build/modules/protobuf/29.0-rc3/MODULE.bazel": "33c2dfa286578573afc55a7acaea3cada4122b9631007c594bf0729f41c8de92", + "https://bcr.bazel.build/modules/protobuf/29.0/MODULE.bazel": "319dc8bf4c679ff87e71b1ccfb5a6e90a6dbc4693501d471f48662ac46d04e4e", + "https://bcr.bazel.build/modules/protobuf/29.1/MODULE.bazel": "557c3457560ff49e122ed76c0bc3397a64af9574691cb8201b4e46d4ab2ecb95", + "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0", + "https://bcr.bazel.build/modules/protobuf/3.19.2/MODULE.bazel": "532ffe5f2186b69fdde039efe6df13ba726ff338c6bc82275ad433013fa10573", + "https://bcr.bazel.build/modules/protobuf/3.19.6/MODULE.bazel": "9233edc5e1f2ee276a60de3eaa47ac4132302ef9643238f23128fea53ea12858", + "https://bcr.bazel.build/modules/protobuf/33.0/MODULE.bazel": "c5270efb4aad37a2f893536076518793f409ea7df07a06df995d848d1690f21c", + "https://bcr.bazel.build/modules/protobuf/33.0/source.json": "cd7ac80ad863190b9151281a85acc11d77b5bde2ba56443a7215da2d4ace6da3", + "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e", + "https://bcr.bazel.build/modules/pybind11_bazel/2.12.0/MODULE.bazel": "e6f4c20442eaa7c90d7190d8dc539d0ab422f95c65a57cc59562170c58ae3d34", + "https://bcr.bazel.build/modules/pybind11_bazel/2.12.0/source.json": "6900fdc8a9e95866b8c0d4ad4aba4d4236317b5c1cd04c502df3f0d33afed680", + "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206", + "https://bcr.bazel.build/modules/re2/2024-07-02.bcr.1/MODULE.bazel": "b4963dda9b31080be1905ef085ecd7dd6cd47c05c79b9cdf83ade83ab2ab271a", + "https://bcr.bazel.build/modules/re2/2024-07-02.bcr.1/source.json": "2ff292be6ef3340325ce8a045ecc326e92cbfab47c7cbab4bd85d28971b97ac4", + "https://bcr.bazel.build/modules/re2/2024-07-02/MODULE.bazel": "0eadc4395959969297cbcf31a249ff457f2f1d456228c67719480205aa306daa", + "https://bcr.bazel.build/modules/rules_android/0.1.1/MODULE.bazel": "48809ab0091b07ad0182defb787c4c5328bd3a278938415c00a7b69b50c4d3a8", + "https://bcr.bazel.build/modules/rules_android/0.1.1/source.json": "e6986b41626ee10bdc864937ffb6d6bf275bb5b9c65120e6137d56e6331f089e", + "https://bcr.bazel.build/modules/rules_apple/3.16.0/MODULE.bazel": "0d1caf0b8375942ce98ea944be754a18874041e4e0459401d925577624d3a54a", + "https://bcr.bazel.build/modules/rules_apple/3.16.0/source.json": "d8b5fe461272018cc07cfafce11fe369c7525330804c37eec5a82f84cd475366", + "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647", + "https://bcr.bazel.build/modules/rules_cc/0.0.10/MODULE.bazel": "ec1705118f7eaedd6e118508d3d26deba2a4e76476ada7e0e3965211be012002", + "https://bcr.bazel.build/modules/rules_cc/0.0.13/MODULE.bazel": "0e8529ed7b323dad0775ff924d2ae5af7640b23553dfcd4d34344c7e7a867191", + "https://bcr.bazel.build/modules/rules_cc/0.0.14/MODULE.bazel": "5e343a3aac88b8d7af3b1b6d2093b55c347b8eefc2e7d1442f7a02dc8fea48ac", + "https://bcr.bazel.build/modules/rules_cc/0.0.15/MODULE.bazel": "6704c35f7b4a72502ee81f61bf88706b54f06b3cbe5558ac17e2e14666cd5dcc", + "https://bcr.bazel.build/modules/rules_cc/0.0.16/MODULE.bazel": "7661303b8fc1b4d7f532e54e9d6565771fea666fbdf839e0a86affcd02defe87", + "https://bcr.bazel.build/modules/rules_cc/0.0.17/MODULE.bazel": "2ae1d8f4238ec67d7185d8861cb0a2cdf4bc608697c331b95bf990e69b62e64a", + "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", + "https://bcr.bazel.build/modules/rules_cc/0.0.6/MODULE.bazel": "abf360251023dfe3efcef65ab9d56beefa8394d4176dd29529750e1c57eaa33f", + "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", + "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", + "https://bcr.bazel.build/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513", + "https://bcr.bazel.build/modules/rules_cc/0.1.5/MODULE.bazel": "88dfc9361e8b5ae1008ac38f7cdfd45ad738e4fa676a3ad67d19204f045a1fd8", + "https://bcr.bazel.build/modules/rules_cc/0.1.5/source.json": "4bb4fed7f5499775d495739f785a5494a1f854645fa1bac5de131264f5acdf01", + "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6", + "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8", + "https://bcr.bazel.build/modules/rules_go/0.41.0/MODULE.bazel": "55861d8e8bb0e62cbd2896f60ff303f62ffcb0eddb74ecb0e5c0cbe36fc292c8", + "https://bcr.bazel.build/modules/rules_go/0.42.0/MODULE.bazel": "8cfa875b9aa8c6fce2b2e5925e73c1388173ea3c32a0db4d2b4804b453c14270", + "https://bcr.bazel.build/modules/rules_go/0.46.0/MODULE.bazel": "3477df8bdcc49e698b9d25f734c4f3a9f5931ff34ee48a2c662be168f5f2d3fd", + "https://bcr.bazel.build/modules/rules_go/0.53.0/MODULE.bazel": "a4ed760d3ac0dbc0d7b967631a9a3fd9100d28f7d9fcf214b4df87d4bfff5f9a", + "https://bcr.bazel.build/modules/rules_go/0.59.0/MODULE.bazel": "b7e43e7414a3139a7547d1b4909b29085fbe5182b6c58cbe1ed4c6272815aeae", + "https://bcr.bazel.build/modules/rules_go/0.59.0/source.json": "1df17bb7865cfc029492c30163cee891d0dd8658ea0d5bfdf252c4b6db5c1ef6", + "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", + "https://bcr.bazel.build/modules/rules_java/5.3.5/MODULE.bazel": "a4ec4f2db570171e3e5eb753276ee4b389bae16b96207e9d3230895c99644b86", + "https://bcr.bazel.build/modules/rules_java/6.0.0/MODULE.bazel": "8a43b7df601a7ec1af61d79345c17b31ea1fedc6711fd4abfd013ea612978e39", + "https://bcr.bazel.build/modules/rules_java/6.4.0/MODULE.bazel": "e986a9fe25aeaa84ac17ca093ef13a4637f6107375f64667a15999f77db6c8f6", + "https://bcr.bazel.build/modules/rules_java/6.5.2/MODULE.bazel": "1d440d262d0e08453fa0c4d8f699ba81609ed0e9a9a0f02cd10b3e7942e61e31", + "https://bcr.bazel.build/modules/rules_java/7.10.0/MODULE.bazel": "530c3beb3067e870561739f1144329a21c851ff771cd752a49e06e3dc9c2e71a", + "https://bcr.bazel.build/modules/rules_java/7.12.2/MODULE.bazel": "579c505165ee757a4280ef83cda0150eea193eed3bef50b1004ba88b99da6de6", + "https://bcr.bazel.build/modules/rules_java/7.2.0/MODULE.bazel": "06c0334c9be61e6cef2c8c84a7800cef502063269a5af25ceb100b192453d4ab", + "https://bcr.bazel.build/modules/rules_java/7.3.2/MODULE.bazel": "50dece891cfdf1741ea230d001aa9c14398062f2b7c066470accace78e412bc2", + "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", + "https://bcr.bazel.build/modules/rules_java/8.14.0/MODULE.bazel": "717717ed40cc69994596a45aec6ea78135ea434b8402fb91b009b9151dd65615", + "https://bcr.bazel.build/modules/rules_java/8.14.0/source.json": "8a88c4ca9e8759da53cddc88123880565c520503321e2566b4e33d0287a3d4bc", + "https://bcr.bazel.build/modules/rules_java/8.3.2/MODULE.bazel": "7336d5511ad5af0b8615fdc7477535a2e4e723a357b6713af439fe8cf0195017", + "https://bcr.bazel.build/modules/rules_java/8.5.1/MODULE.bazel": "d8a9e38cc5228881f7055a6079f6f7821a073df3744d441978e7a43e20226939", + "https://bcr.bazel.build/modules/rules_java/8.6.1/MODULE.bazel": "f4808e2ab5b0197f094cabce9f4b006a27766beb6a9975931da07099560ca9c2", + "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", + "https://bcr.bazel.build/modules/rules_jvm_external/5.1/MODULE.bazel": "33f6f999e03183f7d088c9be518a63467dfd0be94a11d0055fe2d210f89aa909", + "https://bcr.bazel.build/modules/rules_jvm_external/5.2/MODULE.bazel": "d9351ba35217ad0de03816ef3ed63f89d411349353077348a45348b096615036", + "https://bcr.bazel.build/modules/rules_jvm_external/5.3/MODULE.bazel": "bf93870767689637164657731849fb887ad086739bd5d360d90007a581d5527d", + "https://bcr.bazel.build/modules/rules_jvm_external/6.1/MODULE.bazel": "75b5fec090dbd46cf9b7d8ea08cf84a0472d92ba3585b476f44c326eda8059c4", + "https://bcr.bazel.build/modules/rules_jvm_external/6.3/MODULE.bazel": "c998e060b85f71e00de5ec552019347c8bca255062c990ac02d051bb80a38df0", + "https://bcr.bazel.build/modules/rules_jvm_external/6.7/MODULE.bazel": "e717beabc4d091ecb2c803c2d341b88590e9116b8bf7947915eeb33aab4f96dd", + "https://bcr.bazel.build/modules/rules_jvm_external/6.7/source.json": "5426f412d0a7fc6b611643376c7e4a82dec991491b9ce5cb1cfdd25fe2e92be4", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.0/MODULE.bazel": "ef85697305025e5a61f395d4eaede272a5393cee479ace6686dba707de804d59", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/MODULE.bazel": "d269a01a18ee74d0335450b10f62c9ed81f2321d7958a2934e44272fe82dcef3", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/source.json": "2faa4794364282db7c06600b7e5e34867a564ae91bda7cae7c29c64e9466b7d5", + "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", + "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", + "https://bcr.bazel.build/modules/rules_license/1.0.0/MODULE.bazel": "a7fda60eefdf3d8c827262ba499957e4df06f659330bbe6cdbdb975b768bb65c", + "https://bcr.bazel.build/modules/rules_license/1.0.0/source.json": "a52c89e54cc311196e478f8382df91c15f7a2bfdf4c6cd0e2675cc2ff0b56efb", + "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/MODULE.bazel": "5b1df97dbc29623bccdf2b0dcd0f5cb08e2f2c9050aab1092fd39a41e82686ff", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/source.json": "bd82e5d7b9ce2d31e380dd9f50c111d678c3bdaca190cb76b0e1c71b05e1ba8a", + "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", + "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", + "https://bcr.bazel.build/modules/rules_proto/6.0.0-rc1/MODULE.bazel": "1e5b502e2e1a9e825eef74476a5a1ee524a92297085015a052510b09a1a09483", + "https://bcr.bazel.build/modules/rules_proto/6.0.0/MODULE.bazel": "b531d7f09f58dce456cd61b4579ce8c86b38544da75184eadaf0a7cb7966453f", + "https://bcr.bazel.build/modules/rules_proto/6.0.2/MODULE.bazel": "ce916b775a62b90b61888052a416ccdda405212b6aaeb39522f7dc53431a5e73", + "https://bcr.bazel.build/modules/rules_proto/7.0.2/MODULE.bazel": "bf81793bd6d2ad89a37a40693e56c61b0ee30f7a7fdbaf3eabbf5f39de47dea2", + "https://bcr.bazel.build/modules/rules_proto/7.1.0/MODULE.bazel": "002d62d9108f75bb807cd56245d45648f38275cb3a99dcd45dfb864c5d74cb96", + "https://bcr.bazel.build/modules/rules_proto/7.1.0/source.json": "39f89066c12c24097854e8f57ab8558929f9c8d474d34b2c00ac04630ad8940e", + "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", + "https://bcr.bazel.build/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300", + "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel": "72f1506841c920a1afec76975b35312410eea3aa7b63267436bfb1dd91d2d382", + "https://bcr.bazel.build/modules/rules_python/0.28.0/MODULE.bazel": "cba2573d870babc976664a912539b320cbaa7114cd3e8f053c720171cde331ed", + "https://bcr.bazel.build/modules/rules_python/0.31.0/MODULE.bazel": "93a43dc47ee570e6ec9f5779b2e64c1476a6ce921c48cc9a1678a91dd5f8fd58", + "https://bcr.bazel.build/modules/rules_python/0.33.2/MODULE.bazel": "3e036c4ad8d804a4dad897d333d8dce200d943df4827cb849840055be8d2e937", + "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", + "https://bcr.bazel.build/modules/rules_python/0.40.0/MODULE.bazel": "9d1a3cd88ed7d8e39583d9ffe56ae8a244f67783ae89b60caafc9f5cf318ada7", + "https://bcr.bazel.build/modules/rules_python/1.6.0/MODULE.bazel": "7e04ad8f8d5bea40451cf80b1bd8262552aa73f841415d20db96b7241bd027d8", + "https://bcr.bazel.build/modules/rules_python/1.6.0/source.json": "e980f654cf66ec4928672f41fc66c4102b5ea54286acf4aecd23256c84211be6", + "https://bcr.bazel.build/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c", + "https://bcr.bazel.build/modules/rules_shell/0.3.0/MODULE.bazel": "de4402cd12f4cc8fda2354fce179fdb068c0b9ca1ec2d2b17b3e21b24c1a937b", + "https://bcr.bazel.build/modules/rules_shell/0.3.0/source.json": "c55ed591aa5009401ddf80ded9762ac32c358d2517ee7820be981e2de9756cf3", + "https://bcr.bazel.build/modules/rules_swift/1.16.0/MODULE.bazel": "4a09f199545a60d09895e8281362b1ff3bb08bbde69c6fc87aff5b92fcc916ca", + "https://bcr.bazel.build/modules/rules_swift/2.1.1/MODULE.bazel": "494900a80f944fc7aa61500c2073d9729dff0b764f0e89b824eb746959bc1046", + "https://bcr.bazel.build/modules/rules_swift/2.1.1/source.json": "40fc69dfaac64deddbb75bd99cdac55f4427d9ca0afbe408576a65428427a186", + "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", + "https://bcr.bazel.build/modules/stardoc/0.5.3/MODULE.bazel": "c7f6948dae6999bf0db32c1858ae345f112cacf98f174c7a8bb707e41b974f1c", + "https://bcr.bazel.build/modules/stardoc/0.5.6/MODULE.bazel": "c43dabc564990eeab55e25ed61c07a1aadafe9ece96a4efabb3f8bf9063b71ef", + "https://bcr.bazel.build/modules/stardoc/0.7.0/MODULE.bazel": "05e3d6d30c099b6770e97da986c53bd31844d7f13d41412480ea265ac9e8079c", + "https://bcr.bazel.build/modules/stardoc/0.7.1/MODULE.bazel": "3548faea4ee5dda5580f9af150e79d0f6aea934fc60c1cc50f4efdd9420759e7", + "https://bcr.bazel.build/modules/stardoc/0.7.2/MODULE.bazel": "fc152419aa2ea0f51c29583fab1e8c99ddefd5b3778421845606ee628629e0e5", + "https://bcr.bazel.build/modules/stardoc/0.7.2/source.json": "58b029e5e901d6802967754adf0a9056747e8176f017cfe3607c0851f4d42216", + "https://bcr.bazel.build/modules/swift_argument_parser/1.3.1.1/MODULE.bazel": "5e463fbfba7b1701d957555ed45097d7f984211330106ccd1352c6e0af0dcf91", + "https://bcr.bazel.build/modules/swift_argument_parser/1.3.1.1/source.json": "32bd87e5f4d7acc57c5b2ff7c325ae3061d5e242c0c4c214ae87e0f1c13e54cb", + "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", + "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", + "https://bcr.bazel.build/modules/zlib/1.2.12/MODULE.bazel": "3b1a8834ada2a883674be8cbd36ede1b6ec481477ada359cd2d3ddc562340b27", + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/MODULE.bazel": "eec517b5bbe5492629466e11dae908d043364302283de25581e3eb944326c4ca", + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/source.json": "22bc55c47af97246cfc093d0acf683a7869377de362b5d1c552c2c2e16b7a806", + "https://bcr.bazel.build/modules/zlib/1.3.1/MODULE.bazel": "751c9940dcfe869f5f7274e1295422a34623555916eb98c174c1e945594bf198" + }, + "selectedYankedVersions": {}, + "moduleExtensions": { + "@@pybind11_bazel+//:internal_configure.bzl%internal_configure_extension": { + "general": { + "bzlTransitiveDigest": "G7xCmtNWXRuBtChRgB5OK5+gmM8Uoy8Mec/B7j3fhqs=", + "usagesDigest": "D1r3lfzMuUBFxgG8V6o0bQTLMk3GkaGOaPzw53wrwyw=", + "recordedFileInputs": { + "@@pybind11_bazel+//MODULE.bazel": "e6f4c20442eaa7c90d7190d8dc539d0ab422f95c65a57cc59562170c58ae3d34" + }, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "pybind11": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "build_file": "@@pybind11_bazel+//:pybind11-BUILD.bazel", + "strip_prefix": "pybind11-2.12.0", + "urls": [ + "https://github.com/pybind/pybind11/archive/v2.12.0.zip" + ] + } + } + }, + "recordedRepoMappingEntries": [ + [ + "pybind11_bazel+", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, + "@@rules_apple+//apple:apple.bzl%provisioning_profile_repository_extension": { + "general": { + "bzlTransitiveDigest": "1gIQy+6y4yPMQc1hXiKA5+XxTuwPJfW551UR/SNBYb0=", + "usagesDigest": "vsJl8Rw5NL+5Ag2wdUDoTeRF/5klkXO8545Iy7U1Q08=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "local_provisioning_profiles": { + "repoRuleId": "@@rules_apple+//apple/internal:local_provisioning_profiles.bzl%provisioning_profile_repository", + "attributes": {} + } + }, + "recordedRepoMappingEntries": [ + [ + "apple_support+", + "bazel_skylib", + "bazel_skylib+" + ], + [ + "bazel_tools", + "rules_cc", + "rules_cc+" + ], + [ + "rules_apple+", + "bazel_skylib", + "bazel_skylib+" + ], + [ + "rules_apple+", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_apple+", + "build_bazel_apple_support", + "apple_support+" + ], + [ + "rules_apple+", + "build_bazel_rules_swift", + "rules_swift+" + ], + [ + "rules_cc+", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_cc+", + "rules_cc", + "rules_cc+" + ], + [ + "rules_swift+", + "bazel_skylib", + "bazel_skylib+" + ], + [ + "rules_swift+", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_swift+", + "build_bazel_apple_support", + "apple_support+" + ], + [ + "rules_swift+", + "build_bazel_rules_swift", + "rules_swift+" + ], + [ + "rules_swift+", + "build_bazel_rules_swift_local_config", + "rules_swift++non_module_deps+build_bazel_rules_swift_local_config" + ] + ] + } + }, + "@@rules_apple+//apple:extensions.bzl%non_module_deps": { + "general": { + "bzlTransitiveDigest": "hZq9NZQ3DfMM3SejWMrPlGSZAv38GRVt6iSG5FbwbhQ=", + "usagesDigest": "M3VqFpeTCo4qmrNKGZw0dxBHvTYDrfV3cscGzlSAhQ4=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "xctestrunner": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "urls": [ + "https://github.com/google/xctestrunner/archive/b7698df3d435b6491b4b4c0f9fc7a63fbed5e3a6.tar.gz" + ], + "strip_prefix": "xctestrunner-b7698df3d435b6491b4b4c0f9fc7a63fbed5e3a6", + "sha256": "ae3a063c985a8633cb7eb566db21656f8db8eb9a0edb8c182312c7f0db53730d" + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_apple+", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, + "@@rules_kotlin+//src/main/starlark/core/repositories:bzlmod_setup.bzl%rules_kotlin_extensions": { + "general": { + "bzlTransitiveDigest": "OlvsB0HsvxbR8ZN+J9Vf00X/+WVz/Y/5Xrq2LgcVfdo=", + "usagesDigest": "QI2z8ZUR+mqtbwsf2fLqYdJAkPOHdOV+tF2yVAUgRzw=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "com_github_jetbrains_kotlin_git": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_compiler_git_repository", + "attributes": { + "urls": [ + "https://github.com/JetBrains/kotlin/releases/download/v1.9.23/kotlin-compiler-1.9.23.zip" + ], + "sha256": "93137d3aab9afa9b27cb06a824c2324195c6b6f6179d8a8653f440f5bd58be88" + } + }, + "com_github_jetbrains_kotlin": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_capabilities_repository", + "attributes": { + "git_repository_name": "com_github_jetbrains_kotlin_git", + "compiler_version": "1.9.23" + } + }, + "com_github_google_ksp": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:ksp.bzl%ksp_compiler_plugin_repository", + "attributes": { + "urls": [ + "https://github.com/google/ksp/releases/download/1.9.23-1.0.20/artifacts.zip" + ], + "sha256": "ee0618755913ef7fd6511288a232e8fad24838b9af6ea73972a76e81053c8c2d", + "strip_version": "1.9.23-1.0.20" + } + }, + "com_github_pinterest_ktlint": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", + "attributes": { + "sha256": "01b2e0ef893383a50dbeb13970fe7fa3be36ca3e83259e01649945b09d736985", + "urls": [ + "https://github.com/pinterest/ktlint/releases/download/1.3.0/ktlint" + ], + "executable": true + } + }, + "rules_android": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "sha256": "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806", + "strip_prefix": "rules_android-0.1.1", + "urls": [ + "https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip" + ] + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_kotlin+", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, + "@@rules_python+//python/uv:uv.bzl%uv": { + "general": { + "bzlTransitiveDigest": "PmZM/pIkZKEDDL68TohlKJrWPYKL5VwUw3MA7kmm6fk=", + "usagesDigest": "p80sy6cYQuWxx5jhV3fOTu+N9EyIUFG9+F7UC/nhXic=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "uv": { + "repoRuleId": "@@rules_python+//python/uv/private:uv_toolchains_repo.bzl%uv_toolchains_repo", + "attributes": { + "toolchain_type": "'@@rules_python+//python/uv:uv_toolchain_type'", + "toolchain_names": [ + "none" + ], + "toolchain_implementations": { + "none": "'@@rules_python+//python:none'" + }, + "toolchain_compatible_with": { + "none": [ + "@platforms//:incompatible" + ] + }, + "toolchain_target_settings": {} + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_python+", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_python+", + "platforms", + "platforms" + ] + ] + } + }, + "@@rules_swift+//swift:extensions.bzl%non_module_deps": { + "general": { + "bzlTransitiveDigest": "7HCu9g5L/A6rnapg3vth7ZT5JAXGhHB5cfk39qhGYuM=", + "usagesDigest": "mhACFnrdMv9Wi0Mt67bxocJqviRkDSV+Ee5Mqdj5akA=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "com_github_apple_swift_protobuf": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "urls": [ + "https://github.com/apple/swift-protobuf/archive/1.20.2.tar.gz" + ], + "sha256": "3fb50bd4d293337f202d917b6ada22f9548a0a0aed9d9a4d791e6fbd8a246ebb", + "strip_prefix": "swift-protobuf-1.20.2/", + "build_file": "@@rules_swift+//third_party:com_github_apple_swift_protobuf/BUILD.overlay" + } + }, + "com_github_grpc_grpc_swift": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "urls": [ + "https://github.com/grpc/grpc-swift/archive/1.16.0.tar.gz" + ], + "sha256": "58b60431d0064969f9679411264b82e40a217ae6bd34e17096d92cc4e47556a5", + "strip_prefix": "grpc-swift-1.16.0/", + "build_file": "@@rules_swift+//third_party:com_github_grpc_grpc_swift/BUILD.overlay" + } + }, + "com_github_apple_swift_docc_symbolkit": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "urls": [ + "https://github.com/apple/swift-docc-symbolkit/archive/refs/tags/swift-5.10-RELEASE.tar.gz" + ], + "sha256": "de1d4b6940468ddb53b89df7aa1a81323b9712775b0e33e8254fa0f6f7469a97", + "strip_prefix": "swift-docc-symbolkit-swift-5.10-RELEASE", + "build_file": "@@rules_swift+//third_party:com_github_apple_swift_docc_symbolkit/BUILD.overlay" + } + }, + "com_github_apple_swift_nio": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "urls": [ + "https://github.com/apple/swift-nio/archive/2.42.0.tar.gz" + ], + "sha256": "e3304bc3fb53aea74a3e54bd005ede11f6dc357117d9b1db642d03aea87194a0", + "strip_prefix": "swift-nio-2.42.0/", + "build_file": "@@rules_swift+//third_party:com_github_apple_swift_nio/BUILD.overlay" + } + }, + "com_github_apple_swift_nio_http2": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "urls": [ + "https://github.com/apple/swift-nio-http2/archive/1.26.0.tar.gz" + ], + "sha256": "f0edfc9d6a7be1d587e5b403f2d04264bdfae59aac1d74f7d974a9022c6d2b25", + "strip_prefix": "swift-nio-http2-1.26.0/", + "build_file": "@@rules_swift+//third_party:com_github_apple_swift_nio_http2/BUILD.overlay" + } + }, + "com_github_apple_swift_nio_transport_services": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "urls": [ + "https://github.com/apple/swift-nio-transport-services/archive/1.15.0.tar.gz" + ], + "sha256": "f3498dafa633751a52b9b7f741f7ac30c42bcbeb3b9edca6d447e0da8e693262", + "strip_prefix": "swift-nio-transport-services-1.15.0/", + "build_file": "@@rules_swift+//third_party:com_github_apple_swift_nio_transport_services/BUILD.overlay" + } + }, + "com_github_apple_swift_nio_extras": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "urls": [ + "https://github.com/apple/swift-nio-extras/archive/1.4.0.tar.gz" + ], + "sha256": "4684b52951d9d9937bb3e8ccd6b5daedd777021ef2519ea2f18c4c922843b52b", + "strip_prefix": "swift-nio-extras-1.4.0/", + "build_file": "@@rules_swift+//third_party:com_github_apple_swift_nio_extras/BUILD.overlay" + } + }, + "com_github_apple_swift_log": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "urls": [ + "https://github.com/apple/swift-log/archive/1.4.4.tar.gz" + ], + "sha256": "48fe66426c784c0c20031f15dc17faf9f4c9037c192bfac2f643f65cb2321ba0", + "strip_prefix": "swift-log-1.4.4/", + "build_file": "@@rules_swift+//third_party:com_github_apple_swift_log/BUILD.overlay" + } + }, + "com_github_apple_swift_nio_ssl": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "urls": [ + "https://github.com/apple/swift-nio-ssl/archive/2.23.0.tar.gz" + ], + "sha256": "4787c63f61dd04d99e498adc3d1a628193387e41efddf8de19b8db04544d016d", + "strip_prefix": "swift-nio-ssl-2.23.0/", + "build_file": "@@rules_swift+//third_party:com_github_apple_swift_nio_ssl/BUILD.overlay" + } + }, + "com_github_apple_swift_collections": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "urls": [ + "https://github.com/apple/swift-collections/archive/1.0.4.tar.gz" + ], + "sha256": "d9e4c8a91c60fb9c92a04caccbb10ded42f4cb47b26a212bc6b39cc390a4b096", + "strip_prefix": "swift-collections-1.0.4/", + "build_file": "@@rules_swift+//third_party:com_github_apple_swift_collections/BUILD.overlay" + } + }, + "com_github_apple_swift_atomics": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "urls": [ + "https://github.com/apple/swift-atomics/archive/1.1.0.tar.gz" + ], + "sha256": "1bee7f469f7e8dc49f11cfa4da07182fbc79eab000ec2c17bfdce468c5d276fb", + "strip_prefix": "swift-atomics-1.1.0/", + "build_file": "@@rules_swift+//third_party:com_github_apple_swift_atomics/BUILD.overlay" + } + }, + "build_bazel_rules_swift_index_import": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "build_file": "@@rules_swift+//third_party:build_bazel_rules_swift_index_import/BUILD.overlay", + "canonical_id": "index-import-5.8", + "urls": [ + "https://github.com/MobileNativeFoundation/index-import/releases/download/5.8.0.1/index-import.tar.gz" + ], + "sha256": "28c1ffa39d99e74ed70623899b207b41f79214c498c603915aef55972a851a15" + } + }, + "build_bazel_rules_swift_local_config": { + "repoRuleId": "@@rules_swift+//swift/internal:swift_autoconfiguration.bzl%swift_autoconfiguration", + "attributes": {} + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_swift+", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_swift+", + "build_bazel_rules_swift", + "rules_swift+" + ] + ] + } + } + } +} diff --git a/Makefile b/Makefile deleted file mode 100644 index 793b071..0000000 --- a/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -GO = $(shell which go) -GOMAINSRCS = $(shell find . -type f -name main.go | cut -c 3- | grep -v '^vendor/' | paste -s -d ' ' -) -GOMAINDIRS = $(GOMAINSRCS:/main.go=) -GOOS ?= $(shell $(GO) env GOOS) -GOARCH ?= $(shell $(GO) env GOARCH) - -ifeq ($(GOOS)/$(GOARCH),$(shell env - $(GO) env GOOS)/$(shell env - $(GO) env GOARCH)) -NATIVE_BUILD := 1 -else -NATIVE_BUILD := 0 -endif - -ifeq ($(GOOS)/$(GOARCH),openbsd/amd64) -GOBUILDFLAGS := -trimpath -else -GOBUILDFLAGS := -trimpath -endif - -ifeq ($(NATIVE_BUILD),1) -GOBUILDFLAGS += -tags=pkcs11 -buildmode=pie -endif - -GOMAINS = -ROOT_DOMAIN := fuhry.dev -DEFAULT_REGION := hq -DEFAULT_HOST_DOMAIN := $(DEFAULT_REGION).$(ROOT_DOMAIN) -SD_DOMAIN := v.$(ROOT_DOMAIN) -WEB_SERVICES_DOMAIN := $(ROOT_DOMAIN) -MACHINES_HOST := machines.$(WEB_SERVICES_DOMAIN) -MACHINES_MQTT_TOPIC := machines/events -DBUS_PREFIX := dev.fuhry.runtime -DBUS_PATH := /$(subst .,/,$(DBUS_PREFIX)) -ORG_NAME := FooCorp -ORG_SLUG := runtime -SYSTEM_CONF_DIR := /etc/$(ORG_SLUG) -ROOT_CA_NAME := $(ORG_NAME) Root -INT_CA_NAME := $(ORG_NAME) Intermediate mTLS -DEVICE_TRUST_TOKEN_NAME := $(ORG_NAME) Device Trust - -LDFLAGS := - -LDFLAGS += -X "go.fuhry.dev/runtime/constants.RootDomain=$(ROOT_DOMAIN)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.DefaultRegion=$(DEFAULT_REGION)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.DefaultHostDomain=$(DEFAULT_HOST_DOMAIN)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.SDDomain=$(SD_DOMAIN)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.WebServicesDomain=$(WEB_SERVICES_DOMAIN)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.MachinesHost=$(MACHINES_HOST)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.MachinesMqttTopic=$(MACHINES_MQTT_TOPIC)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.DbusPrefix=$(DBUS_PREFIX)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.DbusPath=$(DBUS_PATH)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.OrgName=$(ORG_NAME)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.OrgSlug=$(ORG_SLUG)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.SystemConfDir=$(SYSTEM_CONF_DIR)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.RootCAName=$(ROOT_CA_NAME)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.IntCAName=$(INT_CA_NAME)" -LDFLAGS += -X "go.fuhry.dev/runtime/constants.DeviceTrustTokenName=$(DEVICE_TRUST_TOKEN_NAME)" - -define GOPROG_template -GOMAINS += $(1)/$(2) -all: $(1)/$(2) -$(1)/$(2): $(wildcard $(1)/*.go) - $(GO) build -ldflags '$$(LDFLAGS)' $$(GOBUILDFLAGS) -o $$@ $$^ - -endef - -$(foreach maindir,$(GOMAINDIRS),$(eval $(call GOPROG_template,$(maindir),$(shell basename $(maindir))))) - -.PHONY: clean all list - -clean: - if test -z "$(GOMAINS)"; then \ - echo "ERROR: Failed to discover main.go sources in tree." >&2; \ - echo "Debug info:" >&2; \ - echo " GOMAINSRCS = $(GOMAINSRCS)" >&2; \ - echo " GOMAINDIRS = $(GOMAINDIRS)" >&2; \ - exit 1; \ - fi - rm -fv $(GOMAINS) - -list: - @LC_ALL=C $(MAKE) -pRrq -f $(firstword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/(^|\n)# Files(\n|$$)/,/(^|\n)# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | grep -E -v -e '^[^[:alnum:]]' -e '^$@$$' diff --git a/REPO.bazel b/REPO.bazel new file mode 100644 index 0000000..e69de29 diff --git a/attestation/Makefile b/attestation/Makefile deleted file mode 100644 index bdb19ef..0000000 --- a/attestation/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -CONFIGURE_ARGS := - -all: cgo c - -.PHONY: clean -clean: - /bin/rm -rfv \ - c/.libs \ - c/autom4te.cache \ - c/build \ - c/include \ - c/modules - - /bin/rm -fv \ - c/config.h \ - c/config.h.in \ - c/config.log \ - c/config.nice \ - c/config.status \ - c/configure \ - c/configure.ac \ - c/libtool \ - c/main.dep \ - c/main.lo \ - c/Makefile \ - c/Makefile.fragments \ - c/Makefile.objects \ - c/tpm_attestation.la \ - c/run-tests.php \ - cgo/libtpmattestation.h \ - cgo/libtpmattestation.so \ - -cgo/libtpmattestation.so: - cd ./cgo && go build -o libtpmattestation.so -buildmode=c-shared ./extension_api.go - -.PHONY: cgo -cgo: cgo/libtpmattestation.so - -c/configure: - cd ./c && phpize - -c/Makefile: c/configure - cd ./c && ./configure $(CONFIGURE_ARGS) - -.PHONY: c -c: c/configure c/Makefile cgo - cd ./c && EXTRA_CFLAGS="-I`pwd`/../cgo -L`pwd`/../cgo -ltpmattestation" make - -install: cgo c - cd ./c && make install - -php.ini: php.ini.in - sed -re 's;@PWD@;$(PWD);g' $< > $@ - -.PHONY: test -test: php.ini c - cd $(PWD)/php && \ - env LD_LIBRARY_PATH=$(PWD)/cgo php -c $(PWD)/php.ini ./vendor/bin/phpunit diff --git a/attestation/cgo/BUILD.bazel b/attestation/cgo/BUILD.bazel new file mode 100644 index 0000000..a3d633d --- /dev/null +++ b/attestation/cgo/BUILD.bazel @@ -0,0 +1,23 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "cgo_lib", + srcs = [ + "extension.h", + "extension_api.go", + "libtpmattestation.h", + ], + cgo = True, + importpath = "go.fuhry.dev/runtime/attestation/cgo", + visibility = ["//visibility:private"], + deps = [ + "//attestation/internal/attestation", + "@com_github_google_go_attestation//attest", + ], +) + +go_binary( + name = "cgo", + embed = [":cgo_lib"], + visibility = ["//visibility:public"], +) diff --git a/attestation/client/BUILD.bazel b/attestation/client/BUILD.bazel new file mode 100644 index 0000000..6db030d --- /dev/null +++ b/attestation/client/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "client_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/attestation/client", + visibility = ["//visibility:private"], + deps = ["//attestation/internal/attestation"], +) + +go_binary( + name = "client", + embed = [":client_lib"], + visibility = ["//visibility:public"], +) diff --git a/attestation/client/Makefile b/attestation/client/Makefile deleted file mode 100644 index bfab546..0000000 --- a/attestation/client/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/attestation/internal/attestation/BUILD.bazel b/attestation/internal/attestation/BUILD.bazel new file mode 100644 index 0000000..5fd6332 --- /dev/null +++ b/attestation/internal/attestation/BUILD.bazel @@ -0,0 +1,24 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "attestation", + srcs = [ + "api.go", + "client.go", + "rpc_server.go", + "server.go", + ], + importpath = "go.fuhry.dev/runtime/attestation/internal/attestation", + visibility = ["//attestation:__subpackages__"], + deps = [ + "//grpc", + "//machines", + "//proto/service/attest", + "//utils/log", + "@com_github_google_certificate_transparency_go//x509", + "@com_github_google_go_attestation//attest", + "@org_golang_google_grpc//peer", + "@org_golang_google_protobuf//encoding/protojson", + "@org_golang_google_protobuf//reflect/protoreflect", + ], +) diff --git a/attestation/rpc_client/BUILD.bazel b/attestation/rpc_client/BUILD.bazel new file mode 100644 index 0000000..6ba0d80 --- /dev/null +++ b/attestation/rpc_client/BUILD.bazel @@ -0,0 +1,20 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "rpc_client_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/attestation/rpc_client", + visibility = ["//visibility:private"], + deps = [ + "//attestation/internal/attestation", + "//grpc", + "//mtls", + "//proto/service/attest", + ], +) + +go_binary( + name = "rpc_client", + embed = [":rpc_client_lib"], + visibility = ["//visibility:public"], +) diff --git a/attestation/rpc_client/Makefile b/attestation/rpc_client/Makefile deleted file mode 100644 index bfab546..0000000 --- a/attestation/rpc_client/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/attestation/rpc_server/BUILD.bazel b/attestation/rpc_server/BUILD.bazel new file mode 100644 index 0000000..4b6aabf --- /dev/null +++ b/attestation/rpc_server/BUILD.bazel @@ -0,0 +1,21 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "rpc_server_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/attestation/rpc_server", + visibility = ["//visibility:private"], + deps = [ + "//attestation/internal/attestation", + "//grpc", + "//mtls", + "//proto/service/attest", + "@org_golang_google_grpc//:grpc", + ], +) + +go_binary( + name = "rpc_server", + embed = [":rpc_server_lib"], + visibility = ["//visibility:public"], +) diff --git a/attestation/rpc_server/Makefile b/attestation/rpc_server/Makefile deleted file mode 100644 index bfab546..0000000 --- a/attestation/rpc_server/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/automation/bryston_ctl/BUILD.bazel b/automation/bryston_ctl/BUILD.bazel new file mode 100644 index 0000000..5a361c4 --- /dev/null +++ b/automation/bryston_ctl/BUILD.bazel @@ -0,0 +1,16 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "bryston_ctl", + srcs = [ + "bryston_ctl.go", + "server.go", + ], + importpath = "go.fuhry.dev/runtime/automation/bryston_ctl", + visibility = ["//visibility:public"], + deps = [ + "//proto/service/bryston_ctl", + "//utils/hashset", + "@st_bug_go_serial//:serial", + ], +) diff --git a/automation/bryston_ctl/cli/BUILD.bazel b/automation/bryston_ctl/cli/BUILD.bazel new file mode 100644 index 0000000..cb55047 --- /dev/null +++ b/automation/bryston_ctl/cli/BUILD.bazel @@ -0,0 +1,19 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "cli_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/automation/bryston_ctl/cli", + visibility = ["//visibility:private"], + deps = [ + "//automation/bryston_ctl", + "//proto/service/bryston_ctl", + "//utils/log", + ], +) + +go_binary( + name = "cli", + embed = [":cli_lib"], + visibility = ["//visibility:public"], +) diff --git a/automation/bryston_ctl/cli/Makefile b/automation/bryston_ctl/cli/Makefile deleted file mode 100644 index bfab546..0000000 --- a/automation/bryston_ctl/cli/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/automation/bryston_ctl/client/BUILD.bazel b/automation/bryston_ctl/client/BUILD.bazel new file mode 100644 index 0000000..29d2dc4 --- /dev/null +++ b/automation/bryston_ctl/client/BUILD.bazel @@ -0,0 +1,21 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "client_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/automation/bryston_ctl/client", + visibility = ["//visibility:private"], + deps = [ + "//automation/bryston_ctl", + "//grpc", + "//mtls", + "//proto/service/bryston_ctl", + "//utils/log", + ], +) + +go_binary( + name = "client", + embed = [":client_lib"], + visibility = ["//visibility:public"], +) diff --git a/automation/bryston_ctl/client/Makefile b/automation/bryston_ctl/client/Makefile deleted file mode 100644 index bfab546..0000000 --- a/automation/bryston_ctl/client/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/automation/bryston_ctl/server/BUILD.bazel b/automation/bryston_ctl/server/BUILD.bazel new file mode 100644 index 0000000..a360b33 --- /dev/null +++ b/automation/bryston_ctl/server/BUILD.bazel @@ -0,0 +1,22 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "server_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/automation/bryston_ctl/server", + visibility = ["//visibility:private"], + deps = [ + "//automation/bryston_ctl", + "//grpc", + "//mtls", + "//proto/service/bryston_ctl", + "//utils/log", + "@org_golang_google_grpc//:grpc", + ], +) + +go_binary( + name = "server", + embed = [":server_lib"], + visibility = ["//visibility:public"], +) diff --git a/automation/bryston_ctl/server/Makefile b/automation/bryston_ctl/server/Makefile deleted file mode 100644 index bfab546..0000000 --- a/automation/bryston_ctl/server/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/bazel/workspace-status b/bazel/workspace-status new file mode 100755 index 0000000..b7641f6 --- /dev/null +++ b/bazel/workspace-status @@ -0,0 +1,49 @@ +#!/bin/bash + +basedir="$(cd "$(dirname "$0")"; pwd)" + +if test -r "$basedir/workspace-status.local"; then + . "$basedir/workspace-status.local" +fi + +ROOT_DOMAIN=${ROOT_DOMAIN:-"fuhry.dev"} +DEFAULT_REGION=${DEFAULT_REGION:-"hq"} +DEFAULT_HOST_DOMAIN=${DEFAULT_HOST_DOMAIN:-"${DEFAULT_REGION}.${ROOT_DOMAIN}"} +SD_DOMAIN=${SD_DOMAIN:-"v.${ROOT_DOMAIN}"} +WEB_SERVICES_DOMAIN=${WEB_SERVICES_DOMAIN:-"${ROOT_DOMAIN}"} +MACHINES_HOST=${MACHINES_HOST:-"machines.${WEB_SERVICES_DOMAIN}"} +MACHINES_MQTT_TOPIC=${MACHINES_MQTT_TOPIC:-"machines/events"} +DBUS_PREFIX=${DBUS_PREFIX:-"dev.fuhry.runtime"} +DBUS_PATH=${DBUS_PATH:-"/${DBUS_PREFIX//\./\/}"} +ORG_NAME=${ORG_NAME:-"FooCorp"} +ORG_SLUG=${ORG_SLUG:-"runtime"} +SYSTEM_CONF_DIR=${SYSTEM_CONF_DIR:-"/etc/${ORG_SLUG}"} +ROOT_CA_NAME=${ROOT_CA_NAME:-"${ORG_NAME} Root"} +INT_CA_NAME=${INT_CA_NAME:-"${ORG_NAME} Intermediate mTLS"} +DEVICE_TRUST_TOKEN_NAME=${DEVICE_TRUST_TOKEN_NAME:-"${ORG_NAME} Device Trust"} +TAG="$(cd "$basedir/.."; git describe HEAD 2>/dev/null)" +VERSION="${TAG:-0.0.0+unset}" + + +vars=( + ROOT_DOMAIN + DEFAULT_REGION + DEFAULT_HOST_DOMAIN + SD_DOMAIN + WEB_SERVICES_DOMAIN + MACHINES_HOST + MACHINES_MQTT_TOPIC + DBUS_PREFIX + DBUS_PATH + ORG_NAME + ORG_SLUG + SYSTEM_CONF_DIR + ROOT_CA_NAME + INT_CA_NAME + DEVICE_TRUST_TOKEN_NAME + VERSION +) + +for var in "${vars[@]}"; do + echo "$var ${!var}" +done diff --git a/cmd/apcups_exporter/BUILD.bazel b/cmd/apcups_exporter/BUILD.bazel new file mode 100644 index 0000000..fc8d960 --- /dev/null +++ b/cmd/apcups_exporter/BUILD.bazel @@ -0,0 +1,20 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "apcups_exporter_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/apcups_exporter", + visibility = ["//visibility:private"], + deps = [ + "//metrics/metricbus/mbclient", + "//utils/log", + "@com_github_coreos_go_systemd//daemon", + "@com_github_mdlayher_apcupsd//:apcupsd", + ], +) + +go_binary( + name = "apcups_exporter", + embed = [":apcups_exporter_lib"], + visibility = ["//visibility:public"], +) diff --git a/metrics/apcups_exporter/main.go b/cmd/apcups_exporter/main.go similarity index 100% rename from metrics/apcups_exporter/main.go rename to cmd/apcups_exporter/main.go diff --git a/metrics/apcups_exporter/systemd/apcupsd-exporter.service b/cmd/apcups_exporter/systemd/apcupsd-exporter.service similarity index 100% rename from metrics/apcups_exporter/systemd/apcupsd-exporter.service rename to cmd/apcups_exporter/systemd/apcupsd-exporter.service diff --git a/cmd/config_watcher_demo/BUILD.bazel b/cmd/config_watcher_demo/BUILD.bazel new file mode 100644 index 0000000..5105797 --- /dev/null +++ b/cmd/config_watcher_demo/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "config_watcher_demo_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/config_watcher_demo", + visibility = ["//visibility:private"], + deps = [ + "//config_watcher", + "//utils/log", + ], +) + +go_binary( + name = "config_watcher_demo", + embed = [":config_watcher_demo_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/dns_resolve/BUILD.bazel b/cmd/dns_resolve/BUILD.bazel new file mode 100644 index 0000000..754c68f --- /dev/null +++ b/cmd/dns_resolve/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "dns_resolve_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/dns_resolve", + visibility = ["//visibility:private"], + deps = [ + "//net/dns", + "//utils/log", + ], +) + +go_binary( + name = "dns_resolve", + embed = [":dns_resolve_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/echo_client/BUILD.bazel b/cmd/echo_client/BUILD.bazel new file mode 100644 index 0000000..6f28a7b --- /dev/null +++ b/cmd/echo_client/BUILD.bazel @@ -0,0 +1,20 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "echo_client_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/echo_client", + visibility = ["//visibility:private"], + deps = [ + "//grpc", + "//mtls", + "//proto/service/echo", + "//utils/log", + ], +) + +go_binary( + name = "echo_client", + embed = [":echo_client_lib"], + visibility = ["//visibility:public"], +) diff --git a/echo/client/main.go b/cmd/echo_client/main.go similarity index 100% rename from echo/client/main.go rename to cmd/echo_client/main.go diff --git a/cmd/echo_server/BUILD.bazel b/cmd/echo_server/BUILD.bazel new file mode 100644 index 0000000..db44ca8 --- /dev/null +++ b/cmd/echo_server/BUILD.bazel @@ -0,0 +1,21 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "echo_server_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/echo_server", + visibility = ["//visibility:private"], + deps = [ + "//echo", + "//grpc", + "//mtls", + "//proto/service/echo", + "@org_golang_google_grpc//:grpc", + ], +) + +go_binary( + name = "echo_server", + embed = [":echo_server_lib"], + visibility = ["//visibility:public"], +) diff --git a/echo/server/echo_acl.yaml b/cmd/echo_server/echo_acl.yaml similarity index 100% rename from echo/server/echo_acl.yaml rename to cmd/echo_server/echo_acl.yaml diff --git a/echo/server/main.go b/cmd/echo_server/main.go similarity index 100% rename from echo/server/main.go rename to cmd/echo_server/main.go diff --git a/cmd/ephs_client/BUILD.bazel b/cmd/ephs_client/BUILD.bazel new file mode 100644 index 0000000..e0a14f5 --- /dev/null +++ b/cmd/ephs_client/BUILD.bazel @@ -0,0 +1,20 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "ephs_client_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/ephs_client", + visibility = ["//visibility:private"], + deps = [ + "//constants", + "//ephs", + "//utils/log", + "@com_github_urfave_cli_v3//:cli", + ], +) + +go_binary( + name = "ephs_client", + embed = [":ephs_client_lib"], + visibility = ["//visibility:public"], +) diff --git a/ephs/client/main.go b/cmd/ephs_client/main.go similarity index 100% rename from ephs/client/main.go rename to cmd/ephs_client/main.go diff --git a/cmd/ephs_server/BUILD.bazel b/cmd/ephs_server/BUILD.bazel new file mode 100644 index 0000000..f983df0 --- /dev/null +++ b/cmd/ephs_server/BUILD.bazel @@ -0,0 +1,22 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "ephs_server_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/ephs_server", + visibility = ["//visibility:private"], + deps = [ + "//ephs/servicer", + "//grpc", + "//mtls", + "//proto/service/ephs", + "//utils/log", + "@org_golang_google_grpc//:grpc", + ], +) + +go_binary( + name = "ephs_server", + embed = [":ephs_server_lib"], + visibility = ["//visibility:public"], +) diff --git a/ephs/server/ephs_acl.yaml b/cmd/ephs_server/ephs_acl.yaml similarity index 100% rename from ephs/server/ephs_acl.yaml rename to cmd/ephs_server/ephs_acl.yaml diff --git a/ephs/server/main.go b/cmd/ephs_server/main.go similarity index 100% rename from ephs/server/main.go rename to cmd/ephs_server/main.go diff --git a/ephs/server/rules.yaml b/cmd/ephs_server/rules.yaml similarity index 100% rename from ephs/server/rules.yaml rename to cmd/ephs_server/rules.yaml diff --git a/cmd/fsnotify/BUILD.bazel b/cmd/fsnotify/BUILD.bazel new file mode 100644 index 0000000..15b8a54 --- /dev/null +++ b/cmd/fsnotify/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "fsnotify_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/fsnotify", + visibility = ["//visibility:private"], + deps = [ + "//mtls/fsnotify", + "//utils/log", + ], +) + +go_binary( + name = "fsnotify", + embed = [":fsnotify_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/grpc_health_probe/BUILD.bazel b/cmd/grpc_health_probe/BUILD.bazel new file mode 100644 index 0000000..cda6e8e --- /dev/null +++ b/cmd/grpc_health_probe/BUILD.bazel @@ -0,0 +1,20 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "grpc_health_probe_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/grpc_health_probe", + visibility = ["//visibility:private"], + deps = [ + "//grpc", + "//mtls", + "//utils/log", + "@org_golang_google_grpc//health/grpc_health_v1", + ], +) + +go_binary( + name = "grpc_health_probe", + embed = [":grpc_health_probe_lib"], + visibility = ["//visibility:public"], +) diff --git a/grpc/health_probe/main.go b/cmd/grpc_health_probe/main.go similarity index 100% rename from grpc/health_probe/main.go rename to cmd/grpc_health_probe/main.go diff --git a/cmd/http_proxy/BUILD.bazel b/cmd/http_proxy/BUILD.bazel new file mode 100644 index 0000000..b296f29 --- /dev/null +++ b/cmd/http_proxy/BUILD.bazel @@ -0,0 +1,22 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "http_proxy_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/http_proxy", + visibility = ["//visibility:private"], + deps = [ + "//config_watcher", + "//ephs", + "//http", + "//utils/log", + "@com_github_coreos_go_systemd//daemon", + "@in_gopkg_yaml_v3//:yaml_v3", + ], +) + +go_binary( + name = "http_proxy", + embed = [":http_proxy_lib"], + visibility = ["//visibility:public"], +) diff --git a/http/proxy/main.go b/cmd/http_proxy/main.go similarity index 100% rename from http/proxy/main.go rename to cmd/http_proxy/main.go diff --git a/cmd/http_proxy/systemd/http-proxy@.service b/cmd/http_proxy/systemd/http-proxy@.service new file mode 100644 index 0000000..9175d0b --- /dev/null +++ b/cmd/http_proxy/systemd/http-proxy@.service @@ -0,0 +1,10 @@ +[Unit] +Description=Proxy instance %i + +[Service] +Type=notify +User=http +ExecStart=/usr/bin/proxy -config=/etc/runtime/proxy/%i.yaml + +[Install] +WantedBy=default.target diff --git a/cmd/ldap_health_exporter/BUILD.bazel b/cmd/ldap_health_exporter/BUILD.bazel new file mode 100644 index 0000000..ed82caa --- /dev/null +++ b/cmd/ldap_health_exporter/BUILD.bazel @@ -0,0 +1,22 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "ldap_health_exporter_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/ldap_health_exporter", + visibility = ["//visibility:private"], + deps = [ + "//ldap", + "//mtls", + "@com_github_sirupsen_logrus//:logrus", + "@com_github_urfave_cli_v2//:cli", + "@com_github_urfave_cli_v2//altsrc", + "@org_golang_x_sync//errgroup", + ], +) + +go_binary( + name = "ldap_health_exporter", + embed = [":ldap_health_exporter_lib"], + visibility = ["//visibility:public"], +) diff --git a/ldap/health_exporter/main.go b/cmd/ldap_health_exporter/main.go similarity index 100% rename from ldap/health_exporter/main.go rename to cmd/ldap_health_exporter/main.go diff --git a/ldap/health_exporter/systemd/ldap-health-exporter@.service b/cmd/ldap_health_exporter/systemd/ldap-health-exporter@.service similarity index 100% rename from ldap/health_exporter/systemd/ldap-health-exporter@.service rename to cmd/ldap_health_exporter/systemd/ldap-health-exporter@.service diff --git a/cmd/machines_agent/BUILD.bazel b/cmd/machines_agent/BUILD.bazel new file mode 100644 index 0000000..9cb4a85 --- /dev/null +++ b/cmd/machines_agent/BUILD.bazel @@ -0,0 +1,20 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "machines_agent_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/machines_agent", + visibility = ["//visibility:private"], + deps = [ + "//machines", + "//metrics/metricbus/mbclient", + "//utils/daemon", + "//utils/log", + ], +) + +go_binary( + name = "machines_agent", + embed = [":machines_agent_lib"], + visibility = ["//visibility:public"], +) diff --git a/machines/machines_agent/main.go b/cmd/machines_agent/main.go similarity index 100% rename from machines/machines_agent/main.go rename to cmd/machines_agent/main.go diff --git a/cmd/machines_event_monitor/BUILD.bazel b/cmd/machines_event_monitor/BUILD.bazel new file mode 100644 index 0000000..1e73bcf --- /dev/null +++ b/cmd/machines_event_monitor/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "machines_event_monitor_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/machines_event_monitor", + visibility = ["//visibility:private"], + deps = [ + "//machines", + "//utils/log", + ], +) + +go_binary( + name = "machines_event_monitor", + embed = [":machines_event_monitor_lib"], + visibility = ["//visibility:public"], +) diff --git a/machines/event_monitor/main.go b/cmd/machines_event_monitor/main.go similarity index 100% rename from machines/event_monitor/main.go rename to cmd/machines_event_monitor/main.go diff --git a/cmd/metricbus_server/BUILD.bazel b/cmd/metricbus_server/BUILD.bazel new file mode 100644 index 0000000..7a2dbc7 --- /dev/null +++ b/cmd/metricbus_server/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "metricbus_server_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/metricbus_server", + visibility = ["//visibility:private"], + deps = [ + "//metrics/metricbus/mbserver", + "//utils/log", + ], +) + +go_binary( + name = "metricbus_server", + embed = [":metricbus_server_lib"], + visibility = ["//visibility:public"], +) diff --git a/metrics/metricbus/mbserver/main.go b/cmd/metricbus_server/main.go similarity index 79% rename from metrics/metricbus/mbserver/main.go rename to cmd/metricbus_server/main.go index 237116c..c48621c 100644 --- a/metrics/metricbus/mbserver/main.go +++ b/cmd/metricbus_server/main.go @@ -6,7 +6,7 @@ import ( "os/signal" "syscall" - mbinternal "go.fuhry.dev/runtime/metrics/metricbus/internal" + "go.fuhry.dev/runtime/metrics/metricbus/mbserver" "go.fuhry.dev/runtime/utils/log" ) @@ -16,7 +16,7 @@ func main() { flag.Parse() - mbs, err := mbinternal.NewMetricBusServer() + mbs, err := mbserver.NewMetricBusServer() if err != nil { log.Panic(err) } diff --git a/cmd/mtls_exporter/BUILD.bazel b/cmd/mtls_exporter/BUILD.bazel new file mode 100644 index 0000000..797409d --- /dev/null +++ b/cmd/mtls_exporter/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "mtls_exporter_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/mtls_exporter", + visibility = ["//visibility:private"], + deps = [ + "//metrics/mtls", + "@com_github_coreos_go_systemd//daemon", + ], +) + +go_binary( + name = "mtls_exporter", + embed = [":mtls_exporter_lib"], + visibility = ["//visibility:public"], +) diff --git a/mtls/mtls_exporter/main.go b/cmd/mtls_exporter/main.go similarity index 100% rename from mtls/mtls_exporter/main.go rename to cmd/mtls_exporter/main.go diff --git a/mtls/mtls_exporter/systemd/mtls-exporter.service b/cmd/mtls_exporter/systemd/mtls-exporter.service similarity index 100% rename from mtls/mtls_exporter/systemd/mtls-exporter.service rename to cmd/mtls_exporter/systemd/mtls-exporter.service diff --git a/cmd/mtls_supervisor/BUILD.bazel b/cmd/mtls_supervisor/BUILD.bazel new file mode 100644 index 0000000..103280f --- /dev/null +++ b/cmd/mtls_supervisor/BUILD.bazel @@ -0,0 +1,24 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "mtls_supervisor_lib", + srcs = [ + "main.go", + "test_mode.go", + ], + importpath = "go.fuhry.dev/runtime/cmd/mtls_supervisor", + visibility = ["//visibility:private"], + deps = [ + "//mtls/fsnotify", + "//utils/debounce", + "//utils/hashset", + "//utils/log", + "@org_golang_x_sys//unix", + ], +) + +go_binary( + name = "mtls_supervisor", + embed = [":mtls_supervisor_lib"], + visibility = ["//visibility:public"], +) diff --git a/mtls/supervisor/main.go b/cmd/mtls_supervisor/main.go similarity index 100% rename from mtls/supervisor/main.go rename to cmd/mtls_supervisor/main.go diff --git a/mtls/supervisor/test_mode.go b/cmd/mtls_supervisor/test_mode.go similarity index 100% rename from mtls/supervisor/test_mode.go rename to cmd/mtls_supervisor/test_mode.go diff --git a/cmd/mtls_verify_tool/BUILD.bazel b/cmd/mtls_verify_tool/BUILD.bazel new file mode 100644 index 0000000..5ba2f6d --- /dev/null +++ b/cmd/mtls_verify_tool/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "mtls_verify_tool_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/mtls_verify_tool", + visibility = ["//visibility:private"], + deps = [ + "//mtls", + "//utils/log", + ], +) + +go_binary( + name = "mtls_verify_tool", + embed = [":mtls_verify_tool_lib"], + visibility = ["//visibility:public"], +) diff --git a/mtls/verify_tool/main.go b/cmd/mtls_verify_tool/main.go similarity index 100% rename from mtls/verify_tool/main.go rename to cmd/mtls_verify_tool/main.go diff --git a/cmd/prometheus_http_discovery/BUILD.bazel b/cmd/prometheus_http_discovery/BUILD.bazel new file mode 100644 index 0000000..01c072d --- /dev/null +++ b/cmd/prometheus_http_discovery/BUILD.bazel @@ -0,0 +1,21 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "prometheus_http_discovery_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/prometheus_http_discovery", + visibility = ["//visibility:private"], + deps = [ + "//constants", + "//mtls", + "//sd", + "//utils/log", + "@com_github_coreos_go_systemd//daemon", + ], +) + +go_binary( + name = "prometheus_http_discovery", + embed = [":prometheus_http_discovery_lib"], + visibility = ["//visibility:public"], +) diff --git a/metrics/prometheus_http_discovery/main.go b/cmd/prometheus_http_discovery/main.go similarity index 100% rename from metrics/prometheus_http_discovery/main.go rename to cmd/prometheus_http_discovery/main.go diff --git a/metrics/prometheus_http_discovery/systemd/prometheus-http-discovery.service b/cmd/prometheus_http_discovery/systemd/prometheus-http-discovery.service similarity index 100% rename from metrics/prometheus_http_discovery/systemd/prometheus-http-discovery.service rename to cmd/prometheus_http_discovery/systemd/prometheus-http-discovery.service diff --git a/cmd/sase_ws_proxy_client/BUILD.bazel b/cmd/sase_ws_proxy_client/BUILD.bazel new file mode 100644 index 0000000..bd2c944 --- /dev/null +++ b/cmd/sase_ws_proxy_client/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "sase_ws_proxy_client_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/sase_ws_proxy_client", + visibility = ["//visibility:private"], + deps = [ + "//mtls", + "//sase", + ], +) + +go_binary( + name = "sase_ws_proxy_client", + embed = [":sase_ws_proxy_client_lib"], + visibility = ["//visibility:public"], +) diff --git a/sase/ws_proxy_client/main.go b/cmd/sase_ws_proxy_client/main.go similarity index 100% rename from sase/ws_proxy_client/main.go rename to cmd/sase_ws_proxy_client/main.go diff --git a/cmd/sase_ws_tcp_proxy/BUILD.bazel b/cmd/sase_ws_tcp_proxy/BUILD.bazel new file mode 100644 index 0000000..aae5a06 --- /dev/null +++ b/cmd/sase_ws_tcp_proxy/BUILD.bazel @@ -0,0 +1,21 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "sase_ws_tcp_proxy_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/sase_ws_tcp_proxy", + visibility = ["//visibility:private"], + deps = [ + "//constants", + "//mtls", + "//rand", + "//sase", + "//sd", + ], +) + +go_binary( + name = "sase_ws_tcp_proxy", + embed = [":sase_ws_tcp_proxy_lib"], + visibility = ["//visibility:public"], +) diff --git a/sase/ws_tcp_proxy/main.go b/cmd/sase_ws_tcp_proxy/main.go similarity index 100% rename from sase/ws_tcp_proxy/main.go rename to cmd/sase_ws_tcp_proxy/main.go diff --git a/cmd/sd_health_exporter/BUILD.bazel b/cmd/sd_health_exporter/BUILD.bazel new file mode 100644 index 0000000..061f94f --- /dev/null +++ b/cmd/sd_health_exporter/BUILD.bazel @@ -0,0 +1,19 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "sd_health_exporter_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/sd_health_exporter", + visibility = ["//visibility:private"], + deps = [ + "//mtls", + "//sd", + "@io_etcd_go_etcd_client_v3//:client", + ], +) + +go_binary( + name = "sd_health_exporter", + embed = [":sd_health_exporter_lib"], + visibility = ["//visibility:public"], +) diff --git a/sd/health_exporter/main.go b/cmd/sd_health_exporter/main.go similarity index 100% rename from sd/health_exporter/main.go rename to cmd/sd_health_exporter/main.go diff --git a/cmd/sd_publish/BUILD.bazel b/cmd/sd_publish/BUILD.bazel new file mode 100644 index 0000000..ca300a0 --- /dev/null +++ b/cmd/sd_publish/BUILD.bazel @@ -0,0 +1,19 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "sd_publish_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/sd_publish", + visibility = ["//visibility:private"], + deps = [ + "//constants", + "//sd", + "//utils/hostname", + ], +) + +go_binary( + name = "sd_publish", + embed = [":sd_publish_lib"], + visibility = ["//visibility:public"], +) diff --git a/sd/sd_publish/main.go b/cmd/sd_publish/main.go similarity index 100% rename from sd/sd_publish/main.go rename to cmd/sd_publish/main.go diff --git a/cmd/sd_register/BUILD.bazel b/cmd/sd_register/BUILD.bazel new file mode 100644 index 0000000..e69af4e --- /dev/null +++ b/cmd/sd_register/BUILD.bazel @@ -0,0 +1,20 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "sd_register_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/sd_register", + visibility = ["//visibility:private"], + deps = [ + "//constants", + "//sd", + "//utils/hostname", + "//utils/log", + ], +) + +go_binary( + name = "sd_register", + embed = [":sd_register_lib"], + visibility = ["//visibility:public"], +) diff --git a/sd/sd_register/main.go b/cmd/sd_register/main.go similarity index 100% rename from sd/sd_register/main.go rename to cmd/sd_register/main.go diff --git a/cmd/sd_watcher/BUILD.bazel b/cmd/sd_watcher/BUILD.bazel new file mode 100644 index 0000000..a22f229 --- /dev/null +++ b/cmd/sd_watcher/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "sd_watcher_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/cmd/sd_watcher", + visibility = ["//visibility:private"], + deps = [ + "//constants", + "//sd", + ], +) + +go_binary( + name = "sd_watcher", + embed = [":sd_watcher_lib"], + visibility = ["//visibility:public"], +) diff --git a/sd/sd_watcher/main.go b/cmd/sd_watcher/main.go similarity index 100% rename from sd/sd_watcher/main.go rename to cmd/sd_watcher/main.go diff --git a/config_watcher/BUILD.bazel b/config_watcher/BUILD.bazel new file mode 100644 index 0000000..42da7fa --- /dev/null +++ b/config_watcher/BUILD.bazel @@ -0,0 +1,17 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "config_watcher", + srcs = [ + "backend_ephs.go", + "backend_local.go", + "watcher.go", + ], + importpath = "go.fuhry.dev/runtime/config_watcher", + visibility = ["//visibility:public"], + deps = [ + "//ephs", + "//mtls/fsnotify", + "//utils/log", + ], +) diff --git a/constants/BUILD.bazel b/constants/BUILD.bazel new file mode 100644 index 0000000..079a725 --- /dev/null +++ b/constants/BUILD.bazel @@ -0,0 +1,25 @@ +load("@rules_go//go:def.bzl", "go_library") + +genrule( + name = "constants_go", + srcs = ["constants.go.in"], + outs = ["constants.go"], + cmd_bash = """ + sedexp=() + while read line; do + varname="$$(cut -d\\ -f1 <<< "$$line")" + len=$$(( $${#varname} + 1 )) + varval="$${line:$$len}" + sedexp+=("-e" 's;\\$$'"$$varname;$$varval;g") + done < bazel-out/volatile-status.txt + sed -r "$${sedexp[@]}" < "$<" > "$@" + """, + stamp = 1, +) + +go_library( + name = "constants", + srcs = ["constants.go"], + importpath = "go.fuhry.dev/runtime/constants", + visibility = ["//visibility:public"], +) diff --git a/constants/constants.go b/constants/constants.go deleted file mode 100644 index dfced59..0000000 --- a/constants/constants.go +++ /dev/null @@ -1,25 +0,0 @@ -package constants - -import "strings" - -var ( - RootDomain = "fuhry.dev" - DefaultRegion = "hq" - DefaultHostDomain = DefaultRegion + "." + RootDomain - SDDomain = "v." + RootDomain - WebServicesDomain = RootDomain - MachinesHost = "machines." + WebServicesDomain - MachinesMqttTopic = "machines/events" - DbusPrefix = "dev.fuhry.runtime" - DbusPath = "/" + strings.ReplaceAll(DbusPrefix, ".", "/") - - OrgName = "FooCorp" - OrgSlug = "runtime" - SystemConfDir = "/etc/" + OrgSlug - - RootCAName = OrgName + " Root" - IntCAName = OrgName + " Intermediate mTLS" - DeviceTrustTokenName = OrgName + " Device Trust" - - Version = "0.0.0+unset" -) diff --git a/constants/constants.go.in b/constants/constants.go.in new file mode 100644 index 0000000..dc549a6 --- /dev/null +++ b/constants/constants.go.in @@ -0,0 +1,23 @@ +package constants + +const ( + RootDomain = "$ROOT_DOMAIN" + DefaultRegion = "$DEFAULT_REGION" + DefaultHostDomain = "$DEFAULT_HOST_DOMAIN" + SDDomain = "$SD_DOMAIN" + WebServicesDomain = "$WEB_SERVICES_DOMAIN" + MachinesHost = "$MACHINES_HOST" + MachinesMqttTopic = "$MACHINES_MQTT_TOPIC" + DbusPrefix = "$DBUS_PREFIX" + DbusPath = "$DBUS_PATH" + + OrgName = "$ORG_NAME" + OrgSlug = "$ORG_SLUG" + SystemConfDir = "$SYSTEM_CONF_DIR" + + RootCAName = "$ROOT_CA_NAME" + IntCAName = "$INT_CA_NAME" + DeviceTrustTokenName = "$DEVICE_TRUST_TOKEN_NAME" + + Version = "$VERSION" +) diff --git a/echo/BUILD.bazel b/echo/BUILD.bazel new file mode 100644 index 0000000..9992ff0 --- /dev/null +++ b/echo/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "echo", + srcs = ["server.go"], + importpath = "go.fuhry.dev/runtime/echo", + visibility = ["//visibility:public"], + deps = [ + "//grpc", + "//proto/service/echo", + "@org_golang_google_grpc//peer", + "@org_golang_x_text//cases", + "@org_golang_x_text//language", + ], +) diff --git a/echo/client/Makefile b/echo/client/Makefile deleted file mode 100644 index bfab546..0000000 --- a/echo/client/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/echo/server/Makefile b/echo/server/Makefile deleted file mode 100644 index bfab546..0000000 --- a/echo/server/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/ephs/BUILD.bazel b/ephs/BUILD.bazel new file mode 100644 index 0000000..d5ead53 --- /dev/null +++ b/ephs/BUILD.bazel @@ -0,0 +1,17 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "ephs", + srcs = ["client.go"], + importpath = "go.fuhry.dev/runtime/ephs", + visibility = ["//visibility:public"], + deps = [ + "//grpc", + "//mtls", + "//proto/service/ephs", + "//utils/log", + "@com_github_quic_go_quic_go//:quic-go", + "@org_golang_google_grpc//codes", + "@org_golang_google_grpc//status", + ], +) diff --git a/ephs/server/Makefile b/ephs/server/Makefile deleted file mode 100644 index bfab546..0000000 --- a/ephs/server/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/ephs/servicer/BUILD.bazel b/ephs/servicer/BUILD.bazel new file mode 100644 index 0000000..0a8aae7 --- /dev/null +++ b/ephs/servicer/BUILD.bazel @@ -0,0 +1,44 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "servicer", + srcs = [ + "acl.go", + "fs_object.go", + "s3.go", + "servicer.go", + "writer.go", + ], + importpath = "go.fuhry.dev/runtime/ephs/servicer", + visibility = ["//visibility:public"], + deps = [ + "//constants", + "//ephs", + "//grpc", + "//mtls", + "//mtls/fsnotify", + "//proto/service/ephs", + "//sd", + "//utils/hostname", + "//utils/log", + "//utils/stringmatch", + "@com_github_minio_minio_go_v7//:minio-go", + "@com_github_minio_minio_go_v7//pkg/credentials", + "@in_gopkg_yaml_v3//:yaml_v3", + "@io_etcd_go_etcd_client_v3//:client", + "@io_etcd_go_etcd_client_v3//concurrency", + "@org_golang_google_grpc//codes", + "@org_golang_google_grpc//peer", + "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//proto", + "@org_golang_google_protobuf//types/known/emptypb", + "@org_golang_google_protobuf//types/known/timestamppb", + ], +) + +go_test( + name = "servicer_test", + srcs = ["acl_test.go"], + embed = [":servicer"], + deps = ["@com_github_stretchr_testify//assert"], +) diff --git a/grpc/BUILD.bazel b/grpc/BUILD.bazel new file mode 100644 index 0000000..9d13723 --- /dev/null +++ b/grpc/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "grpc", + srcs = [ + "client.go", + "conn_base.go", + "conn_quic.go", + "conn_tcp.go", + "context.go", + "healthcheck.go", + "server.go", + ], + importpath = "go.fuhry.dev/runtime/grpc", + visibility = ["//visibility:public"], + deps = [ + "//grpc/acl", + "//mtls", + "//mtls/certutil", + "//sd", + "//utils/hostname", + "//utils/log", + "@com_github_hashicorp_golang_lru_v2//:golang-lru", + "@com_github_quic_go_quic_go//:quic-go", + "@dev_fuhry_go_grpc_quic//:grpc-quic", + "@org_golang_google_grpc//:grpc", + "@org_golang_google_grpc//codes", + "@org_golang_google_grpc//credentials", + "@org_golang_google_grpc//health/grpc_health_v1", + "@org_golang_google_grpc//peer", + "@org_golang_google_grpc//status", + ], +) diff --git a/grpc/acl/BUILD.bazel b/grpc/acl/BUILD.bazel new file mode 100644 index 0000000..d3e0896 --- /dev/null +++ b/grpc/acl/BUILD.bazel @@ -0,0 +1,14 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "acl", + srcs = ["acl_yaml.go"], + importpath = "go.fuhry.dev/runtime/grpc/acl", + visibility = ["//visibility:public"], + deps = [ + "//constants", + "//mtls", + "//utils/log", + "@in_gopkg_yaml_v3//:yaml_v3", + ], +) diff --git a/http/BUILD.bazel b/http/BUILD.bazel new file mode 100644 index 0000000..b489a99 --- /dev/null +++ b/http/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "http", + srcs = [ + "http.go", + "proxy_protocol.go", + "range.go", + "route_action_healthcheck.go", + "route_action_proxy.go", + "route_action_redirect.go", + "route_action_s3.go", + "route_action_saml.go", + "server.go", + "sni_listener.go", + "tcp.go", + ], + importpath = "go.fuhry.dev/runtime/http", + visibility = ["//visibility:public"], + deps = [ + "//mtls", + "//mtls/certutil", + "//net", + "//net/dns", + "//utils/hashset", + "//utils/log", + "//utils/stringmatch", + "@com_github_crewjam_saml//:saml", + "@com_github_crewjam_saml//samlsp", + "@com_github_minio_minio_go_v7//:minio-go", + "@com_github_minio_minio_go_v7//pkg/credentials", + "@in_gopkg_yaml_v3//:yaml_v3", + ], +) + +go_test( + name = "http_test", + srcs = ["proxy_protocol_test.go"], + embed = [":http"], + deps = ["@com_github_stretchr_testify//assert"], +) diff --git a/http/client/BUILD.bazel b/http/client/BUILD.bazel new file mode 100644 index 0000000..c27fa1c --- /dev/null +++ b/http/client/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "client_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/http/client", + visibility = ["//visibility:private"], + deps = [ + "//mtls", + "//utils/log", + ], +) + +go_binary( + name = "client", + embed = [":client_lib"], + visibility = ["//visibility:public"], +) diff --git a/http/proxy/Makefile b/http/proxy/Makefile deleted file mode 100644 index bfab546..0000000 --- a/http/proxy/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/ldap/BUILD.bazel b/ldap/BUILD.bazel new file mode 100644 index 0000000..6942854 --- /dev/null +++ b/ldap/BUILD.bazel @@ -0,0 +1,21 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "ldap", + srcs = [ + "scraper.go", + "server.go", + ], + importpath = "go.fuhry.dev/runtime/ldap", + visibility = ["//visibility:public"], + deps = [ + "//mtls", + "//mtls/certutil", + "@com_github_go_kit_log//:log", + "@com_github_go_ldap_ldap_v3//:ldap", + "@com_github_prometheus_client_golang//prometheus", + "@com_github_prometheus_client_golang//prometheus/promhttp", + "@com_github_prometheus_exporter_toolkit//web", + "@com_github_sirupsen_logrus//:logrus", + ], +) diff --git a/ldap/health_exporter/Makefile b/ldap/health_exporter/Makefile deleted file mode 100644 index bfab546..0000000 --- a/ldap/health_exporter/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/machines/BUILD.bazel b/machines/BUILD.bazel new file mode 100644 index 0000000..b48f1d0 --- /dev/null +++ b/machines/BUILD.bazel @@ -0,0 +1,72 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "machines", + srcs = [ + "agent.go", + "client.go", + "event_watcher.go", + "oauth2.go", + "render.go", + "router_addresses_bsd.go", + "router_addresses_linux.go", + "services.go", + "services_linux.go", + "services_openbsd.go", + "stats.go", + "types.go", + ], + embedsrcs = [ + "templates/corefile.conf.j2", + "templates/dhcpd4.conf.j2", + "templates/dhcpd6.conf.j2", + "templates/forward.zone.j2", + "templates/hostname.bridge.j2", + "templates/hostname.native.j2", + "templates/hostname.vlan.j2", + "templates/maclist.conf.j2", + "templates/named.conf.j2", + "templates/pf-captive-portal.conf.j2", + "templates/rad.conf.j2", + "templates/radvd.conf.j2", + "templates/reverse.zone.j2", + "templates/rtadvd.conf.j2", + "templates/unreg-lockdown.conf.j2", + ], + importpath = "go.fuhry.dev/runtime/machines", + visibility = ["//visibility:public"], + deps = [ + "//constants", + "//metrics/metricbus/mbclient", + "//net/dns", + "//utils/hashset", + "//utils/hostname", + "//utils/log", + "@com_github_eclipse_paho_mqtt_golang//:paho_mqtt_golang", + "@com_github_miekg_dns//:dns", + "@com_github_nikolalohinski_gonja//:gonja", + "@com_github_nikolalohinski_gonja//config", + "@in_gopkg_ini_v1//:ini_v1", + ] + select({ + "@rules_go//go/platform:android": [ + "@com_github_coreos_go_systemd_v22//dbus", + "@com_github_vishvananda_netlink//:netlink", + "@org_golang_x_sys//unix", + ], + "@rules_go//go/platform:linux": [ + "@com_github_coreos_go_systemd_v22//dbus", + "@com_github_vishvananda_netlink//:netlink", + "@org_golang_x_sys//unix", + ], + "//conditions:default": [], + }), +) + +go_test( + name = "machines_test", + srcs = ["types_test.go"], + deps = [ + ":machines", + "@com_github_stretchr_testify//require", + ], +) diff --git a/machines/coredns_plugin/BUILD.bazel b/machines/coredns_plugin/BUILD.bazel new file mode 100644 index 0000000..28605ad --- /dev/null +++ b/machines/coredns_plugin/BUILD.bazel @@ -0,0 +1,25 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "coredns_plugin", + srcs = [ + "registry.go", + "registry_store.go", + "setup.go", + "stats.go", + ], + importpath = "go.fuhry.dev/runtime/machines/coredns_plugin", + visibility = ["//visibility:public"], + deps = [ + "//constants", + "//machines", + "//metrics/metricbus/mbclient", + "//utils/hostname", + "//utils/log", + "//utils/strings2", + "@com_github_coredns_caddy//:caddy", + "@com_github_coredns_coredns//core/dnsserver", + "@com_github_coredns_coredns//plugin", + "@com_github_miekg_dns//:dns", + ], +) diff --git a/machines/event_monitor/Makefile b/machines/event_monitor/Makefile deleted file mode 100644 index bfab546..0000000 --- a/machines/event_monitor/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/machines/machines_agent/Makefile b/machines/machines_agent/Makefile deleted file mode 100644 index bfab546..0000000 --- a/machines/machines_agent/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/machines/types.go b/machines/types.go index 9095926..b3edbfc 100644 --- a/machines/types.go +++ b/machines/types.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "net" + "regexp" "slices" "strings" "sync" @@ -25,6 +26,7 @@ type IPv6OrInterfaceString string type HexEncoded string type IPv4PrefixLength uint8 type IPv6PrefixLength uint8 +type MACAddress string type ErrUnhandledRecordType string @@ -626,3 +628,41 @@ func (i *Iface) ShouldPublishInDNS() bool { return true } + +func ParseMACAddress(input string) MACAddress { + charset := regexp.MustCompile("[^0-9a-f]") + sets := charset.Split(strings.ToLower(input), -1) + switch len(sets) { + case 1: + return MACAddress(fmt.Sprintf("%012s", input)) + case 2, 3, 4, 6: + n := 12 / len(sets) + fmtstr := fmt.Sprintf("%%0%ds", n) + for i := range sets { + sets[i] = fmt.Sprintf(fmtstr, sets[i]) + } + return MACAddress(strings.Join(sets, "")) + default: + return MACAddress("000000000000") + } +} + +func (m MACAddress) Split(sep string, n int) string { + var chunks []string + for i := 0; i < len(m); i += n { + chunks = append(chunks, string(m)[i:i+n]) + } + return strings.Join(chunks, sep) +} + +func (m MACAddress) Standard() string { + return m.Split(":", 2) +} + +func (m MACAddress) Dashes() string { + return m.Split("-", 2) +} + +func (m MACAddress) Cisco() string { + return m.Split(".", 4) +} diff --git a/machines/types_test.go b/machines/types_test.go index a996938..9357ffc 100644 --- a/machines/types_test.go +++ b/machines/types_test.go @@ -28,3 +28,38 @@ func TestIPString(t *testing.T) { require.Equal(t, tc.rdns, tc.ip.ReverseDNSName()) } } + +func TestParseMACAddress(t *testing.T) { + type testCase struct { + in string + expect string + } + + testCases := []*testCase{ + {"010203040506", "010203040506"}, + {"00:02:04:06:08:0a", "00020406080a"}, + {"0:2:4:6:8:a", "00020406080a"}, + } + + for _, tc := range testCases { + require.Equal(t, tc.expect, string(machines.ParseMACAddress(tc.in))) + } +} + +func TestFormatMACAddress(t *testing.T) { + type testCase struct { + addr machines.MACAddress + sep string + n int + expect string + } + + testCases := []*testCase{ + {machines.MACAddress("010203040506"), ":", 2, "01:02:03:04:05:06"}, + {machines.MACAddress("a0b0c0d0e0f0"), ".", 4, "a0b0.c0d0.e0f0"}, + } + + for _, tc := range testCases { + require.Equal(t, tc.expect, tc.addr.Split(tc.sep, tc.n)) + } +} diff --git a/metrics/apcups_exporter/Makefile b/metrics/apcups_exporter/Makefile deleted file mode 100644 index bfab546..0000000 --- a/metrics/apcups_exporter/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/metrics/demo/BUILD.bazel b/metrics/demo/BUILD.bazel new file mode 100644 index 0000000..c259b3a --- /dev/null +++ b/metrics/demo/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "demo_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/metrics/demo", + visibility = ["//visibility:private"], + deps = [ + "//metrics/metricbus", + "//metrics/metricbus/mbclient", + ], +) + +go_binary( + name = "demo", + embed = [":demo_lib"], + visibility = ["//visibility:public"], +) diff --git a/metrics/metricbus/BUILD.bazel b/metrics/metricbus/BUILD.bazel new file mode 100644 index 0000000..6dd6ffc --- /dev/null +++ b/metrics/metricbus/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "metricbus", + srcs = ["constants.go"], + importpath = "go.fuhry.dev/runtime/metrics/metricbus", + visibility = ["//visibility:public"], + deps = [ + "//constants", + "@com_github_godbus_dbus_v5//:dbus", + ], +) diff --git a/metrics/metricbus/internal/BUILD.bazel b/metrics/metricbus/internal/BUILD.bazel new file mode 100644 index 0000000..659a769 --- /dev/null +++ b/metrics/metricbus/internal/BUILD.bazel @@ -0,0 +1,23 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "internal", + srcs = [ + "dbus_interface.go", + "server.go", + ], + importpath = "go.fuhry.dev/runtime/metrics/metricbus/internal", + visibility = ["//metrics/metricbus:__subpackages__"], + deps = [ + "//constants", + "//metrics/metricbus", + "//mtls", + "//sd", + "//utils/hashset", + "//utils/hostname", + "//utils/log", + "@com_github_godbus_dbus_v5//:dbus", + "@com_github_godbus_dbus_v5//introspect", + "@org_uber_go_atomic//:atomic", + ], +) diff --git a/metrics/metricbus/internal/server.go b/metrics/metricbus/internal/server.go index 2b976b3..fd6dc50 100644 --- a/metrics/metricbus/internal/server.go +++ b/metrics/metricbus/internal/server.go @@ -93,6 +93,10 @@ func init() { flag.UintVar(&defaultMetricBusHttpServerPort, "metricbus.server.port", 0, "https server port to listen on; if 0, a random port is assigned by the OS") } +func DefaultMetricBusHttpServerPort() uint { + return defaultMetricBusHttpServerPort +} + func NewMetricBusServer() (*mbServer, error) { if !flag.Parsed() { return nil, errors.New("flags have not been parsed, cannot determine server port") diff --git a/metrics/metricbus/mbclient/BUILD.bazel b/metrics/metricbus/mbclient/BUILD.bazel new file mode 100644 index 0000000..27d91d0 --- /dev/null +++ b/metrics/metricbus/mbclient/BUILD.bazel @@ -0,0 +1,29 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "mbclient", + srcs = [ + "common.go", + "conn.go", + "dbus_client.go", + "dbus_metrics.go", + "httpserver_client.go", + "httpserver_metrics.go", + "httpserver_utils.go", + "intf.go", + ], + importpath = "go.fuhry.dev/runtime/metrics/metricbus/mbclient", + visibility = ["//visibility:public"], + deps = [ + "//constants", + "//metrics/metricbus", + "//metrics/metricbus/internal", + "//mtls", + "//sd", + "//utils/hostname", + "//utils/log", + "//utils/rollout", + "@com_github_godbus_dbus_v5//:dbus", + "@org_uber_go_atomic//:atomic", + ], +) diff --git a/metrics/metricbus/mbclient/dbus_client.go b/metrics/metricbus/mbclient/dbus_client.go index 76c019c..28aad5f 100644 --- a/metrics/metricbus/mbclient/dbus_client.go +++ b/metrics/metricbus/mbclient/dbus_client.go @@ -48,11 +48,11 @@ func init() { flag.StringVar(&defaultMetricBusServiceDiscriminator, "metricbus.client.service-discriminator", "", "discriminator to use by default for publishing metrics") } -func NewService(ctx context.Context) MetricBusService { - return NewServiceWithDiscriminator(ctx, defaultMetricBusServiceDiscriminator) +func NewDBusService(ctx context.Context) MetricBusService { + return NewDBusServiceWithDiscriminator(ctx, defaultMetricBusServiceDiscriminator) } -func NewServiceWithDiscriminator(ctx context.Context, instanceDiscriminator string) MetricBusService { +func NewDBusServiceWithDiscriminator(ctx context.Context, instanceDiscriminator string) MetricBusService { storeLock.Lock() defer storeLock.Unlock() diff --git a/metrics/metricbus/mbclient/example/BUILD.bazel b/metrics/metricbus/mbclient/example/BUILD.bazel new file mode 100644 index 0000000..0220762 --- /dev/null +++ b/metrics/metricbus/mbclient/example/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "example_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/metrics/metricbus/mbclient/example", + visibility = ["//visibility:private"], + deps = ["//metrics/metricbus/mbclient"], +) + +go_binary( + name = "example", + embed = [":example_lib"], + visibility = ["//visibility:public"], +) diff --git a/metrics/metricbus/mbclient/example/Makefile b/metrics/metricbus/mbclient/example/Makefile deleted file mode 100644 index bfab546..0000000 --- a/metrics/metricbus/mbclient/example/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/metrics/metricbus/mbserver/Makefile b/metrics/metricbus/mbserver/Makefile deleted file mode 100644 index bfab546..0000000 --- a/metrics/metricbus/mbserver/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/metrics/mtls/BUILD.bazel b/metrics/mtls/BUILD.bazel new file mode 100644 index 0000000..066b46b --- /dev/null +++ b/metrics/mtls/BUILD.bazel @@ -0,0 +1,16 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "mtls", + srcs = ["stats.go"], + importpath = "go.fuhry.dev/runtime/metrics/mtls", + visibility = ["//visibility:public"], + deps = [ + "//metrics/metricbus/mbclient", + "//mtls", + "//mtls/certutil", + "//mtls/fsnotify", + "//utils/hashset", + "//utils/log", + ], +) diff --git a/metrics/prometheus_http_discovery/Makefile b/metrics/prometheus_http_discovery/Makefile deleted file mode 100644 index bfab546..0000000 --- a/metrics/prometheus_http_discovery/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/mtls/BUILD.bazel b/mtls/BUILD.bazel new file mode 100644 index 0000000..6ef0447 --- /dev/null +++ b/mtls/BUILD.bazel @@ -0,0 +1,36 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "mtls", + srcs = [ + "identity.go", + "provider_anonymous.go", + "provider_file.go", + "provider_interface.go", + "provider_keychain_macos.go", + "provider_shared.go", + "verify_names.go", + "verify_roots.go", + ], + importpath = "go.fuhry.dev/runtime/mtls", + visibility = ["//visibility:public"], + deps = [ + "//mtls/certutil", + "//mtls/fsnotify", + "//utils/fsutil", + "//utils/hashset", + "//utils/log", + ] + select({ + "@rules_go//go/platform:darwin": [ + "//constants", + "//utils/stringmatch", + "@com_github_keybase_go_keychain//:go-keychain", + ], + "@rules_go//go/platform:ios": [ + "//constants", + "//utils/stringmatch", + "@com_github_keybase_go_keychain//:go-keychain", + ], + "//conditions:default": [], + }), +) diff --git a/mtls/certutil/BUILD.bazel b/mtls/certutil/BUILD.bazel new file mode 100644 index 0000000..ad82664 --- /dev/null +++ b/mtls/certutil/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "certutil", + srcs = ["certutil.go"], + importpath = "go.fuhry.dev/runtime/mtls/certutil", + visibility = ["//visibility:public"], +) diff --git a/mtls/fsnotify/BUILD.bazel b/mtls/fsnotify/BUILD.bazel new file mode 100644 index 0000000..76a690a --- /dev/null +++ b/mtls/fsnotify/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "fsnotify", + srcs = [ + "fsnotify.go", + "util.go", + ], + importpath = "go.fuhry.dev/runtime/mtls/fsnotify", + visibility = ["//visibility:public"], + deps = [ + "//utils/hashset", + "//utils/log", + "@dev_fuhry_go_fsnotify//:fsnotify", + ], +) + +go_test( + name = "fsnotify_test", + srcs = [ + "all_test.go", + "fsnotify_test.go", + "util_test.go", + ], + embed = [":fsnotify"], + deps = [ + "//utils/checkers", + "//utils/hashset", + "@dev_fuhry_go_fsnotify//:fsnotify", + "@in_gopkg_check_v1//:check_v1", + ], +) diff --git a/mtls/supervisor/Makefile b/mtls/supervisor/Makefile deleted file mode 100644 index 1d7d424..0000000 --- a/mtls/supervisor/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(GOSRC:.go=) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: %.go - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/mtls/verify_tool/Makefile b/mtls/verify_tool/Makefile deleted file mode 100644 index 1d7d424..0000000 --- a/mtls/verify_tool/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(GOSRC:.go=) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: %.go - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/net/BUILD.bazel b/net/BUILD.bazel new file mode 100644 index 0000000..b2ae290 --- /dev/null +++ b/net/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "net", + srcs = ["happy_eyeballs.go"], + importpath = "go.fuhry.dev/runtime/net", + visibility = ["//visibility:public"], + deps = [ + "//net/dns", + "//utils/log", + ], +) diff --git a/net/dns/BUILD.bazel b/net/dns/BUILD.bazel new file mode 100644 index 0000000..055b39c --- /dev/null +++ b/net/dns/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "dns", + srcs = [ + "dns_cache.go", + "hosts.go", + ], + importpath = "go.fuhry.dev/runtime/net/dns", + visibility = ["//visibility:public"], + deps = [ + "//utils/fsutil", + "//utils/hostname", + "//utils/log", + "@com_github_hashicorp_golang_lru//:golang-lru", + "@com_github_miekg_dns//:dns", + ], +) diff --git a/proto/service/attest/BUILD.bazel b/proto/service/attest/BUILD.bazel new file mode 100644 index 0000000..f9436a6 --- /dev/null +++ b/proto/service/attest/BUILD.bazel @@ -0,0 +1,26 @@ +load("@rules_go//go:def.bzl", "go_library") + +filegroup( + name = "go_default_library_protos", + srcs = ["attest_server.proto"], + visibility = ["//visibility:public"], +) + +go_library( + name = "attest", + srcs = [ + "attest_server.pb.go", + "attest_server_grpc.pb.go", + "convert.go", + ], + importpath = "go.fuhry.dev/runtime/proto/service/attest", + visibility = ["//visibility:public"], + deps = [ + "@com_github_google_go_attestation//attest", + "@org_golang_google_grpc//:grpc", + "@org_golang_google_grpc//codes", + "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//reflect/protoreflect", + "@org_golang_google_protobuf//runtime/protoimpl", + ], +) diff --git a/proto/service/attest/Makefile b/proto/service/attest/Makefile deleted file mode 100644 index 501225c..0000000 --- a/proto/service/attest/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -PROTO_SRCS := $(wildcard *.proto) -PROTO_GO_OUTPUT := $(PROTO_SRCS:.proto=.pb.go) $(PROTO_SRCS:.proto=_grpc.pb.go) - -$(PROTO_GO_OUTPUT): $(PROTO_SRCS) - protoc --go_out=. --go_opt=paths=source_relative \ - --go-grpc_out=. --go-grpc_opt=paths=source_relative \ - $(PROTO_SRCS) - -pb_go: $(PROTO_GO_OUTPUT) - -all: pb_go - -clean: - rm -fv $(PROTO_GO_OUTPUT) diff --git a/proto/service/bryston_ctl/BUILD.bazel b/proto/service/bryston_ctl/BUILD.bazel new file mode 100644 index 0000000..bb46bad --- /dev/null +++ b/proto/service/bryston_ctl/BUILD.bazel @@ -0,0 +1,24 @@ +load("@rules_go//go:def.bzl", "go_library") + +filegroup( + name = "go_default_library_protos", + srcs = ["bryston_ctl.proto"], + visibility = ["//visibility:public"], +) + +go_library( + name = "bryston_ctl", + srcs = [ + "bryston_ctl.pb.go", + "bryston_ctl_grpc.pb.go", + ], + importpath = "go.fuhry.dev/runtime/proto/service/bryston_ctl", + visibility = ["//visibility:public"], + deps = [ + "@org_golang_google_grpc//:grpc", + "@org_golang_google_grpc//codes", + "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//reflect/protoreflect", + "@org_golang_google_protobuf//runtime/protoimpl", + ], +) diff --git a/proto/service/bryston_ctl/Makefile b/proto/service/bryston_ctl/Makefile deleted file mode 100644 index 55b35ee..0000000 --- a/proto/service/bryston_ctl/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -PROTO_SRCS := $(wildcard *.proto) -PROTO_GO_OUTPUT := $(PROTO_SRCS:.proto=.pb.go) - -$(PROTO_GO_OUTPUT): $(PROTO_SRCS) - protoc --go_out=. --go_opt=paths=source_relative \ - --go-grpc_out=. --go-grpc_opt=paths=source_relative \ - --php_out=. \ - $(PROTO_SRCS) - -pb_go: $(PROTO_GO_OUTPUT) - -all: pb_go \ No newline at end of file diff --git a/proto/service/echo/BUILD.bazel b/proto/service/echo/BUILD.bazel new file mode 100644 index 0000000..018ccc2 --- /dev/null +++ b/proto/service/echo/BUILD.bazel @@ -0,0 +1,24 @@ +load("@rules_go//go:def.bzl", "go_library") + +filegroup( + name = "go_default_library_protos", + srcs = ["echo_server.proto"], + visibility = ["//visibility:public"], +) + +go_library( + name = "echo", + srcs = [ + "echo_server.pb.go", + "echo_server_grpc.pb.go", + ], + importpath = "go.fuhry.dev/runtime/proto/service/echo", + visibility = ["//visibility:public"], + deps = [ + "@org_golang_google_grpc//:grpc", + "@org_golang_google_grpc//codes", + "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//reflect/protoreflect", + "@org_golang_google_protobuf//runtime/protoimpl", + ], +) diff --git a/proto/service/echo/Makefile b/proto/service/echo/Makefile deleted file mode 100644 index cc9ec69..0000000 --- a/proto/service/echo/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PROTO_SRCS := $(wildcard *.proto) -PROTO_GO_OUTPUT := $(PROTO_SRCS:.proto=.pb.go) - -$(PROTO_GO_OUTPUT): $(PROTO_SRCS) - protoc --go_out=. --go_opt=paths=source_relative \ - --go-grpc_out=. --go-grpc_opt=paths=source_relative \ - $(PROTO_SRCS) - -pb_go: $(PROTO_GO_OUTPUT) - -all: pb_go \ No newline at end of file diff --git a/proto/service/ephs/BUILD.bazel b/proto/service/ephs/BUILD.bazel new file mode 100644 index 0000000..e60699b --- /dev/null +++ b/proto/service/ephs/BUILD.bazel @@ -0,0 +1,30 @@ +load("@rules_go//go:def.bzl", "go_library") + +filegroup( + name = "go_default_library_protos", + srcs = [ + "service.proto", + "types.proto", + ], + visibility = ["//visibility:public"], +) + +go_library( + name = "ephs", + srcs = [ + "service.pb.go", + "service_grpc.pb.go", + "types.pb.go", + ], + importpath = "go.fuhry.dev/runtime/proto/service/ephs", + visibility = ["//visibility:public"], + deps = [ + "@org_golang_google_grpc//:grpc", + "@org_golang_google_grpc//codes", + "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//reflect/protoreflect", + "@org_golang_google_protobuf//runtime/protoimpl", + "@org_golang_google_protobuf//types/known/emptypb", + "@org_golang_google_protobuf//types/known/timestamppb", + ], +) diff --git a/proto/service/ephs/Makefile b/proto/service/ephs/Makefile deleted file mode 100644 index 501225c..0000000 --- a/proto/service/ephs/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -PROTO_SRCS := $(wildcard *.proto) -PROTO_GO_OUTPUT := $(PROTO_SRCS:.proto=.pb.go) $(PROTO_SRCS:.proto=_grpc.pb.go) - -$(PROTO_GO_OUTPUT): $(PROTO_SRCS) - protoc --go_out=. --go_opt=paths=source_relative \ - --go-grpc_out=. --go-grpc_opt=paths=source_relative \ - $(PROTO_SRCS) - -pb_go: $(PROTO_GO_OUTPUT) - -all: pb_go - -clean: - rm -fv $(PROTO_GO_OUTPUT) diff --git a/proto/service/secrets/BUILD.bazel b/proto/service/secrets/BUILD.bazel new file mode 100644 index 0000000..353fb50 --- /dev/null +++ b/proto/service/secrets/BUILD.bazel @@ -0,0 +1,26 @@ +load("@rules_go//go:def.bzl", "go_library") + +filegroup( + name = "go_default_library_protos", + srcs = ["secrets.proto"], + visibility = ["//visibility:public"], +) + +go_library( + name = "secrets", + srcs = [ + "secrets.pb.go", + "secrets_grpc.pb.go", + ], + importpath = "go.fuhry.dev/runtime/proto/service/secrets", + visibility = ["//visibility:public"], + deps = [ + "@org_golang_google_grpc//:grpc", + "@org_golang_google_grpc//codes", + "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//reflect/protoreflect", + "@org_golang_google_protobuf//runtime/protoimpl", + "@org_golang_google_protobuf//types/known/anypb", + "@org_golang_google_protobuf//types/known/timestamppb", + ], +) diff --git a/rand/BUILD.bazel b/rand/BUILD.bazel new file mode 100644 index 0000000..3ebfe66 --- /dev/null +++ b/rand/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "rand", + srcs = ["range.go"], + importpath = "go.fuhry.dev/runtime/rand", + visibility = ["//visibility:public"], +) diff --git a/resume/BUILD.bazel b/resume/BUILD.bazel new file mode 100644 index 0000000..99abda9 --- /dev/null +++ b/resume/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "resume", + srcs = [ + "resume.go", + "types.go", + ], + importpath = "go.fuhry.dev/runtime/resume", + visibility = ["//visibility:public"], + deps = ["@com_github_nyaruka_phonenumbers//:phonenumbers"], +) diff --git a/resume/cmd/resume/BUILD.bazel b/resume/cmd/resume/BUILD.bazel new file mode 100644 index 0000000..9c916bf --- /dev/null +++ b/resume/cmd/resume/BUILD.bazel @@ -0,0 +1,14 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "resume_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/resume/cmd/resume", + visibility = ["//visibility:private"], +) + +go_binary( + name = "resume", + embed = [":resume_lib"], + visibility = ["//visibility:public"], +) diff --git a/sase/BUILD.bazel b/sase/BUILD.bazel new file mode 100644 index 0000000..6aef301 --- /dev/null +++ b/sase/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "sase", + srcs = [ + "acl.go", + "client.go", + "machines_networks.go", + "read_writer.go", + "ws_proxy.go", + ], + importpath = "go.fuhry.dev/runtime/sase", + visibility = ["//visibility:public"], + deps = [ + "//constants", + "//machines", + "//mtls", + "//net", + "//net/dns", + "//utils/generics", + "//utils/log", + "@com_github_gorilla_websocket//:websocket", + ], +) + +go_test( + name = "sase_test", + srcs = ["acl_test.go"], + embed = [":sase"], + deps = ["@in_gopkg_check_v1//:check_v1"], +) diff --git a/sase/ws_proxy.go b/sase/ws_proxy.go index 461ce51..4ed90d9 100644 --- a/sase/ws_proxy.go +++ b/sase/ws_proxy.go @@ -10,6 +10,7 @@ import ( "time" "github.com/gorilla/websocket" + rnet "go.fuhry.dev/runtime/net" "go.fuhry.dev/runtime/net/dns" "go.fuhry.dev/runtime/utils/log" ) @@ -117,7 +118,7 @@ func (wsp *WebSocketProxy) handle(w http.ResponseWriter, r *http.Request) { dialCtx, dialCancel := context.WithTimeout(reqCtx, 5*time.Second) defer dialCancel() - conn, err := dialHappyEyeballs(dialCtx, wsReq.addr, wsReq.port) + conn, err := rnet.DialHappyEyeballs(dialCtx, wsReq.addr, wsReq.port) if err != nil { wsp.replyBadGateway(w, err.Error()) diff --git a/sase/ws_proxy_client/Makefile b/sase/ws_proxy_client/Makefile deleted file mode 100644 index de40e1d..0000000 --- a/sase/ws_proxy_client/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath -tags=pkcs11 - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/sase/ws_tcp_proxy/Makefile b/sase/ws_tcp_proxy/Makefile deleted file mode 100644 index bfab546..0000000 --- a/sase/ws_tcp_proxy/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/sd/BUILD.bazel b/sd/BUILD.bazel new file mode 100644 index 0000000..9f1257b --- /dev/null +++ b/sd/BUILD.bazel @@ -0,0 +1,31 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "sd", + srcs = [ + "etcd_factory.go", + "healthcheck.go", + "healthcheck_http.go", + "healthcheck_ldap.go", + "monitor.go", + "publish.go", + "watcher.go", + ], + importpath = "go.fuhry.dev/runtime/sd", + visibility = ["//visibility:public"], + deps = [ + "//constants", + "//mtls", + "//mtls/certutil", + "//net/dns", + "//utils", + "//utils/hostname", + "//utils/log", + "@com_github_go_ldap_ldap_v3//:ldap", + "@io_etcd_go_etcd_api_v3//v3rpc/rpctypes", + "@io_etcd_go_etcd_client_pkg_v3//srv", + "@io_etcd_go_etcd_client_v3//:client", + "@org_golang_google_grpc//codes", + "@org_golang_google_grpc//status", + ], +) diff --git a/sd/health_exporter/Makefile b/sd/health_exporter/Makefile deleted file mode 100644 index bfab546..0000000 --- a/sd/health_exporter/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/sd/sd_publish/Makefile b/sd/sd_publish/Makefile deleted file mode 100644 index bfab546..0000000 --- a/sd/sd_publish/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/sd/sd_register/Makefile b/sd/sd_register/Makefile deleted file mode 100644 index bfab546..0000000 --- a/sd/sd_register/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/sd/sd_watcher/Makefile b/sd/sd_watcher/Makefile deleted file mode 100644 index bfab546..0000000 --- a/sd/sd_watcher/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/thirdparty/gogoproto/BUILD.bazel b/thirdparty/gogoproto/BUILD.bazel new file mode 100644 index 0000000..56ab7d8 --- /dev/null +++ b/thirdparty/gogoproto/BUILD.bazel @@ -0,0 +1,5 @@ +load("@gazelle//:def.bzl", "gazelle") + +# gazelle:proto legacy + +gazelle(name = "gazelle") diff --git a/thirdparty/registry/BUILD.bazel b/thirdparty/registry/BUILD.bazel new file mode 100644 index 0000000..f91e4d0 --- /dev/null +++ b/thirdparty/registry/BUILD.bazel @@ -0,0 +1,30 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "registry_lib", + srcs = ["main.go"], + importpath = "go.fuhry.dev/runtime/thirdparty/registry", + visibility = ["//visibility:private"], + deps = [ + "//constants", + "//grpc", + "//metrics/metricbus/mbclient", + "//mtls", + "//sd", + "//utils/log", + "@com_github_distribution_distribution_v3//configuration", + "@com_github_distribution_distribution_v3//registry/auth/htpasswd", + "@com_github_distribution_distribution_v3//registry/auth/silly", + "@com_github_distribution_distribution_v3//registry/auth/token", + "@com_github_distribution_distribution_v3//registry/handlers", + "@com_github_distribution_distribution_v3//registry/proxy", + "@com_github_distribution_distribution_v3//registry/storage/driver/filesystem", + "@com_github_distribution_distribution_v3//registry/storage/driver/s3-aws", + ], +) + +go_binary( + name = "registry", + embed = [":registry_lib"], + visibility = ["//visibility:public"], +) diff --git a/thirdparty/registry/Makefile b/thirdparty/registry/Makefile deleted file mode 100644 index bfab546..0000000 --- a/thirdparty/registry/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -GOSRC = $(wildcard *.go) -GOEXE = $(shell basename `pwd`) -GOBUILDFLAGS := -buildmode=pie -trimpath - -all: $(GOEXE) - -clean: - rm -fv $(GOEXE) - -.PHONY: all clean - -$(GOEXE): %: $(GOSRC) - go build $(GOBUILDFLAGS) -o $@ $< - diff --git a/utils/BUILD.bazel b/utils/BUILD.bazel new file mode 100644 index 0000000..5bff527 --- /dev/null +++ b/utils/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "utils", + srcs = ["reverse.go"], + importpath = "go.fuhry.dev/runtime/utils", + visibility = ["//visibility:public"], +) diff --git a/utils/ansi/BUILD.bazel b/utils/ansi/BUILD.bazel new file mode 100644 index 0000000..0e828b7 --- /dev/null +++ b/utils/ansi/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "ansi", + srcs = ["color.go"], + importpath = "go.fuhry.dev/runtime/utils/ansi", + visibility = ["//visibility:public"], +) diff --git a/utils/checkers/BUILD.bazel b/utils/checkers/BUILD.bazel new file mode 100644 index 0000000..6a05106 --- /dev/null +++ b/utils/checkers/BUILD.bazel @@ -0,0 +1,9 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "checkers", + srcs = ["contains_key.go"], + importpath = "go.fuhry.dev/runtime/utils/checkers", + visibility = ["//visibility:public"], + deps = ["@in_gopkg_check_v1//:check_v1"], +) diff --git a/utils/daemon/BUILD.bazel b/utils/daemon/BUILD.bazel new file mode 100644 index 0000000..0f586ff --- /dev/null +++ b/utils/daemon/BUILD.bazel @@ -0,0 +1,30 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "daemon", + srcs = [ + "constants_linux.go", + "constants_linux_arm64.go", + "constants_unix.go", + "daemonize.go", + "pidfile.go", + "process_linux.go", + "process_unix.go", + "socket_pair.go", + ], + importpath = "go.fuhry.dev/runtime/utils/daemon", + visibility = ["//visibility:public"], + deps = [ + "//constants", + "//utils/hashset", + "//utils/log", + ] + select({ + "@rules_go//go/platform:freebsd": [ + "@com_github_mitchellh_go_ps//:go-ps", + ], + "@rules_go//go/platform:netbsd": [ + "@com_github_mitchellh_go_ps//:go-ps", + ], + "//conditions:default": [], + }), +) diff --git a/utils/debounce/BUILD.bazel b/utils/debounce/BUILD.bazel new file mode 100644 index 0000000..491997a --- /dev/null +++ b/utils/debounce/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "debounce", + srcs = ["debounce.go"], + importpath = "go.fuhry.dev/runtime/utils/debounce", + visibility = ["//visibility:public"], +) + +go_test( + name = "debounce_test", + srcs = ["debounce_test.go"], + embed = [":debounce"], + deps = ["@in_gopkg_check_v1//:check_v1"], +) diff --git a/utils/fsutil/BUILD.bazel b/utils/fsutil/BUILD.bazel new file mode 100644 index 0000000..006933b --- /dev/null +++ b/utils/fsutil/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "fsutil", + srcs = ["file.go"], + importpath = "go.fuhry.dev/runtime/utils/fsutil", + visibility = ["//visibility:public"], +) diff --git a/utils/generics/BUILD.bazel b/utils/generics/BUILD.bazel new file mode 100644 index 0000000..42b1a52 --- /dev/null +++ b/utils/generics/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "generics", + srcs = ["math.go"], + importpath = "go.fuhry.dev/runtime/utils/generics", + visibility = ["//visibility:public"], +) diff --git a/utils/hashset/BUILD.bazel b/utils/hashset/BUILD.bazel new file mode 100644 index 0000000..5ca84f5 --- /dev/null +++ b/utils/hashset/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "hashset", + srcs = ["hashset.go"], + importpath = "go.fuhry.dev/runtime/utils/hashset", + visibility = ["//visibility:public"], +) + +go_test( + name = "hashset_test", + srcs = ["hashset_test.go"], + embed = [":hashset"], + deps = [ + "@in_gopkg_check_v1//:check_v1", + "@org_golang_x_exp//slices", + ], +) diff --git a/utils/hostname/BUILD.bazel b/utils/hostname/BUILD.bazel new file mode 100644 index 0000000..886070e --- /dev/null +++ b/utils/hostname/BUILD.bazel @@ -0,0 +1,73 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "hostname", + srcs = [ + "hostname.go", + "hostname_common.go", + "hostname_generic.go", + "hostname_linux.go", + "hostname_macos.go", + "hostname_openbsd.go", + ], + importpath = "go.fuhry.dev/runtime/utils/hostname", + visibility = ["//visibility:public"], + deps = select({ + "@rules_go//go/platform:aix": [ + "//constants", + ], + "@rules_go//go/platform:android": [ + "//utils/fsutil", + "//utils/log", + ], + "@rules_go//go/platform:darwin": [ + "//constants", + "//utils/log", + "@net_howett_plist//:plist", + ], + "@rules_go//go/platform:dragonfly": [ + "//constants", + ], + "@rules_go//go/platform:freebsd": [ + "//constants", + ], + "@rules_go//go/platform:illumos": [ + "//constants", + ], + "@rules_go//go/platform:ios": [ + "//constants", + "//utils/log", + "@net_howett_plist//:plist", + ], + "@rules_go//go/platform:js": [ + "//constants", + ], + "@rules_go//go/platform:linux": [ + "//utils/fsutil", + "//utils/log", + ], + "@rules_go//go/platform:netbsd": [ + "//constants", + ], + "@rules_go//go/platform:openbsd": [ + "//constants", + "//utils/log", + ], + "@rules_go//go/platform:osx": [ + "//constants", + ], + "@rules_go//go/platform:plan9": [ + "//constants", + ], + "@rules_go//go/platform:qnx": [ + "//constants", + ], + "@rules_go//go/platform:solaris": [ + "//constants", + ], + "@rules_go//go/platform:windows": [ + "//constants", + ], + "//conditions:default": [], + }), +) diff --git a/utils/log/BUILD.bazel b/utils/log/BUILD.bazel new file mode 100644 index 0000000..a0526cf --- /dev/null +++ b/utils/log/BUILD.bazel @@ -0,0 +1,18 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "log", + srcs = [ + "http.go", + "level.go", + "log.go", + "util.go", + "writer.go", + ], + importpath = "go.fuhry.dev/runtime/utils/log", + visibility = ["//visibility:public"], + deps = [ + "//utils/ansi", + "@org_golang_x_term//:term", + ], +) diff --git a/utils/rollout/BUILD.bazel b/utils/rollout/BUILD.bazel new file mode 100644 index 0000000..95c7444 --- /dev/null +++ b/utils/rollout/BUILD.bazel @@ -0,0 +1,14 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "rollout", + srcs = ["rollout.go"], + importpath = "go.fuhry.dev/runtime/utils/rollout", + visibility = ["//visibility:public"], + deps = [ + "//sd", + "//utils/log", + "@io_etcd_go_etcd_api_v3//mvccpb", + "@io_etcd_go_etcd_client_v3//:client", + ], +) diff --git a/utils/slices2/BUILD.bazel b/utils/slices2/BUILD.bazel new file mode 100644 index 0000000..0fb9a05 --- /dev/null +++ b/utils/slices2/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "slices2", + srcs = ["map.go"], + importpath = "go.fuhry.dev/runtime/utils/slices2", + visibility = ["//visibility:public"], +) diff --git a/utils/stringmatch/BUILD.bazel b/utils/stringmatch/BUILD.bazel new file mode 100644 index 0000000..51fc68c --- /dev/null +++ b/utils/stringmatch/BUILD.bazel @@ -0,0 +1,27 @@ +load("@rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "stringmatch", + srcs = [ + "matchers.go", + "serialization.go", + "serialization2.go", + ], + importpath = "go.fuhry.dev/runtime/utils/stringmatch", + visibility = ["//visibility:public"], + deps = ["//utils/slices2"], +) + +go_test( + name = "stringmatch_test", + srcs = [ + "matchers_test.go", + "serialization2_test.go", + "serialization_test.go", + ], + embed = [":stringmatch"], + deps = [ + "@com_github_stretchr_testify//assert", + "@in_gopkg_yaml_v3//:yaml_v3", + ], +) diff --git a/utils/strings2/BUILD.bazel b/utils/strings2/BUILD.bazel new file mode 100644 index 0000000..89b9128 --- /dev/null +++ b/utils/strings2/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_go//go:def.bzl", "go_library") + +go_library( + name = "strings2", + srcs = ["strings2.go"], + importpath = "go.fuhry.dev/runtime/utils/strings2", + visibility = ["//visibility:public"], +)