Commit Graph

96 Commits

Author SHA1 Message Date
Denys Smirnov
4ec0f8f4ce Support OpenTelemetry tracing. Add Jaeger support. (#4222) 2026-01-06 17:22:21 +02:00
Raja Subramanian
2510b9462e Taking a bunch of go modernize suggestions. (#4194)
This is not all of it as it is not possible (or at least I do not know
of a way) to get all suggestions for a repo/project. Did this via loop
searching mainly and taking the modernize suggestions.
2025-12-25 16:55:58 +05:30
Anunay Maheshwari
d6d2b6d833 feat(cli-flags): add option for cpu profiling (#3765) 2025-06-26 23:49:55 +05:30
Anunay Maheshwari
3783ebb320 feat(cli): update to urfave/cli/v3 (#3745)
* feat(cli): update to urfave/cli/v3

* fix(cli/v3): int/uint handling with reflection

* fix(cli/v3): better type convertion handling
2025-06-20 16:58:44 +05:30
Paul Wells
13b55a80ad move agent token (#3669) 2025-05-15 10:30:14 -07:00
Paul Wells
c9385edd1e handle agent worker jwt (#3668)
* handle agent worker jwt

* test

* tidy

* tidy

* deps
2025-05-15 08:23:10 -07:00
Raja Subramanian
8cc17f8f8b Rework node stats a bit. (#3555)
* Rework node stats a bit.

Related protocol PR - https://github.com/livekit/protocol/pull/1023

- Make a config for node stats measurements. Wanted to put the config in
  `routing` package, but a circular dependency forced me to put in
   config.go
- Make rate calculations explicit, i. e. requested via config.
  Previously, it had some odd checks to decide when to calculate rate
  and it would have been calculating over different windows.
- Report signal/data channel bytes every 5 seconds to stats collection
  module. Previously, it was doing it every 30 seconds and that meant
  some windows could have had a large spike
  NOTE: Still need to think about this for load calculations as a large
  number of participants leaving could flush in a small window and that
  could report a large spike in bytes/packets. Maybe need to ignore
  signal bytes for load calculation?

* deps

* use default node stats config if given config is nil

* split out node stats into a struct for re-use

* update config
2025-03-27 12:42:19 +05:30
Raja Subramanian
49b75e94a6 Consolidate operations on LocalNode. (#3140) 2024-10-25 18:57:23 +05:30
Paul Wells
f1886ece42 update protocol (#2760)
* update protocol

* deps
2024-06-05 19:46:34 -07:00
Mathew Kamkar
10c8582a6b get cpu stats from cgroup, remove env (#2636)
* get cpu stats from cgroup, remove env

* undo rand seed removal

* tests
2024-04-08 21:15:17 -07:00
Paul Wells
4bce0e7ed4 fix startup with -dev and -config (#2442) 2024-02-03 14:57:07 -08:00
Paul Wells
b9f9a6b35e force shutdown after second signal (#2364) 2024-01-05 04:16:02 -08:00
cnderrauber
75ffb25d77 Parse PortRange of UDPPort from cli flag (#2039) 2023-09-06 14:17:49 +08:00
cnderrauber
9b9298b927 Add batch i/o to improve throughput (#2033)
* Add batch i/o to improve throughput

* remove empty line

* Solve comments

* Change rtcconfig.UDPPort to PortRange

* Fix test
2023-09-06 10:18:20 +08:00
David Zhao
debd75fa15 Integrate logger components (#1933)
* Integrate logger components

Dividing into the following components
* pub - publisher
* pub.sfu
* sub - subscriber
* transport
* transport.pion
* transport.cc
* api
* webhook

* update go modules
2023-08-03 13:31:17 -07:00
David Zhao
981fb7cac7 Adding license notices (#1913)
* Adding license notices

* remove from config
2023-07-27 16:43:19 -07:00
David Zhao
8a1fc223da Fix RTC IP when binding to 0.0.0.0 (#1862) 2023-07-09 16:55:37 -07:00
David Zhao
4952c641b3 Fix regression when bind-address is not explicitly provided (#1837)
when bind address is set to loopback, it would break RTC IP discovery.
2023-06-28 20:22:59 -07:00
Juan Navarro
2668073c29 Honor bind address passed as --bind also for RTC ports (#1815)
* Use net.JoinHostPort to build "host:port" strings for `net.Listen`

net.JoinHostPort provides a unified way of building strings of the form
"Host:Port", abstracting the particular syntax requirements of some
methods in the `net` package (namely, that IPv4 addresses can be given
as-is to `net.Listen`, but IPv6 addresses must be given enclosed in
square brackets).

This change makes sense because an address such as `[::1]` is *not* a
valid IPv6 address; the square brackets are just a detail particular to
the Go `net` library. As such, this syntax shouldn't be exposed to the
user, and configuration should just accept valid IPv6 addresses and
convert them as needed for usage within the code.

* Use '--bind' CLI flag to also filter RTC bind address

The local address passed to a command such as

    livekit-server --dev --bind 127.0.0.1

was being used as binding address for the TCP WebSocket port, but was
being ignored for RTC connections.

With `--dev`, the conf.RTC.UDPPort config is set to 7882, which enables
"UDP muxing" mechanism. Without interface or address filtering, Pion
would try to bind to port 7882 on *all* interfaces.

This was failing on a system with IPv6 enabled, when trying to bind to
an IPv6 address of the `docker0` interface. It seems to make sense that
the user-passed bind addresses are also honored for the RTC port
bindings.
2023-06-28 16:52:43 -07:00
Benjamin Pracht
a08cd23b6d Adopt pion logging initialization moving to protocol (#1667) 2023-04-28 10:51:41 -07:00
David Zhao
57b931e9bd Fix return code when no panics have occurred (#1589)
Actually fix #1513
2023-04-07 19:54:30 -07:00
Dan McFaul
1848a21eda add configurable environment value (#1421)
* add configurable prometheus env label

* Update pkg/config/config.go

Co-authored-by: Mathew Kamkar <578302+matkam@users.noreply.github.com>

* Update cmd/server/main.go

Co-authored-by: Mathew Kamkar <578302+matkam@users.noreply.github.com>

* Update config-sample.yaml

Co-authored-by: Mathew Kamkar <578302+matkam@users.noreply.github.com>

* set config.Environment value to dev when in dev mode

* be more precise for config-sample

---------

Co-authored-by: Mathew Kamkar <578302+matkam@users.noreply.github.com>
2023-02-15 14:41:44 -07:00
Dan McFaul
ad7e075c18 exit after panic (#1392)
* let panics crash

* Revert "let panics crash"

This reverts commit 8027cccadd.

* catch and log panics then os.Exit

* Recover only recovers, caller can exit

* only exit on pacic, still need Recover calls in goroutines
2023-02-09 16:33:22 -07:00
Mathew Kamkar
7c970da974 add memory used and total to node stats (#1293)
* add memory used and total to node stats

* raja review: consistency

* update protocol
2023-01-10 12:32:04 -08:00
David Zhao
b1ba917a01 Validate keys to ensure sufficient security. (#1217)
JWT tokens are signed with HS256, and they must be 256 bits or longer to
guarantee security.
2022-12-07 22:25:28 -08:00
Mathew Kamkar
caae389717 node type prometheus metric labels (#1197) 2022-11-29 20:36:35 -08:00
Mathew Kamkar
11da6fc0ff rename hidden-help to help-verbose (#1180) 2022-11-21 10:58:48 -08:00
Mathew Kamkar
8c8a4d245c command to show help with hidden generated flags (#1171) 2022-11-16 19:20:22 -08:00
Mathew Kamkar
26fe910e88 Generated CLI Flags (#1112) 2022-10-25 22:24:08 -07:00
David Zhao
8a2c0ec574 Flag to bypass strict config enforcement (#1105)
Useful with the Helm charts, where other keys can be declared together.
2022-10-19 17:22:11 -07:00
Raja Subramanian
33f5dbc501 Make strict mode a param (#1054)
So, a wrapping config (like cloud) can skip the strict mode check.
2022-09-29 13:07:32 +05:30
Mathew Kamkar
767d660809 Use LocalNode ID in Prometheus metrics (#959) 2022-08-25 22:16:20 -07:00
Mathew Kamkar
e0676132d4 Packet stats from TC (#832)
* system level packet stats from tc

* drop percent

* test fix

* formatting

* formatting/wording

* prometheus metrics

* update livekit protocol go module
2022-07-15 10:41:40 -07:00
David Zhao
a2bf32797b Allow binding HTTP server to specific address (#831)
Improves security when running with placeholder keys. Only allowing
access from loopback by default.
2022-07-13 23:58:33 -07:00
David Zhao
b316698409 Release with GoReleaser. Allow start without key configuration (#788) 2022-06-26 12:27:43 -07:00
David Zhao
a933f1513f Add pprof endpoint when running in dev mode (#708) 2022-05-23 00:34:16 -07:00
Ivan
9eacad04c9 Improve list-nodes command output (#681)
tidied up list-nodes command output:

made the table narrower (to fit on the screen);
made numbers humanized;
added nodes state (useful with SHUTTING_DOWN state);
added retransmitted packets per second.
2022-05-11 09:57:44 -07:00
David Zhao
7eb3362d0a Keep track of retransmissions in NodeStats (#677) 2022-05-10 15:25:24 -07:00
David Colburn
0b8a180554 Code inspection (#581)
* Code inspection

* fix [4]int64 conversiong
2022-03-30 13:49:53 -07:00
Mathew Kamkar
cac6d22a72 store cpu load in node stats (#524)
* store cpu load in node stats

* num cpus uint32

* cpu load selector test

* dep update
2022-03-16 14:51:22 -07:00
David Colburn
3d132730f9 replace entire nodeStats object (#393) 2022-01-31 17:09:36 -07:00
David Colburn
5bea9debb7 Code cleanup (#353) 2022-01-19 02:13:06 -08:00
David Zhao
88cad8f093 Generate cleaner configs (#347)
Also upgrade to v1.17 for docker builds
2022-01-17 23:54:04 -08:00
David Zhao
c122c98e4d Improved logging configuration (#342) 2022-01-15 10:28:03 -08:00
David Colburn
faa870de3d Move callbacks out of messageRouter (#269)
* move callbacks out of messageRouter

* OCD

* more OCD

* fix forwarder test

* even more OCD

* maximum OCD

* package name collision, copy lock by value
2021-12-17 13:19:23 -08:00
David Colburn
c41384cd09 ActiveRecording (#234)
* ActiveRecording

* regenerate

* update to 0.10.3

* 1.17
2021-12-03 21:40:53 -08:00
Brint E. Kriebel
822f8c3944 Region Aware node selection fixes and enhancements (#141)
* cli: Allow setting the current node region with flag or env variable

Also add region to "starting LiveKit server" log.

* routing: Add region to node registration

Register the node's region on the selected router so it can be used for
region aware node selection.

Also add the region to the list-nodes output.

* regionaware: Set minDist to zero for the current node

If you don't set the minDist when leaving the loop early for a node that
matches the current region, the minDist value with still be at max. This
causes the the wrong node to be selected if the current node is the
first one the loop passes through.

Add a test that validates this change. The new test fails if this new
change is not in place.
2021-10-10 22:21:37 -07:00
Russ d'Sa
f6f5602bc4 consolidate on api key and api secret to describe our key pairs (#138)
* consolidate on api key and api secret to describe our key pairs

* tweak error message for the keys flag
2021-10-07 15:50:18 -07:00
Artur Shellunts
4915692f7c Refactor getConfigString (#133)
* Add test for getConfigString

* Refactor getConfigString

* Increase connect timeout in tests
2021-10-04 17:20:47 -07:00
Mathew Kamkar
700a879c0b Redis Router graceful stop (#116)
* prestop and hasparticipants in interface

* add prestop function to existing routers

* fakerouter prestop

* update protocol version

* read lock

* redis router graceful stop

* test fix

* force stop
2021-09-15 13:07:44 -07:00