add service monitors

This commit is contained in:
tahahawa
2025-06-25 01:53:27 -04:00
parent e8d55d27e4
commit baf63e97b1
4 changed files with 174 additions and 3 deletions

View File

@@ -133,6 +133,26 @@ pub fn ingress_path(input: TokenStream) -> TokenStream {
}
}
/// Verify that a string is a valid http scheme
/// Panics if not http or https
#[proc_macro]
pub fn http_scheme(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as LitStr);
let scheme_str = input.value();
if scheme_str.to_lowercase() == "http" {
let expanded = quote! {(#scheme_str.to_lowercase().to_string()) };
return TokenStream::from(expanded);
}
if scheme_str.to_lowercase() == "https" {
let expanded = quote! {(#scheme_str.to_lowercase().to_string()) };
return TokenStream::from(expanded);
}
panic!("Invalid HTTP scheme")
}
#[proc_macro]
pub fn cidrv4(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as LitStr);