| 110 | // https://stackoverflow.com/a/68733302/1926020 |
| 111 | #[inline] |
| 112 | pub async fn send_raw( |
| 113 | &mut self, |
| 114 | msg: &'static [u8], |
| 115 | addr: impl IntoTargetAddr<'static>, |
| 116 | ) -> ResultType<()> { |
| 117 | let addr = addr.into_target_addr()?.to_owned(); |
| 118 | |
| 119 | match self { |
| 120 | Self::Direct(f) => { |
| 121 | if let TargetAddr::Ip(addr) = addr { |
| 122 | f.send((Bytes::from(msg), addr)).await? |
| 123 | } |
| 124 | } |
| 125 | Self::ProxySocks(f) => f.send((Bytes::from(msg), addr)).await?, |
| 126 | }; |
| 127 | Ok(()) |
| 128 | } |
| 129 | |
| 130 | #[inline] |
| 131 | pub async fn next(&mut self) -> Option<ResultType<(BytesMut, TargetAddr<'static>)>> { |