Commit Graph

40 Commits

Author SHA1 Message Date
Joachim Bauch 1a8444ca71
Reuse backoff waiting code for initial proxy MCU connection. 2024-02-27 16:42:06 +01:00
Joachim Bauch 8f4fc2db6d
Calculate proxy load based on maximum bandwidth.
Take maximum bandwidth of connected clients into account when calculating
load as screensharing requires more than regular audio/video.
2024-02-27 15:20:17 +01:00
Joachim Bauch 7d09c71ab9
Strongly type "StreamType". 2024-02-27 15:20:14 +01:00
Joachim Bauch 59cf86d786
Add "welcome" endpoint to proxy. 2024-01-24 10:45:49 +01:00
Joachim Bauch e61845b086
Move common option list parsing code to own function. 2023-12-07 13:33:54 +01:00
Joachim Bauch dddf194b48
Use dedicated port for peer listener when testing. 2023-12-01 23:33:33 +01:00
Joachim Bauch c134883138
Switch to atomic types from Go 1.19 2023-10-30 09:32:46 +01:00
Joachim Bauch fd29f83454
Use "struct{}" channel if only used as signaling mechanism. 2023-06-15 11:30:28 +02:00
Joachim Bauch c11902b2f3
etcd: Use dedicated port for HTTP listener when testing to silent warning.
Follow-up to #475
2023-06-12 12:06:43 +02:00
Joachim Bauch 73808f5a68
Update for changed etcd config API. 2023-06-12 11:42:13 +02:00
Joachim Bauch be949f90b1
Add common code to handle allowed IPs. 2023-03-16 17:11:57 +01:00
Joachim Bauch d49d3704fa
Use interface for client callbacks. 2023-02-22 08:34:17 +01:00
Joachim Bauch 156bc360ff
Add hello version "2.0" that authenticates connections using a JWT. 2022-08-03 16:33:45 +02:00
Joachim Bauch 924fce6713
Stop using deprecated "jwt.StandardClaims". 2022-07-07 17:12:21 +02:00
Joachim Bauch 8a97fa7f5e
Update to Go module version of github.com/golang-jwt/jwt 2022-07-07 17:04:34 +02:00
Joachim Bauch f7db8a38e1
Send initial "welcome" message when clients connect.
This can be used to detect server features before performing the
actual "hello" handshake.
2022-07-07 09:57:10 +02:00
Joachim Bauch 134d22bfe7
Move common etcd code to own class. 2022-06-24 11:15:29 +02:00
Joachim Bauch 8ff62829ee
Add tests for etcd proxy tokens. 2022-05-13 14:37:21 +02:00
Daniel Calviño Sánchez e86baba54d Discard unneeded messages based on their "sid" parameter
If a message includes a "sid" parameter and it does not match the one
from the publisher or the subscriber the message is ignored. However, if
the message does not include a "sid" parameter it is processed just like
before for backwards compatibility.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2022-04-27 11:14:59 +02:00
Daniel Calviño Sánchez 3636e69dba Add specific ID for connections
A new ID is introduced for publishers and subscribers to be able to
identify different connections in the same session. While it was
possible to do that from the Janus handles this ID is meant to be shared
with the clients and set by the peer sending the offer, so it is set by
the client for publishers and by the signaling server for subscribers
(in which case the Janus handle is used).

This will make possible to know without any ambiguity if an offer/answer
belongs to an already existing connection or not. This can be used, for
example, to know if an offer represents an update or a new connection,
or to discard unneeded messages that might be sent in some corner cases
by the clients.

The ID name is "sid" for consistency with the property name used by the
internal signaling server of Talk.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2022-04-27 11:14:59 +02:00
Joachim Bauch 2a491ec3f0
Use "T.Cleanup()" instead of manually deferred shutdown function. 2022-04-05 12:57:40 +02:00
Joachim Bauch 81a52389aa
Stop using deprecated ioutil package. 2022-04-05 12:48:27 +02:00
Joachim Bauch 9c2df744c1
Switch to "T.TempDir()" to avoid manual cleanup. 2022-04-05 12:40:26 +02:00
Joachim Bauch 58b4beb3ba
Update etcd to v3.5.1
Requires at least Golang 1.14
2022-04-05 11:16:38 +02:00
Joachim Bauch 5101b16df3
Return dedicated error if proxy receives token that is not valid yet.
This can happen for example if the times of the machines running the
signaling server and proxy don't match.
2022-03-23 13:13:32 +01:00
Joachim Bauch 9f86c80c33
Only stop MCU if started before. 2022-03-23 11:46:17 +01:00
Joachim Bauch 7b631b0b2a
Format code using "gofmt". 2022-02-25 09:20:26 +01:00
Daniel Calviño Sánchez 020cbaf49d Send updated offers to subscribers after publisher renegotiations
When a publisher has a connection the publisher can update the
connection (for example, to add a video track to an audio only
connection) by sending an updated offer to Janus. Janus detects that,
adjusts the connection and then sends back an answer. Once the publisher
connection is updated Janus starts a renegotiation for the subscribers
and generates the offers to be sent to them.

The signaling server did not handle the event, so the offers were not
sent and the subscriber connections were not updated. Now the offers are
sent as needed, which makes possible for the renegotiation to be
completed by the clients.

In this case the "offer" message will also include an "update" parameter
so clients can differentiate between offers to create new connections or
update the existing one.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2022-02-25 07:47:17 +01:00
Joachim Bauch 414f78dd87
Fix formatting of non-string variable. 2022-01-10 15:03:54 +01:00
Joachim Bauch 707b125730
Check individual audio/video permissions on change.
If a client publishes audio/video and no longer has the video permission,
the whole publisher will be closed. Previously this was only checking
the generic "media" permission.
2021-11-08 12:08:14 +01:00
Joachim Bauch e09022c78d
deps: Migrate to "github.com/golang-jwt/jwt".
The previous "gopkg.in/dgrijalva/jwt-go.v3" is no longer maintained.
2021-10-11 14:02:57 +02:00
Joachim Bauch 4c77ae04ef
Close publishers/subscribers if proxy session is closed. 2021-08-10 09:24:59 +02:00
Joachim Bauch c01caa94e6
Add prometheus metrics. 2021-08-10 08:50:39 +02:00
Joachim Bauch 0a8ce3bda3
Add API to select a simulcast substream / temporal layer. 2021-06-08 13:49:08 +02:00
Joachim Bauch 2f4414561e
No need to include trailing newline in log messages. 2021-06-04 16:42:17 +02:00
Joachim Bauch 9b83993d48
Assume one Janus server is only used by one signaling server / -proxy.
With that, we can notify publisher events locally instead of through NATS
and can remove code that looks up publisher rooms by their ids on Janus.
2021-06-04 14:52:23 +02:00
Joachim Bauch c8e4bfe007
Fix various issues found by golangci-lint. 2021-04-26 17:25:52 +02:00
Joachim Bauch 1ceb806c20
Support defining maximum bandwidths at diferent levels.
- Individually for each backend.
- For the proxy client (i.e. signaling server using cluster of proxies).
- For the proxy server / MCU.

The smallest bandwidth configured will be used, e.g. if a backend has a
larger limit than the MCU assigned for the stream, the limit of the MCU
server will be used.
2021-04-23 09:18:05 +02:00
Joachim Bauch 9b0c4fab00
Update nats.go to 1.10.0 2021-04-13 16:47:28 +02:00
Joachim Bauch 8ba2e0ad64
Switch dependency tracking to Go modules.
With that bump minimum required version to Go 1.13.
2021-04-09 16:15:00 +02:00