SPEED Limit !
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

SPEED Limit !

Started by kash?, 11 October, 2005, 23:02:41

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kash?

I wanted a script which will disconnect user if he
does not keep download and upload speed
limit less than 1024 Kb/s.

In other words if a user has not set d/l and u/l
speed limit or has kept more than 1024 Kb/s,
he will get disconnection message

Clients= CZDC++ and StrongDC++

For e.g.
[02:17:16] Your nickname is registered. Please supply the password.
[02:17:16] *** Stored password sent...
[02:17:16] Please use CZDC++ or StrongDC++and set an upload transfer limit of 1024 KB/Sec.
[02:17:16] *** Disconnected

Waiting for reply,
Regards

bastya_elvtars

Search for Have2Limit, I will convert it to LUA5 ASAP.
Everything could have been anything else and it would have just as much meaning.

Markitos

Try this...
-- Have2Limit by bastya_elvtars

-- if no limit set or client has a too high limit it disconnects

-- supports DCPRO and DCGUI

-- please no buuuuuuuuuuuuuugs

-- Converted to lua5 by Markitos 12/10/05


-- // editable settings



-- set user levels here if you do not have the default profiles

-- [profileindex]=rank

-- the higher the rank is, the less likely user will be checked.





userlevels={



[-1]=1,



[0]=5,



[1]=4,



[2]=3,



[3]=2

}



checklevel=2 -- checks regs & nonregs now



upload_limit=300 -- same dimension as in BCDC++



-- // end of editable settings



function NewUserConnected(user)

	investigate(user)

end



function ChatArrival(user,data)

	if str.sub(data, 1, 7) == "$MyINFO" then

		if user.sMyInfoString and str.len (user.sMyInfoString) > (str.len(user.sName)+13) then

			investigate(user)

		end

	end

end



function checklimit(user)

	if str.find(user.sMyInfoString,"[BLU]") then

		local upstream

		local _,_,Slots = str.find(user.sMyInfoString, "H:[^,]+,S:(%d+).*>")

		local _,_,limit1=str.find(user.sMyInfoString,"[BLU]:(%d+)")

		local _,_,limit2 = str.find(user.sMyInfoString,"F:%d+/(%d+)")

		if Slots and Slots~="0" then

			if limit1 then

				upstream=calclimit(user,limit1,Slots)

			elseif limit2 then

				upstream=calclimit(user,limit2,Slots)

			end

		else

			user:SendData("SlotChk","You have a stupid client, it cannot show slots.")

			user:Disconnect()

		end

		return upstream

	end

end



