| Crates.io | ift |
| lib.rs | ift |
| version | 0.3.2 |
| created_at | 2019-01-08 20:53:25.540572+00 |
| updated_at | 2019-03-28 02:33:22.170286+00 |
| description | A library to read template strings for local network interfaces |
| homepage | |
| repository | https://github.com/camerondavison/ift |
| max_upload_size | |
| id | 107506 |
| size | 48,132 |
Template strings to extract the correct interface and IpAddr to bind to. Heavily inspired by https://github.com/hashicorp/go-sockaddr
eval(docs)
takes an interface template string. The template is a string that starts with a
producer
and is followed by filters
and sorts
each of which is pipe | delimited. eval returns a vector of IpAddr objects
that can then be used as bindings
use ift::eval;
print!("{:?}", eval(r#"GetInterface "en0""#).unwrap());
use actix_web::{
server,
App,
};
let mut s = server::new(|| { App::new() });
for ip in ift::eval("GetPrivateInterfaces").unwrap().into_iter() {
s = s.bind((ip, 8080)).unwrap();
}
GetAllInterfaces | FilterFlags "up" | FilterForwardable | SortBy "default"GetPrivateInterfacesGetInterface "en0"GetAllInterfaces | FilterIPv6There are examples in the examples folder.
actix - bind multiple private interfaces
make gen
make update
You can use the cargo release command.
cargo release patch
License: MIT