Code Monkey home page Code Monkey logo

mtproxyspeedtest's Introduction

README.md

Telegram MTProxy Tester with tdlib

This project provides a Python script to test connection, speed, and ping of Telegram MTProto proxies using the tdlib library.

Features

  • Test connection to a Telegram MTProxy server.
  • Measure download speed through the proxy. (Requires Telegram bot token)
  • Get ping latency of the proxy server.

Setup

Requirements:

  • Python 3.9 or above
  • pip (package manager)

Installation:

  1. Clone this repository.
  2. Install dependencies:
    pip install -r requirements.txt
  3. Compile tdlib (Optional):
    • If you're not using Ubuntu 20.04 or 22.04, you'll need to compile your own tdlib library following the instructions here: https://tdlib.github.io/td/build.html
    • The included libtdjson.so file is pre-compiled for Ubuntu 20.04 and 22.04.

Telegram App Credentials:

  1. Obtain your Telegram application ID and hash from the Telegram Developer Portal: https://core.telegram.org/

Usage

1. Import MTPClient

from mtp import MTPClient

2. Client Setup

# Replace with your Telegram App credentials
api_id = YOUR_TELEGRAM_APP_ID
api_hash = 'YOUR_TELEGRAM_APP_HASH'

# Bot token is required for speed test
bot_token = "YOUR_BOT_TOKEN"

# Other configurations (optional)
database_encryption_key = 'test'
files_directory = 'BotDB'
lib_path = './libtdjson.so'  # Path to your compiled tdlib library (if applicable)

client = MTPClient(
    api_id=api_id,
    api_hash=api_hash,
    bot_token=bot_token,
    database_encryption_key=database_encryption_key,
    files_directory=files_directory,
    lib_path=lib_path
)

3. Usage Examples (Asynchronous)

async def main():
    # Start the client
    await client.start()
    # Test connection (no authorization required)
    result = await client.test_proxy("https://t.me/proxy?server=server&port=port&secret=secret")
    print(f"Test Proxy Result: {result}")  # Returns True/False

    # Speed Test (requires bot token)
    result = await client.speed_test("https://t.me/proxy?server=server&port=port&secret=secret")
    print(f"Speed Test Result: {result}")  

    # Ping Proxy (no authorization required)
    result = await client.ping_proxy("https://t.me/proxy?server=server&port=port&secret=secret")
    print(f"Ping Proxy Result: {result}")  

# Run the asynchronous program
if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

Note:

  • Install ujson or orjson for better performance (Optional)

License

hmmm, License

mtproxyspeedtest's People

Contributors

violetesfenaj avatar

Watchers

 avatar

mtproxyspeedtest's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.