function calclimit(user,limit,s)

	if str.find(user.sMyInfoString," userlevels[user.iProfile] then

		local limit=checklimit(user)

		if not limit or limit > upload_limit then

			user:SendData("LimitChk","Please set your upload limit to a maximum of "..upload_limit.." kB/s in your client. If you do not have a client capable of limiting, look at [URL]http://utrum.dyndns.org:8000/[/URL]")

		end

	end

end


Cheers

kash?

I tried that script but it's not working
He wanted speed limit
but I want that if a user has not kept speed limit
in CZDC++ or StrongDC++, he will simply get
disconnected.

For e.g. If user has not set speed limit or kept speed
limit in excess of 1024 Kb/s in File > Settings > Limits
he will simply get disconnected

PLZ I want this in urgent
If any1 can help, it will be great

Jelf

#4
Heres the one above properly converted...
-- Have2Limit by bastya_elvtars
-- if no limit set or client has a too high limit it disconnects
-- supports DCPRO and DCGUI
-- please no buuuuuuuuuuuuuugs
-- Correctly converted to LUA5 by Jelf 12/10/05
-- // editable settings
-- set user levels here if you do not have the default profiles
-- [profileindex]=rank
-- the higher the rank is, the less likely user will be checked.

userlevels={
[-1]=1,
[0]=5,
[1]=4,
[2]=3,
[3]=2
}

checklevel = 2 -- checks regs & nonregs now
upload_limit = 300 -- same dimension as in BCDC++

-- // end of editable settings

function NewUserConnected(user)
	investigate(user)
end

function MyINFOArrival(user, data)
	if user.sMyInfoString and string.len (user.sMyInfoString) > (string.len(user.sName)+13) then
		investigate(user)
	end
end

function checklimit(user)
	if string.find(user.sMyInfoString,"[BLU]") then
		local upstream
		local _,_,Slots = string.find(user.sMyInfoString, "H:[^,]+,S:(%d+).*>")
		local _,_,limit1 = string.find(user.sMyInfoString,"[BLU]:(%d+)")
		local _,_,limit2 = string.find(user.sMyInfoString,"F:%d+/(%d+)")
		if Slots and Slots~="0" then
			if limit1 then
				upstream=calclimit(user,limit1,Slots)
			elseif limit2 then
				upstream=calclimit(user,limit2,Slots)
			end
		else
			user:SendData("SlotChk","You have a stupid client, it cannot show slots.")
			user:Disconnect()
		end
		return upstream
	end
end

function calclimit(user,limit,s)
	if string.find(user.sMyInfoString," userlevels[user.iProfile] then
		local limit = checklimit(user)
		if not limit or limit > upload_limit then
			user:SendData("LimitChk","Please set your upload limit to a maximum of "..upload_limit.." kB/s in your client. If you do not have a client capable of limiting, look at [URL]http://utrum.dyndns.org:8000/[/URL]")
		end
	end
end
Enjoy

bastya_elvtars

This will use a bit less CPU time.

-- Have2Limit by bastya_elvtars

-- if no limit set or client has a too high limit it disconnects

-- supports DCPRO and DCGUI

-- please no buuuuuuuuuuuuuugs

-- Correctly converted to LUA5 by Jelf 12/10/05

-- // editable settings

-- set user levels here if you do not have the default profiles

-- [profileindex]=rank

-- the higher the rank is, the less likely user will be checked.
-- converted by Jelf
-- removed TD4 workarounds by bastya_elvtars

userlevels={

[-1]=1,

[0]=5,

[1]=4,

[2]=3,

[3]=2

}



checklevel = 2 -- checks regs & nonregs now

upload_limit = 300 -- same dimension as in BCDC++



-- // end of editable settings



function NewUserConnected(user)
  investigate(user)
end



function MyINFOArrival(user, data)
  investigate(user)
end



function checklimit(user)
    if string.find(user.sMyInfoString,"[BLU]") then
      local upstream
      local _,_,Slots = string.find(user.sMyInfoString, "H:[^,]+,S:(%d+).*>")
      local _,_,limit1 = string.find(user.sMyInfoString,"[BLU]:(%d+)")
      local _,_,limit2 = string.find(user.sMyInfoString,"F:%d+/(%d+)")
      if Slots and Slots~="0" then
        if limit1 then
          upstream=calclimit(user,limit1,Slots)
        elseif limit2 then
          upstream=calclimit(user,limit2,Slots)
	end
      else
        user:SendData("SlotChk","You have a stupid client, it cannot show slots.")
	user:Disconnect()
      end
      return upstream
    end
end

function calclimit(user,limit,s)
  if string.find(user.sMyInfoString," userlevels[user.iProfile] then
    local limit = checklimit(user)
    if not limit or limit > upload_limit then
      user:SendData("LimitChk","Please set your upload limit to a maximum of "..upload_limit.." kB/s in your client. If you do not have a client capable of limiting, look at [URL]http://utrum.dyndns.org:8000/[/URL]")
    end
  end
end
Everything could have been anything else and it would have just as much meaning.

Jelf

nice one bastya, wasnt sure if that MyINFO line should stay there or not.

Always learning.

kash?

The script is not giving any error but I could connect
with higher d/l and u/l limit
I want to disconnect even master has kept more
speed limit
I dont know why I am not getting disconnected

Markitos

What was wrong with my convertion?

Jelf

#9
kash?  - have you changed these settings?

checklevel = 2 -- checks regs & nonregs now
upload_limit = 300 -- same dimension as in BCDC++

You will only get disconnected if you have no slots or the client isnt showing how many slots.

Add this to the last line in function Investigate underneath
user:SendData("LimitChk","Please set your upload limit ....
user:Disconnect()
to disconnect anyone that has limit set wrong

Markitos  - you used str.find and str.len instead of string.find and string.len and ChatArrival instead of MyINFOArrival.

bastya_elvtars

QuoteOriginally posted by kash?
The script is not giving any error but I could connect
with higher d/l and u/l limit
I want to disconnect even master has kept more
speed limit
I dont know why I am not getting disconnected

Set checklevel to 6.
Everything could have been anything else and it would have just as much meaning.

kash?

First of all thanx guys for responding and helping
I tried three of the scripts above but I still can
connect with higher spped limit
I have simply pasted entire script without any
editing

What I need to or I am not doing in that script
to work ?

Markitos

QuoteOriginally posted by Jelf
kash?  - have you changed these settings?

checklevel = 2 -- checks regs & nonregs now
upload_limit = 300 -- same dimension as in BCDC++

You will only get disconnected if you have no slots or the client isnt showing how many slots.

Add this to the last line in function Investigate underneath
user:SendData("LimitChk","Please set your upload limit ....
user:Disconnect()
to disconnect anyone that has limit set wrong

Markitos  - you used str.find and str.len instead of string.find and string.len and ChatArrival instead of MyINFOArrival.

kash?

#13
It is working fine for upload limit but I wanted same
limit for download also

If I increase upload limit, it gives me disconnect message
but if I increase download limit, I get connected

And also a user should be able to connect only
by CZDC++ and StrongDC++ (Only these 2 clients)

bastya_elvtars

Is DL limit shown in the tag? I think no...
Everything could have been anything else and it would have just as much meaning.

kash?

#15
If I increase upload limit, it gives me disconnect message
but if I increase download limit, I get connected
File > Settings > Limits > DOwnload Speed
Cant it be edited the same way as for upload

And also a user should be able to connect only
by CZDC++ and StrongDC++ (Only these 2 clients)
Not by DC++, oDC, etc. coz in these clients, one
can not set limits and they can d/l at higher speeds

Madman

#16
DL Speed limit does not show in tag...
And why do you want to make user to not download above 1024 kb/s?
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

kash?

#17
QuoteAnd why do you want to make user to not download above 1024 kb/s?


Otherwise our ISP will put Firewall and seperate
LAN and divide as per areas because we d/l
at the speed of 5 - 10 mbs


If I increase upload limit, it gives me disconnect message
but if I increase download limit, I get connected
File > Settings > Limits > DOwnload Speed
Cant it be edited the same way as for upload

And also a user should be able to connect only
by CZDC++ and StrongDC++
 (Only these 2 clients)
Not by DC++, oDC, etc. coz in these clients, one
can not set limits and they can d/l at higher speeds

That's why I need this script badly...

bastya_elvtars

Only 1 client can show the DL limit in the tag: DC:PRO.

CZDC++ cannot be detected properly AFAIK. Pothead? :P
Everything could have been anything else and it would have just as much meaning.

kash?

When I keep upload  limit more than 1024 Kb/s
I get that disconnection message but what I want
is a user should get disconnected if he keeps download  limit more than 1024 Kb/s

With the help of above scripts posted, I can restrict users from connecting hubs with more than 1024 Kb/s
(any speed set) upload speed but can you also
add same thing for download as well

In short, user with more than 1024 kb/s (d/l and u/l both) should get disconnected and not only upload
He msut keep both speeds as per prescribed limit
in order to connect hub

casio

i req similar script
1 . limit uploads for all clients ie users even ops at 1024 k
2 . support all clients that provide upload limit
3 . rev connect, strong should be supported as they support segmented downloding from multipal source .....but upload limt of 1024 k should be maintained ...........as we run hub on lan they help us reduce network congession
4 .different messages should be displayed if the clients do not meet above req and also possible alternative
5 . ip of user should be logged on connect
6 . change in ip should be notified to user but he should be disconnected only if he logs in twice using  different ip

*****if possible temporary .ie on next log in allow user to  break upload limit only onec  control only with admin

thanks before hand

SMF spam blocked by CleanTalk