[DONE] Websocket restrictions

These are old archives. They are kept for historic purposes only.

Moderators: Gottem, Supporters

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

[DONE] Websocket restrictions

Post by Gottem »

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;
	channels {
		"#chan1"; // Don't forget the "" to make sure Unreal doesn't interpret it as a comment ;]
		"#moar";
	};
};
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.

The channels list is optional; if omitted there will be no channel restrictions, otherwise they can only join the specified ones. They also only apply to websocket users, so regular clients can join their channels too.

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

Get it here.
If you like my modules, pls consider donating (credit card or iDEAL, use the custom job fee option in my shop) ;];]
Post Reply