Fix some IP address spelling.

GitOrigin-RevId: ca1e3f4110057c3badbd9c5898593a65b72410e2
This commit is contained in:
levlam 2020-05-16 23:32:32 +03:00
parent 5b18a56e03
commit 0581b298cc
6 changed files with 23 additions and 25 deletions

View File

@ -716,7 +716,7 @@ Changes in 1.2.0:
* Added method `searchInstalledStickerSets` to search by title and name for installed sticker sets.
* Added methods for handling connected websites: `getConnectedWebsites`, `disconnectWebsite` and
`disconnectAllWebsites`.
* Added method `getCountryCode`, which uses current user IP to identify their country.
* Added method `getCountryCode`, which uses current user IP address to identify their country.
* Added option `t_me_url`.
* Fixed `BlackBerry` spelling in `deviceTokenBlackBerryPush`.
* Fixed return type of `getChatMessageByDate` method, which is `Message` and not `Messages`.

View File

@ -4383,7 +4383,7 @@ answerCustomQuery custom_query_id:int64 data:string = Ok;
setAlarm seconds:double = Ok;
//@description Uses current user IP to found their country. Returns two-letter ISO 3166-1 alpha-2 country code. Can be called before authorization
//@description Uses current user IP address to found their country. Returns two-letter ISO 3166-1 alpha-2 country code. Can be called before authorization
getCountryCode = Text;
//@description Returns the default text for invitation messages to be used as a placeholder when the current user invites friends to Telegram

View File

