[DONE] Websocket restrictions

Need a module converted from 3.2.x to UnrealIRCd 4? Or looking for a certain module? Ask here.

Moderators: Gottem, Supporters

Post Reply
Gottem
Posts: 100
Joined: Fri Aug 19, 2016 5:26 pm
Location: NL

[DONE] Websocket restrictions

Post by Gottem » Sun Mar 19, 2017 8:24 pm

I've seen some requests about restricting websocket users to certain ports, so this module allows you to do just that. Don't forget to read the wiki page on Unreal's websocket support first. ;]

Since websocket support for non-SSL ports works right out of the box, you're going to need a new listen block for non-SSL connections from websocket users. I used port 8080 in my case, but you can really use as many as you want.

Example config blocks:

Code: Select all

listen {
	ip *;
	port 8080;
	options {
		clientsonly;
	};
};
websocket_restrict {
	port 8080;
	//port 8443; // If you have an SSL listen block too
	zlinetime 60;
};
Now, if any websocket users connect to a port that isn't 8080 their IP will get GZ:Lined for the amount of seconds specified with zlinetime (defaults to 60). The other way around is true as well; regular clients connecting to a websocket port will be awarded the same GZ:Line. I originally had to do that for websocket users because they aren't fully online yet, so the special frames wouldn't be formed and sent. This resulted in the client sending the GET command about 5 times and that resulted in 5 snotices too. =] I did the same for regular clients to remain consistent.

I may (will probs) add more possibilities for restrictions. =]

Get it here.
If you like my modules, pls consider donating (through PayPal) ;];]

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests