Fix IPAddress::get_ipv4 usages.
GitOrigin-RevId: 6d87c9347aaa40957b1e524f889cf9fe8b179bb1
This commit is contained in:
parent
a80bd978e8
commit
cc077a3971
@ -101,7 +101,7 @@ void Socks5::send_ip_address() {
|
|||||||
request += '\x00';
|
request += '\x00';
|
||||||
if (ip_address_.is_ipv4()) {
|
if (ip_address_.is_ipv4()) {
|
||||||
request += '\x01';
|
request += '\x01';
|
||||||
auto ipv4 = ip_address_.get_ipv4();
|
auto ipv4 = ntohl(ip_address_.get_ipv4());
|
||||||
request += static_cast<char>(ipv4 & 255);
|
request += static_cast<char>(ipv4 & 255);
|
||||||
request += static_cast<char>((ipv4 >> 8) & 255);
|
request += static_cast<char>((ipv4 >> 8) & 255);
|
||||||
request += static_cast<char>((ipv4 >> 16) & 255);
|
request += static_cast<char>((ipv4 >> 16) & 255);
|
||||||
@ -136,7 +136,7 @@ Status Socks5::wait_ip_address_response() {
|
|||||||
}
|
}
|
||||||
it.advance(1, c_slice);
|
it.advance(1, c_slice);
|
||||||
if (c != '\0') {
|
if (c != '\0') {
|
||||||
return Status::Error("byte must be zero");
|
return Status::Error("Byte must be zero");
|
||||||
}
|
}
|
||||||
it.advance(1, c_slice);
|
it.advance(1, c_slice);
|
||||||
size_t total_size = 6;
|
size_t total_size = 6;
|
||||||
|
@ -210,7 +210,7 @@ bool IPAddress::is_ipv6() const {
|
|||||||
uint32 IPAddress::get_ipv4() const {
|
uint32 IPAddress::get_ipv4() const {
|
||||||
CHECK(is_valid());
|
CHECK(is_valid());
|
||||||
CHECK(is_ipv4());
|
CHECK(is_ipv4());
|
||||||
return ntohl(ipv4_addr_.sin_addr.s_addr);
|
return htonl(ipv4_addr_.sin_addr.s_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Slice IPAddress::get_ipv6() const {
|
Slice IPAddress::get_ipv6() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user