Skip to content

Instantly share code, notes, and snippets.

@jorendorff
Last active January 24, 2018 16:01
Show Gist options
  • Select an option

  • Save jorendorff/2a84471400f5fd020b7a700b8c465a04 to your computer and use it in GitHub Desktop.

Select an option

Save jorendorff/2a84471400f5fd020b7a700b8c465a04 to your computer and use it in GitHub Desktop.
#[macro_use] extern crate nsswitch_service;
use nsswitch_service::*;
use std::ffi::CStr;
use std::net::IpAddr;
fn my_gethostbyname(name: &CStr) -> Result<Option<HostEntry>> {
...
}
fn my_gethostbyaddr(addr: IpAddr) -> Result<Option<HostEntry>> {
...
}
impl_nsswitch_service!(mylibraryname, {
gethostbyname: my_gethostbyname,
gethostbyaddr: my_gethostbyaddr,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment