mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-21 06:19:08 +00:00
Add comment for DNS fix
This commit is contained in:
parent
0ab52c623b
commit
e3494d921c
1 changed files with 5 additions and 1 deletions
|
@ -4,11 +4,11 @@ use std::{
|
||||||
net::{IpAddr, Ipv4Addr, SocketAddr},
|
net::{IpAddr, Ipv4Addr, SocketAddr},
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
};
|
};
|
||||||
|
use trust_dns_proto::op::MessageType;
|
||||||
use trust_dns_proto::{
|
use trust_dns_proto::{
|
||||||
op::{Message, ResponseCode},
|
op::{Message, ResponseCode},
|
||||||
rr::{record_type::RecordType, Name, RData, Record},
|
rr::{record_type::RecordType, Name, RData, Record},
|
||||||
};
|
};
|
||||||
use trust_dns_proto::op::{Edns, MessageType};
|
|
||||||
|
|
||||||
#[cfg(feature = "use-rand")]
|
#[cfg(feature = "use-rand")]
|
||||||
pub fn build_dns_request(domain: &str, query_type: RecordType, used_by_tcp: bool) -> Result<Vec<u8>, String> {
|
pub fn build_dns_request(domain: &str, query_type: RecordType, used_by_tcp: bool) -> Result<Vec<u8>, String> {
|
||||||
|
@ -47,7 +47,11 @@ pub fn build_dns_response(mut request: Message, domain: &str, ip: IpAddr, ttl: u
|
||||||
record
|
record
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// We must indicate that this message is a response. Otherwise, implementations may not
|
||||||
|
// recognize it.
|
||||||
request.set_message_type(MessageType::Response);
|
request.set_message_type(MessageType::Response);
|
||||||
|
|
||||||
request.add_answer(record);
|
request.add_answer(record);
|
||||||
Ok(request)
|
Ok(request)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue