Skip to content

add Prometheus metrics exporter#260

Open
artinsony1982 wants to merge 1 commit into
masterfrom
prometheus
Open

add Prometheus metrics exporter#260
artinsony1982 wants to merge 1 commit into
masterfrom
prometheus

Conversation

@artinsony1982
Copy link
Copy Markdown

@artinsony1982
Copy link
Copy Markdown
Author

@ghost
Copy link
Copy Markdown

ghost commented May 4, 2026

7fcc854

Base configuration (usually leave as is)

Do not change port to 80, 443 is required for Telegram

Listen on all interfaces (0.0.0.0) or specific IP

listen_host = '0.0.0.0'
listen_port = 443

Number of worker threads. Typically equal to number of CPU cores.

You can leave it as None to let the script decide based on CPU cores.

num_workers = None

num_workers = 1 # For a single core CPU, 1 is usually fine.

Encryption

Set to True to enable the fake TLS handshake. Recommended for hiding traffic.

fake_tls = True

The domain to use for the fake TLS handshake.

This should be a real domain you own if you want to hide your MTProto traffic.

If you don't have one, you can use a placeholder or a common domain.

For simplicity and demonstration, we'll use a placeholder here.

IMPORTANT: For better stealth, use a domain you own and a valid certificate.

For this example, we'll skip the certificate part for simplicity.

You can generate a self-signed certificate or use Let's Encrypt later.

For now, we'll just use a fake domain without a cert.

If fake_tls is True, you MUST provide a domain.

Example with a real domain and cert:

tls_domain = 'your-domain.com'

cert_file = '/etc/letsencrypt/live/your-domain.com/fullchain.pem'

key_file = '/etc/letsencrypt/live/your-domain.com/privkey.pem'

For this example, we use a placeholder domain and skip certificate files.

If fake_tls is True, this is REQUIRED.

This domain will appear in your network traffic.

tls_domain = 'google.com' # Use a common domain to blend in, or your own domain for better privacy.

List of secrets. Each secret can be a string or a tuple.

If a secret is a string, it's the secret itself.

If a secret is a tuple, it's (secret, tag), where tag is a string displayed in Telegram's connection list.

Example:

secrets = {

"user1": "dd00000000000000000000000000000000",

"user2": ("dd11111111111111111111111111111111", "My Special Proxy"),

}

Using the generated secret and a custom tag for clarity.

secrets = {
"MySecureProxy": "dd3b8c4f1d9a0e7f5c2b6a8d0e1f7c3b9a8d0e1f7c3b9a8d0e"
}

Optional: Enable AD Tagging (Recommended)

This helps Telegram identify your proxy type.

Values: 'telegram', 'telegram-proxy', 'private', 'personal', 'test'

Using 'private' and your custom tag.

ad_tag = "private"

Optional: Enable logging

Set to True to enable logging to a file.

logging_enabled = True

Path to the log file. Ensure the directory exists and has write permissions.

log_file = '/var/log/mtprotoproxy.log'

Optional: GeoIP database path (for advanced features, not strictly needed for basic use)

geoip_database = '/path/to/GeoIP.dat'

Optional: Allowed IPs (if you want to restrict access to specific IPs)

allowed_ips = ['1.2.3.4', '5.6.7.8']

Optional: Ban old clients

ban_old_clients = True

Optional: Connection concurrency limits

max_connections = 1000

bytes_per_second = 50 * 1024 * 1024 # 50 MB/s

bytes_per_second_multiply = 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants