Comments (21)
Hello, I've commited to master branch the ability to specify limits for users: 9da90d2.
Now you can put USER_CONN_LIMITS variable to config.py. Example:
USER_CONN_LIMITS = {
"tg": 1
}
The radius is not supported.
from mtprotoproxy.
hello, it is simple to patch the program to limit the number of users. For example to restrict the number of users with one secret with 32 you can replace the code:
update_stats(user, curr_connects=1)
await asyncio.wait([task_tg_to_clt, task_clt_to_tg], return_when=asyncio.FIRST_COMPLETED)
update_stats(user, curr_connects=-1)
with this code:
update_stats(user, curr_connects=1)
if stats[user]["curr_connects"] <= 32:
await asyncio.wait([task_tg_to_clt, task_clt_to_tg], return_when=asyncio.FIRST_COMPLETED)
update_stats(user, curr_connects=-1)
from mtprotoproxy.
Hello,
yes, just by replacing
if stats[user]["curr_connects"] <= 32:
with
if user == "any_username" and stats[user]["curr_connects"] <= 32:
from mtprotoproxy.
@fa1996raz
Hi
You can use my script to install mtproto proxy on Centos 7 link
After installing you can edit /opt/mtprotoproxy/config.py
to config your settings. (Adding limiter for example)
I will add the limiter option to script later.
Plus you can install mtproto on windows by simply downloading this repository and opening mtprotoproxy.py with python3 (You should download and install python from here ) If python 3.7 didn't work try python 3.6
from mtprotoproxy.
@pouryare
From 6c5155c USER_CONN_LIMITS
has renamed to USER_MAX_TCP_CONNS
.
from mtprotoproxy.
Hello
Is there any way to limit "curr_connects" just for specific users(secret), not for all the secrets?
from mtprotoproxy.
hello, it is simple to patch the program to limit the number of users. For example to restrict the number of users with one secret with 32 you can replace the code:
update_stats(user, curr_connects=1) await asyncio.wait([task_tg_to_clt, task_clt_to_tg], return_when=asyncio.FIRST_COMPLETED) update_stats(user, curr_connects=-1)
with this code:
update_stats(user, curr_connects=1) if stats[user]["curr_connects"] <= 32: await asyncio.wait([task_tg_to_clt, task_clt_to_tg], return_when=asyncio.FIRST_COMPLETED) update_stats(user, curr_connects=-1)
Hi can you please explain that is which file I should change the codes please?
I am using the windows version of this file that has been written with pyton that I dont know him, and there is nothing especial in config file except port and secrets and channel tag that I can change them.
And another question is there any way to make it work with radius?
I need radius for multi user limiting and setting expiration time for each secret, if there is any other way I would be very glad if you help me.
Thanks alot
from mtprotoproxy.
Hello, I've commited to master branch the ability to specify limits for users: 9da90d2.
Now you can put USER_CONN_LIMITS variable to config.py. Example:
USER_CONN_LIMITS = { "tg": 1 }
The radius is not supported.
Hi and thanks alot for your quick response, As I said I am using it on windows and I think it has not been made by you, I had a question that if you have made an application for windows os too, you would give the download link please, or if it is not possible to make it, I am not too familar with Centos 7, you would help me to config it on an Centos server Step by Step if there is no problem, and another thing if you need the application that has been made for windows, I have the file and I think it has been developed for about a year and has not been updated, I can give the files.
Thanks again for your help
Hope to hear from you soon.
from mtprotoproxy.
@fa1996raz
Hi
You can use my script to install mtproto proxy on Centos 7 linkAfter installing you can edit
/opt/mtprotoproxy/config.py
to config your settings. (Adding limiter for example)I will add the limiter option to script later.
Plus you can install mtproto on windows by simply downloading this repository and opening mtprotoproxy.py with python3 (You should download and install python from here ) If python 3.7 didn't work try python 3.6
Thanks man you are great
My only problem was executing these py projects, because I had never tried python before, I would try it now for both projects,
Thanks again for your helpπβ€οΈ
from mtprotoproxy.
@alexbers
Would you please explain what's the difference between USER_CONN_LIMITS and USER_MAX_TCP_CONNS ?
from mtprotoproxy.
Yes, @HirbodBehnam is right. I think USER_MAX_TCP_CONNS
is a better name because the proxy limits the number of tcp-connections per users, not the users itself. One telegram client can establish about 5 simultaneous connection (e.g. for file downloading)
from mtprotoproxy.
I think limiting users could be possible with their IP addresses.
So with print()
command I realized that from here and cl_ip
you can get the client's IP address. So if we store all IPs in a set (something like std::set I'm not a Python programmer) we can count them. If they reach a specific number, close all other connections. Also remove IPs that timeout.
Sorry if my explanation was not clear.
from mtprotoproxy.
the limiting by ip address is much less precise than by ip addresses, since almost all providers use nat technology that hides many ip addresses behind one
from mtprotoproxy.
Yeah you are right
Home WiFis and organization WiFis will cause a lot of problems and inaccuracy later.
from mtprotoproxy.
Hi @alexbers.
when i setting USER_MAX_TCP_CONNS, proxy works very slow? and cant download any thing
but when there is no USER_MAX_TCP_CONNS config, it's works fine!!!!
from mtprotoproxy.
The proxy can create several tcp connections for one user to download files fast. If you allow only few connections, like one or two, the proxy will be not able to make additional connections. You can just increase the connection limit, like if you want to have 10 user, then set 80 (multiply by 8)
from mtprotoproxy.
Im wondering if there is a way to recognize each specific user and implement such restriction rather than aiming high with tcp connections or making the risk (nat) and limiting by IP. π€
from mtprotoproxy.
Hello, I've commited to master branch the ability to specify limits for users: 9da90d2.
Now you can put USER_CONN_LIMITS variable to config.py. Example:
USER_CONN_LIMITS = { "tg": 1 }
The radius is not supported.
hi I try this method but it's not working at all
USER_CONN_LIMITS = { "karbar2": 2, "karbar1": 2, "karbar4": 1 }
all of them are unlimited to connect.
did I do something wrong?
can you help me in some other way?
from mtprotoproxy.
Are you restarted the proxy after changing config?
Also one client can make about 8 connections, so the numbers are too low even for 1 client
from mtprotoproxy.
I tried USER_MAX_TCP_CONNS
and problem solved
thank you
from mtprotoproxy.
hi alexbers
I have several questions for you
Please comment on your Telegram ID
from mtprotoproxy.
Related Issues (20)
- How to set limit total bandwidth usage per secret
- Ydh
- proxy
- unknown rpc ans type: b'\xdf\xa20W' HOT 1
- MTProxy Admin Bot dont accept my secret cause python script make it more than 32 hex. Please, help!
- . HOT 2
- .
- . HOT 1
- When open telegam app , it takes too long time wait for connecting to the proxy HOT 2
- Proxy works on Telegram Desktop (Windows) but not on Android Telegram
- Error in source code
- Does MTProto allow to route all a device internet traffic to the proxy? Like a VPN? HOT 1
- .
- IPV6 dont work when i add users
- IP white list method - amazon changer & checker - local server tunnel
- Installing Python MTProxy on CentOS 8 with Python update HOT 5
- port change doesnt work in config.py HOT 1
- Dokerfile for debian 12 HOT 1
- ERROR: Service 'mtprotoproxy' failed to build: The command '/bin/sh -c apt-get update && apt-get install --no-install-recommends -y python3 python3-uvloop python3-cryptography python3-socks libcap2-bin ca-certificates && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100 HOT 3
- It only works for a few minutes HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mtprotoproxy.