mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 10:45:30 +00:00
aquatic_http: add ipv6 compact responses; fix ipv4/ipv6 issue
This commit is contained in:
parent
5ff00e866d
commit
43a33d80c4
6 changed files with 127 additions and 27 deletions
|
|
@ -9,7 +9,7 @@ use log::error;
|
|||
use mio::Token;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
pub use aquatic_common::ValidUntil;
|
||||
pub use aquatic_common::{ValidUntil, convert_ipv4_mapped_ipv4};
|
||||
|
||||
use crate::protocol::common::*;
|
||||
use crate::protocol::request::Request;
|
||||
|
|
@ -26,6 +26,22 @@ pub struct ConnectionMeta {
|
|||
}
|
||||
|
||||
|
||||
impl ConnectionMeta {
|
||||
pub fn map_ipv4_ip(&self) -> Self {
|
||||
let peer_addr = SocketAddr::new(
|
||||
convert_ipv4_mapped_ipv4(self.peer_addr.ip()),
|
||||
self.peer_addr.port()
|
||||
);
|
||||
|
||||
Self {
|
||||
worker_index: self.worker_index,
|
||||
peer_addr,
|
||||
poll_token: self.poll_token
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
||||
pub enum PeerStatus {
|
||||
Seeding,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue