Rust library for easy HTTPS/SVCB record support
- Rust 100%
| src | ||
| .gitignore | ||
| Cargo.toml | ||
| LICENSE | ||
| README.md | ||
portify
Portify is a simple way to resolve a URL with a port hint in its SVCB or HTTPS record.
There's just one public async function: resolve_svcb(url: &Url), which returns an error if either the record is invalid or does not exist.
This library is great for improving support of services on non-standard ports, similar to SRV record helpers.
Usage
Add the library to your project:
cargo add portify
Example
use url::Url;
#[tokio::main]
async fn main() {
let arg = std::env::args().last().unwrap();
let mut url = Url::parse(&arg).unwrap();
match portify::resolve_svcb(&url) {
Ok(u) => url = u,
Err(_) => println!("Assuming default port for URL")
}
println!("{}", url);
}