99 Commits

Author SHA1 Message Date
ctrlcn
3bbdf1c1b6 🌿 2025-11-20 17:35:45 -05:00
ctrlcn
698fb19014 🪵 2025-11-20 02:41:30 -05:00
modeco80
fb3c91221c rrr 2025-06-15 15:05:16 -04:00
modeco80
4211941560 cvmts/protocol: Make protocols stateless
Instead of creating an instance of a protocol per user and storing state there, we just have the protocol implementations take in all of the state they should need in processMessage(), and store them all globally (with some wrappers to make it easier to handle this). This makes things slightly cleaner (and probably also helps memory usage, since we now don't need to create protocol instances as soon as a user connects/swaps, and they don't need to be garbage collected since they are held in the manager.)
2025-06-15 15:03:13 -04:00
modeco80
bce2a0172a cvmts: Add hackfix to CGroup.Self() for hybrid cgroups
systemd-nspawn, and probably other container runtimes, can sometimes
mount a cgroupsv1 hierarchy in a cgroup namespace. This ends up
infecting the host system, so we optionally allow that. We still will
error out if we happen to be the one running in a legacy cgroupsv1
controller hierarchy, however. We still depend on unified/cgroupsv2.
2025-06-09 02:57:33 -04:00
modeco80
c4c08ae830 cvmts: Revert to using main quality for thumbnails
meh
2025-06-05 17:14:37 -04:00
modeco80
857eb46d2a cvm-rs: allow setting JPEG quality from JS 2025-06-05 16:45:46 -04:00
modeco80
23c57dbb3b cvm-rs: Add jpegResizeEncode(), remove usage of sharp
sharp sucks.
2025-06-05 16:40:46 -04:00
Elijah R
5621067c38 Bump nodejs-rfb, fix vncvm 2025-06-05 15:45:36 -04:00
Elijah R
1c088cf814 cvmts: protocol error logging 2025-03-21 21:45:04 -04:00
Elijah R
db4ddea2e7 cvmts: fix ban, re-add audit log 2025-03-21 21:36:02 -04:00
Elijah R
5705971be6 cvmts: fix rename oddities 2025-03-21 21:28:13 -04:00
Elijah R
10dd3c2489 cvmts: Move initial protocol selection to transport layer 2025-03-21 20:29:16 -04:00
Elijah R
ab63420075 cvmts: rip out raw tcp transport
it's really just a tech debt that nothing uses, these is pretty much no point keeping it
2025-03-21 19:13:15 -04:00
Elijah R
e1e5f4a352 Merge branch 'master' into dev/proto_capability_rework 2025-03-21 19:03:55 -04:00
modeco80
53dd05ccc2 cvmts: Fix protocol error disconnection behavior so it actually works 2025-03-06 17:08:58 -05:00
modeco80
405e88bd1b cvmts: Allow specifying cgroup cpu period
probably limited utility wise but it's there now
2024-11-03 13:10:57 -05:00
modeco80
fe82973b9f Only try enabling cpuset controller if required
Additionally, "handle" (in many airquotes) errors trying to set controller values.
2024-11-02 18:01:07 -04:00
modeco80
e7a06b7141 cvmts: Delete cgroup on VM stop
Makes clean shutdown with systemd actually work.

