Commit Graph

39 Commits

Author SHA1 Message Date
kozabrada123 89333d6353
Implement gateway options, zlib-stream compression (#508)
* feat: add GatewayOptions

* feat: implement zlib-stream compression

This also changes how gateway messages work.
Now each gateway backend converts its message into an
intermediary RawGatewayMessage, from which we inflate
and parse GatewayMessages.

Thanks to ByteAlex and their zlib-stream-rs crate, which
helped me understand how to parse a compressed websocket stream
2024-06-23 17:23:13 +02:00
kozabrada123 74d6785e50 Primitive voice implementation (feature/voice) (#457)
* Add Webrtc Identify & Ready

* Add more webrtc typings

* Attempt an untested voice gateway implementation

* fmt

* Merge with main

* Same allow as for voice as normal gateway

* Test error observer

* Minor updates

* More derives

* Even more derives

* Small types update

* e

* Minor doc fixes

* Modernise voice gateway

* Add default impl for voicegatewayerror

* Make voice event fields pub

* Event updates via the scientific method

* ??

* Fix bad request in voice gateway init

* Voice gateway updates

* Fix error failing to 'deserialize' properly

* Update voice identify

* Clarify FIXME related to #430

* Update to v7

* Create seperate voice_gateway.rs and voice_udp.rs

* Restructure voice to new module

* fix: deserialization error in speaking bitflags

* feat: kinda janky ip discovery impl

* feat: return ip discovery data + minor update

* feat: packet parsing!

* fix: voice works again

* feat: add voice_media_sink_wants

(comitting uncommited changes to merge)

* chore: rename events/webrtc to events/voice_gateway

* Add UdpHandle

* chore: clippy + other misc updates

* fix: attempt to fix failing wasm build

* chore: yes clippy, that is indeed an unneeded return statement

* feat: add VoiceData struct

* feat: add VoiceData reference to UdpHandler

* feat: decryption?

* chore: formatting

* feat: add ssrc definition (op 12)

* feat: add untested sending & asbtract nonce generation

* feat: Public api! (sorta)

* small updates

* feat: add sequence number

* chore: yes

* feat: merge VoiceHandler into official development

* chore: yes clippy, you are special

* fix: duplicated gateway events

* feat: first try at vgw wasm compat

* fix: blunder

* fix: gateway connect using wrong url

* fix: properly using encrypted data, bad practice for buffer creation

* chore: split voice udp

* feat: udp error handling, create udp/backends

* fix: its the same

* chore: clarify UDP on WASM

* api: split voice gateway and udp features, test for voice gateway in WASM

* feat: new encryption modes, minor code quality

* docs: document voice encryption modes

* chore: unused imports

* chore: update getrandom version to match wasm version

* chore: update on packet size FIXME

* drop buf asap

* Okay can't do that actually

* tests: add nonce test

* normal tests work?

* docs: fix doc warning, fix incorrect refrences to 'webrtc'

* chore: json isn't a doc test

* tests: better gateway auth test

* testing tests

* update voice heartbeat, fix the new test issue

* committed too much

* fix: unused import

* fix: use ip discovery address as string, not as Vec<u8>

* chore: less obnoxious logging

* chore: better unimplemented voice modes handling

* chore: remove unused variable

* chore: use matches macro

* add voice examples, make gateway ones clearer

* rename voice example

* chore: remove unused VoiceHandler

* fix: implement gateway Reconnect and InvalidSession

* Typo

Co-authored-by: Flori <39242991+bitfl0wer@users.noreply.github.com>

* Fix a bunch of typos

Co-authored-by: Flori <39242991+bitfl0wer@users.noreply.github.com>

* fix: error handling while loading native certs

* fix: guh

* use be for nonce bytes

* fix: refactor gw and vgw closures

* remove outdated docs

---------

Co-authored-by: Flori <39242991+bitfl0wer@users.noreply.github.com>
2024-04-16 17:18:21 +02:00
bitfl0wer b8ba92cf07 Include license header everywhere 2024-01-30 17:19:34 +01:00
bitfl0wer 153bfc26c9 Add comment about test_self_updating_structs 2024-01-24 23:02:16 +01:00
bitfl0wer 9168e5b904 extend self updating structs test 2024-01-24 23:01:38 +01:00
bitfl0wer b521928f81 Make IntoShared trait with blanket implementation 2024-01-22 14:56:23 +01:00
bitfl0wer c4bea069b7 Fix errors by moving into_shared out of Composite 2024-01-22 14:50:33 +01:00
bitfl0wer b5923c30e2 Replace Arc, Rwlock with Shared 2024-01-21 20:24:17 +01:00
bitfl0wer 83b8d7a6cd Remove "prettyfyme" -> solved 2023-11-22 20:54:51 +01:00
bitfl0wer c5e6c0b800 Add tests for GatewayMessage to increase coverage 2023-11-22 16:34:43 +01:00
bitfl0wer 38c95255c5 Replace #[tokio::test] w/ wasm-ok macro calls 2023-11-22 14:39:32 +01:00
bitfl0wer 0cae35e592 Remove broken test code 2023-11-22 14:24:10 +01:00
bitfl0wer 69f726af0e Fix formatting in test functions 2023-11-20 14:36:00 +01:00
bitfl0wer 0cdb76bcf3 remove all .await from wasm tests 2023-11-20 14:11:56 +01:00
bitfl0wer bd7bb90baf Add tests for WASM 2023-11-20 14:03:06 +01:00
bitfl0wer a4d5ebb689 Resolve merge conflicts 2023-11-19 19:12:29 +01:00
bitfl0wer 862a846055 Rename `get_handle` to `spawn` 2023-11-18 19:07:56 +01:00
bitfl0wer 16bdd68d98 Fixed most errors, simplified new generic traits 2023-11-18 18:39:01 +01:00
bitfl0wer 5bbf1cef1f Add prefix "Default" To Gateway, -Handler and HeartbeatHandler 2023-11-15 20:58:10 +01:00
bitfl0wer 5af6d1ce4b Refactor Gateway module to implement traits and
improve code structure
2023-11-15 18:44:19 +01:00
bitfl0wer d73c1963fc Start refactoring ChorusRequest to ChorusRequest::new() 2023-08-25 00:02:26 +02:00
bitfl0wer adf3d4ef31 Update test a little 2023-08-17 18:23:57 +02:00
bitfl0wer 7c8ad3ffcf Rewrite recursive update test (still fails sob) 2023-08-16 22:04:24 +02:00
bitfl0wer fbf72b74d0 Remove tokio watch channels 2023-08-16 21:26:19 +02:00
bitfl0wer e9f94267c6 Add recursive-updating-structs test 2023-08-16 14:06:04 +02:00
bitfl0wer e0340047fb Remove import 2023-08-16 01:11:48 +02:00
bitfl0wer e43fe061b3 Refactor test 2023-08-16 01:11:32 +02:00
bitfl0wer a9381fec1e Revert "Give `GatewayHandle` and `Gateway` common trait to call `watch_whole()` or observe() from a `Gateway`"
This reverts commit d36b1de170.
2023-08-16 00:21:18 +02:00
bitfl0wer d36b1de170 Give `GatewayHandle` and `Gateway` common trait to call `watch_whole()` or observe() from a `Gateway` 2023-08-16 00:18:32 +02:00
bitfl0wer 2fd1a7e7f4 Remove unused import 2023-08-15 20:30:30 +02:00
bitfl0wer c03b250248 Clean up test 2023-08-15 20:20:58 +02:00
bitfl0wer c3be91667b Try calling new method to see if it panics 2023-08-15 17:54:48 +02:00
bitfl0wer c0c873d460 Update test to match code changes 2023-08-13 16:44:58 +02:00
bitfl0wer 73cc139e78 Moddify observe to still store T internally 2023-08-13 15:52:16 +02:00
fowb 29d4ef23a2 Change T: Updateable to Arc<RwLock<T>> 2023-08-12 22:40:40 +02:00
fowb a0c9f6fb14 Change observe() to take Arc<RwLock<T>> 2023-08-12 19:47:11 +02:00
bitfl0wer 9246fd9504 Add `GatewayHandle` to `UserMeta` 2023-07-22 14:38:55 +02:00
Flori ccf44a5375 Auto updating structs (#163)
* Gateway fields don't need to be pub

* Add store to Gateway

* Add UpdateMessage trait

* Proof of concept: impl UpdateMessage for Channel

* Start working on auto updating structs

* Send entity updates over watch channel

* Add id to UpdateMessage

* Create trait Updateable

* Add documentation

* add gateway test

* Complete test

* Impl UpdateMessage::update() for ChannelUpdate

* Impl UpdateMessage::update() for ChannelUpdate
Co-authored by: SpecificProtagonist <specificprotagonist@posteo.org>

* make channel::modify no longer mutate Channel

* change modify call

* remove unused imports

* Allow dead code with TODO to remove it

* fix channel::modify test

* Update src/gateway.rs

Co-authored-by: SpecificProtagonist <vincentjunge@posteo.net>

---------

Co-authored-by: SpecificProtagonist <vincentjunge@posteo.net>
2023-07-21 15:35:31 +02:00
kozabrada123 88d571486b Basic tests 2023-06-08 19:51:32 +02:00