@ -587,10 +587,10 @@ class TestProxyRequest : public RequestOnceActor {
}
auto dc_options = ConnectionCreator::get_default_dc_options(false);
IPAddress mtproto_ip;
IPAddress mtproto_ip_address;
for (auto &dc_option : dc_options.dc_options) {
if (dc_option.get_dc_id().get_raw_id() == dc_id_) {
mtproto_ip = dc_option.get_ip_address();
mtproto_ip_address = dc_option.get_ip_address();
break;
}
}
@ -601,8 +601,8 @@ class TestProxyRequest : public RequestOnceActor {
});
child_ =
ConnectionCreator::prepare_connection(r_socket_fd.move_as_ok(), proxy_, mtproto_ip, get_transport(), "Test",
"TestPingDC2", nullptr, {}, false, std::move(connection_promise));
ConnectionCreator::prepare_connection(r_socket_fd.move_as_ok(), proxy_, mtproto_ip_address, get_transport(),
"Test", "TestPingDC2", nullptr, {}, false, std::move(connection_promise));
}
void on_connection_data(Result<ConnectionCreator::ConnectionData> r_data) {

View File

@ -379,8 +379,8 @@ void ConnectionCreator::ping_proxy_resolved(int32 proxy_id, IPAddress ip_address
CHECK(proxy.use_proxy());
auto token = next_token();
auto ref =
prepare_connection(std::move(socket_fd), proxy, extra.mtproto_ip, extra.transport_type, "Ping", extra.debug_str,
nullptr, create_reference(token), false, std::move(connection_promise));
prepare_connection(std::move(socket_fd), proxy, extra.mtproto_ip_address, extra.transport_type, "Ping",
extra.debug_str, nullptr, create_reference(token), false, std::move(connection_promise));
if (!ref.empty()) {
children_[token] = {false, std::move(ref)};
}
@ -675,7 +675,7 @@ Result<mtproto::TransportType> ConnectionCreator::get_transport_type(const Proxy
Result<SocketFd> ConnectionCreator::find_connection(const Proxy &proxy, const IPAddress &proxy_ip_address, DcId dc_id,
bool allow_media_only, FindConnectionExtra &extra) {
extra.debug_str = PSTRING() << "Failed to find valid IP for " << dc_id;
extra.debug_str = PSTRING() << "Failed to find valid IP address for " << dc_id;
bool prefer_ipv6 =
G()->shared_config().get_option_boolean("prefer_ipv6") || (proxy.use_proxy() && proxy_ip_address.is_ipv6());
bool only_http = proxy.use_http_caching_proxy();
@ -697,9 +697,9 @@ Result<SocketFd> ConnectionCreator::find_connection(const Proxy &proxy, const IP
extra.check_mode |= info.should_check;
if (proxy.use_proxy()) {
extra.mtproto_ip = info.option->get_ip_address();
extra.mtproto_ip_address = info.option->get_ip_address();
extra.debug_str = PSTRING() << (proxy.use_socks5_proxy() ? "Socks5" : (only_http ? "HTTP_ONLY" : "HTTP_TCP")) << ' '
<< proxy_ip_address << " --> " << extra.mtproto_ip << extra.debug_str;
<< proxy_ip_address << " --> " << extra.mtproto_ip_address << extra.debug_str;
VLOG(connections) << "Create: " << extra.debug_str;
return SocketFd::open(proxy_ip_address);
} else {
@ -709,12 +709,10 @@ Result<SocketFd> ConnectionCreator::find_connection(const Proxy &proxy, const IP
}
}
ActorOwn<> ConnectionCreator::prepare_connection(SocketFd socket_fd, const Proxy &proxy, const IPAddress &mtproto_ip,
mtproto::TransportType transport_type, Slice actor_name_prefix,
Slice debug_str,
unique_ptr<mtproto::RawConnection::StatsCallback> stats_callback,
ActorShared<> parent, bool use_connection_token,
Promise<ConnectionData> promise) {
ActorOwn<> ConnectionCreator::prepare_connection(
SocketFd socket_fd, const Proxy &proxy, const IPAddress &mtproto_ip_address, mtproto::TransportType transport_type,
Slice actor_name_prefix, Slice debug_str, unique_ptr<mtproto::RawConnection::StatsCallback> stats_callback,
ActorShared<> parent, bool use_connection_token, Promise<ConnectionData> promise) {
if (proxy.use_socks5_proxy() || proxy.use_http_tcp_proxy() || transport_type.secret.emulate_tls()) {
VLOG(connections) << "Create new transparent proxy connection " << debug_str;
class Callback : public TransparentProxy::Callback {
@ -765,11 +763,11 @@ ActorOwn<> ConnectionCreator::prepare_connection(SocketFd socket_fd, const Proxy
!proxy.use_socks5_proxy());
if (proxy.use_socks5_proxy()) {
return ActorOwn<>(create_actor<Socks5>(PSLICE() << actor_name_prefix << "Socks5", std::move(socket_fd),
mtproto_ip, proxy.user().str(), proxy.password().str(),
mtproto_ip_address, proxy.user().str(), proxy.password().str(),
std::move(callback), std::move(parent)));
} else if (proxy.use_http_tcp_proxy()) {
return ActorOwn<>(create_actor<HttpProxy>(PSLICE() << actor_name_prefix << "HttpProxy", std::move(socket_fd),
mtproto_ip, proxy.user().str(), proxy.password().str(),
mtproto_ip_address, proxy.user().str(), proxy.password().str(),
std::move(callback), std::move(parent)));
} else if (transport_type.secret.emulate_tls()) {
return ActorOwn<>(create_actor<mtproto::TlsInit>(
@ -909,7 +907,7 @@ void ConnectionCreator::client_loop(ClientInfo &client) {
td::make_unique<detail::StatsCallback>(client.is_media ? media_net_stats_callback_ : common_net_stats_callback_,
actor_id(this), client.hash, extra.stat);
auto token = next_token();
auto ref = prepare_connection(std::move(socket_fd), proxy, extra.mtproto_ip, extra.transport_type, Slice(),
auto ref = prepare_connection(std::move(socket_fd), proxy, extra.mtproto_ip_address, extra.transport_type, Slice(),
extra.debug_str, std::move(stats_callback), create_reference(token), true,
std::move(promise));
if (!ref.empty()) {

View File

@ -91,7 +91,7 @@ class ConnectionCreator : public NetQueryCallback {
static DcOptions get_default_dc_options(bool is_test);
static ActorOwn<> prepare_connection(SocketFd socket_fd, const Proxy &proxy, const IPAddress &mtproto_ip,
static ActorOwn<> prepare_connection(SocketFd socket_fd, const Proxy &proxy, const IPAddress &mtproto_ip_address,
mtproto::TransportType transport_type, Slice actor_name_prefix, Slice debug_str,
unique_ptr<mtproto::RawConnection::StatsCallback> stats_callback,
ActorShared<> parent, bool use_connection_token,
@ -229,7 +229,7 @@ class ConnectionCreator : public NetQueryCallback {
DcOptionsSet::Stat *stat{nullptr};
mtproto::TransportType transport_type;
string debug_str;
IPAddress mtproto_ip;
IPAddress mtproto_ip_address;
bool check_mode{false};
};

View File

@ -436,11 +436,11 @@ class Socks5TestActor : public Actor {
IPAddress socks5_ip;
socks5_ip.init_ipv4_port("131.191.89.104", 43077).ensure();
IPAddress mtproto_ip = get_default_ip_address();
IPAddress mtproto_ip_address = get_default_ip_address();
auto r_socket = SocketFd::open(socks5_ip);
create_actor<Socks5>("socks5", r_socket.move_as_ok(), mtproto_ip, "", "", make_unique<Callback>(std::move(promise)),
actor_shared())
create_actor<Socks5>("socks5", r_socket.move_as_ok(), mtproto_ip_address, "", "",
make_unique<Callback>(std::move(promise)), actor_shared())
.release();
}