I've also made superqemu version a SemVer thing so that we don't need to bump it as often, only on a major or minor bump.
2024-11-02 11:58:35 -04:00
modeco80
a3581854d2 had to help this hellfest of a language along slightly 2024-11-02 08:06:36 -04:00
modeco80
9fbdb84822 ok fiiiiine i'll do it the non hacky way 2024-11-02 07:54:26 -04:00
modeco80
86f1345a2d cvmts: Only target QEMU vCPU threads by default
Previous behaviour was to limit the whole QEMU process; this only limits the vCPU threads. A bit (very) hacky how I did this but it does work.
2024-11-02 07:46:59 -04:00
modeco80
4344b233bc cvmts: Bump up cpu.max period to 100000
(well, it DOES still work, but i imagine it's 100000 by default for a reason)
2024-11-02 06:33:31 -04:00
modeco80
e780ecabf0 cvmts: Add support for cgroup process resource limits on Linux
Using systemd's `Delegate=` option, it is possible to get it to let you manage your own cgroup subtree, therefore allowing you to set options and other fun stuff.

This commit adds support for doing so and configuring the resource limits in config.toml.

For later: The cgroup created has to be a threaded one. Iin theory, we can actually wait for the QEMU process to handshake qmp, grab the vCPU threads, and only limit those. For now, just limiting the entire QEMU process works, though and is the least complicated.

NOTE: Windows support should still work, even if you have resource limits configured. If you do, it should only warn and complain, but still function.
2024-11-02 06:08:26 -04:00
modeco80
bbc873a113 cvmts: Bump superqemu to 0.3.0 2024-11-02 03:11:07 -04:00
modeco80
25ed0515dd Revert "cvmts: rate limit the 'sync' instruction"
This reverts commit 199924ff92.

nvm the decade old shitcode webapp that people seem to still flock to for NO reason breaks
honestly why do we even support that hunk of trash it's a decade old, falling apart, and all it does
is stifle progress if anything
2024-10-05 05:11:02 -04:00
modeco80
199924ff92 cvmts: rate limit the 'sync' instruction
the original Guacamole code did this too I'm pretty sure, and it was even more aggressive about it.
2024-10-05 05:00:52 -04:00
modeco80
41ee71f053 cvmts: Add staff audit logging support
Basically what it says on the tin.

More staff operations should probably be audited, but for now this provides a good starting point.
2024-09-21 21:14:27 -04:00
modeco80
072fd06918 cvmts: fix display event handler duplication
By only adding event handlers when the display is first lazily initalized.
2024-09-19 04:11:25 -04:00
modeco80
210e36f430 cvmts: fix memory leak
javascript blows chunks
2024-09-12 13:11:12 -04:00
modeco80
9d57779c75 fix config error logging so pino actually logs the Error object 2024-09-09 22:39:01 -04:00
modeco80
689be9d395 cvmts: Explicitly disable ws PMD/tracking
Seems to fix or at least make a pretty bad memory leak much slower.

I hate ws but the only other library is written by someone who isn't
a very nice person (putting it on the nice side)
2024-09-05 04:15:19 -04:00
modeco80
fae4c6d146 cvmts: Fix WebSocket errors causing process crashes 2024-08-30 20:30:17 -04:00
modeco80
4c085619ff remove todo that was done already 2024-08-23 10:15:38 -04:00
modeco80
48409a469a remove dead import 2024-08-23 10:15:38 -04:00
modeco80
a8d32f0555 move ProtocolManager into its own unit 2024-08-23 10:15:35 -04:00
modeco80
74d7b17d8b re-org source tree slightly
network layer is net/
protocol is protocol/
2024-08-23 10:15:10 -04:00
modeco80
f7fb30ba20 make network abstraction pass bare buffer
this bitrots tcp a bit. once the tcp protocol is replaced with a message based one it shouild be fine
2024-08-23 10:14:25 -04:00
modeco80
53b5b6d874 oops 2024-08-23 10:14:25 -04:00
modeco80
8f48092c5c move turn to protocol
everything now uses the protocol layer! woohoo.
2024-08-23 10:14:25 -04:00
modeco80
5dc53116b2 move flag and rename to protocol layer
This means that 'turn' is now the only thing not sent by the protocol layer.
2024-08-23 10:14:25 -04:00
modeco80
c9edb174f1 keep forgeting javascript tooling has about the same usability as a 80s ford 2024-08-23 10:14:25 -04:00
modeco80
0010a8f300 move 'vote' to Protocol 2024-08-23 10:14:24 -04:00
modeco80
1673f0abd7 move some shared stuff into a new baseclass for protocols to implement
will make greenfield (i.e: brand new non-Guac or whatever) protocol implementation a bit less boilerplatey
2024-08-23 10:14:23 -04:00
modeco80
4583531fce re-implement binrect protocol
pretty easy since we can just subclass guac
2024-08-23 10:14:23 -04:00
modeco80
6e1a075194 oops thought that was one of the admin only opcodes 2024-08-23 10:14:22 -04:00
modeco80
a82388f823 handle admin messages
TODO: Add senders for admin responses
and flag
and rename

also verify I didn't fuck boolean conversion up
2024-08-23 10:14:20 -04:00
modeco80
1c062697b9 WIP: protocol abstraction
Work on abstracting the CollabVMServer so it now calls into a interface for sending/recieving protocol messages. This will allow cleaner bringup of a fully binary protocol, and generally is just cleaner code.

Mostly everything is parsd/running through this new layer, although there are some TODO items:

- NetworkClient/... should just spit out a Buffer or something that eventually turns into or has one
- TCP protocol will need to be revamped so we can support an actual binary protocol on top of it. The current thing is line based
- More admin op stuff needs to be handled
- The handlers are a bit jumbled around atm
- There is still a good amount of code which assumes guacamole which needs to be rewritten

dont use this branch fuckers
2024-08-23 10:13:15 -04:00
modeco80
338cc6e824 clean up some stuff and upgrade to the latest superqemu release 2024-08-23 10:01:41 -04:00
modeco80
b66810a227 it is nullable now so this comment doesn't make sense anymore 2024-08-23 07:29:32 -04:00