(data: &[u8])
| 29 | |
| 30 | impl AppAddress { |
| 31 | fn parse(data: &[u8]) -> Result<Self> { |
| 32 | // format: "3327603e03f5bd1f830812ca4a789277fc31f577:555" |
| 33 | let data = String::from_utf8(data.to_vec()).context("invalid app address")?; |
| 34 | let (app_id, port) = data.split_once(':').context("invalid app address")?; |
| 35 | Ok(Self { |
| 36 | app_id: app_id.to_string(), |
| 37 | port: port.parse().context("invalid port")?, |
| 38 | }) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | /// resolve app address by sni |