【问题标题】:How to make two Telethon clients each use a different IP如何让两个 Telethon 客户端各自使用不同的 IP
【发布时间】:2021-11-15 14:36:27
【问题描述】:

我的服务器公开了两个 IP。 如何创建两个 Telethon 客户端,让客户端 A 使用 IP1,客户端 B 使用 IP2? 甚至可以不摆弄 Telegram 代码吗? 如果不是,那是什么原因?

【问题讨论】:

标签: proxy ip telethon


【解决方案1】:

TelegramClient 构造函数有一个 local_addr 参数,允许您指定客户端应该使用哪个地址发送请求:

local_addr(str | tuple,可选):
用于将套接字绑定到本地的本地主机地址(和端口,可选)。仅当您有多个网卡并想使用特定的一个时才需要使用它。

https://docs.telethon.dev/en/latest/modules/client.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多