use haprox_rs::{ProtocolV1Inet, ProxyHdrV1, ProxyV1Parser};
fn main()
{
let res =
ProxyHdrV1::from_str("192.168.1.1:333", "127.0.0.1:444")
.unwrap();
let out = res.to_string();
println!("{}", out);
let pv1 =
ProxyV1Parser
::try_from_str(out.as_str(), false)
.unwrap();
assert_eq!(pv1.get_inet(), ProtocolV1Inet::Tcp4);
assert_eq!(pv1.get_src_addr(), Some("192.168.1.1".parse().unwrap()));
assert_eq!(pv1.get_src_port(), Some(333));
assert_eq!(pv1.get_dst_addr(), Some("127.0.0.1".parse().unwrap()));
assert_eq!(pv1.get_dst_port(), Some(444));
}