Skip to content

Instantly share code, notes, and snippets.

View Object905's full-sized avatar

Zverev Konstantin Object905

  • Kumertau, Russia
View GitHub Profile
@AngelicosPhosphoros
AngelicosPhosphoros / main.rs
Last active February 18, 2025 17:56
How to print enabled cpu target features in Rust
#![recursion_limit="512"]
// This script prints all cpu features which active in this build.
// There are 3 steps in usage of script:
// 1. get list of features using `rustc --print target-features`
// 2. put it into script (it has values actual for 2020-12-06 for x86-64 target).
// 3. run script.
fn pad_name(s: &str)->String{
let mut res = s.to_string();
@Object905
Object905 / dns-discovery.rs
Last active August 10, 2026 17:55
Pingora kubernetes/DNS ServiceDiscovery
use async_trait::async_trait;
use hickory_resolver::TokioAsyncResolver;
use http::Extensions;
use pingora::lb::discovery::ServiceDiscovery;
use pingora::lb::selection::{BackendIter, BackendSelection};
use pingora::lb::{Backend, Backends, LoadBalancer};
use pingora::protocols::l4::socket::SocketAddr;
use pingora::{Error, ErrorSource, ErrorType, Result as PingoraResult};
use std::fmt::Debug;
use std::net::{IpAddr, SocketAddrV4};