Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
261 commits
Select commit Hold shift + click to select a range
0005dda
Correct spelling
IIamaseconds Aug 13, 2025
131e697
Fix spelling
IIamaseconds Aug 13, 2025
316fe61
Add logger and logger endpoint
IIamaseconds Aug 13, 2025
d664aa6
.gitignore logfiles
IIamaseconds Aug 13, 2025
bdfe797
Update Frontpage.tsx
IIamaseconds Aug 13, 2025
e36ea23
Remove redundant TLSConfig
IIamaseconds Aug 14, 2025
5eff365
Merge branch 'main' of github.com:IIamaseconds/broadcast-box into main
IIamaseconds Aug 14, 2025
2ba5519
Prioritize TURN_SERVERS_INTERAL when selecting for backend
IIamaseconds Aug 14, 2025
84922a2
Handle http with fatal
IIamaseconds Aug 14, 2025
31612b8
Fix missing assignation to udpMux after creation
IIamaseconds Aug 14, 2025
bbd1500
Move console flag handling into a console package
IIamaseconds Aug 14, 2025
2086748
Implement const for environment variables
IIamaseconds Aug 14, 2025
754be05
Migrate main to use console package instead of environment for consol…
IIamaseconds Aug 14, 2025
6e80269
Convert all uses of Getenv with string values to refer to const values
IIamaseconds Aug 14, 2025
575f4db
Update logger package
IIamaseconds Aug 14, 2025
296404b
Update build-container to point to docker.io account used for forked …
IIamaseconds Aug 14, 2025
10f980a
Remove test character
IIamaseconds Aug 14, 2025
fe61179
Fix excessive line
IIamaseconds Aug 14, 2025
499f575
Update logging and add option for api key
IIamaseconds Aug 14, 2025
d048c06
Fix lint issues
IIamaseconds Aug 14, 2025
31de243
Fix spelling
IIamaseconds Aug 15, 2025
b69506f
Add status endpoint for Whep session
IIamaseconds Aug 15, 2025
260cf00
Set default layer when creating whep session
IIamaseconds Aug 15, 2025
f95ce0b
Propagate json errors
IIamaseconds Aug 15, 2025
86b74cb
Receive current layer value from parent, and update if backend sends new
IIamaseconds Aug 15, 2025
e549c35
Update player to receive currentLayers event from backend to update f…
IIamaseconds Aug 15, 2025
5e4a914
Fix spelling
IIamaseconds Aug 15, 2025
d116c80
Setup prioritized stream layers
IIamaseconds Aug 15, 2025
8f396e1
Include error handling for unmarshal
IIamaseconds Aug 15, 2025
cba294a
Cleanup env.dev file
IIamaseconds Aug 17, 2025
822dc9e
Update variables
IIamaseconds Aug 18, 2025
d6b7c43
Implement new STREAM_PROFILE_POLICY authorization for Whip sessions
IIamaseconds Aug 18, 2025
5331218
Use new variable name for Frontend_Disabled
IIamaseconds Aug 18, 2025
97e85f6
Update README.md
IIamaseconds Aug 19, 2025
94a44e9
Fix broken link in Readme.md
IIamaseconds Aug 19, 2025
7f01ebd
Update README.md
IIamaseconds Aug 19, 2025
70714ba
Update session status to include includePrivate flag
IIamaseconds Aug 20, 2025
c8d4bb2
Adding preliminary endpoints for admin portal
IIamaseconds Aug 20, 2025
0257d7f
Update frontend with new Admin portal
IIamaseconds Aug 20, 2025
e869cfb
Update status endpoints to include IsPublic for admin portal
IIamaseconds Aug 20, 2025
f8ad94b
Update .gitignore
IIamaseconds Aug 23, 2025
0651b59
Minor README corrections
IIamaseconds Aug 23, 2025
17f078e
Update Stream Profile type
IIamaseconds Aug 23, 2025
7015125
Update authorization and add funcs for profile management
IIamaseconds Aug 23, 2025
1d1ee6a
Return on errors
IIamaseconds Aug 23, 2025
4baef4b
Implement admin endpoints and update public
IIamaseconds Aug 23, 2025
fcaa344
Update internals to reflext changes in Profile types
IIamaseconds Aug 23, 2025
3795489
Prepare for Api and Logging admin pages
IIamaseconds Aug 23, 2025
bec97d1
Update Admin Status page UI
IIamaseconds Aug 23, 2025
3fa554a
Create Admin Profile overview page with token reset feature
IIamaseconds Aug 23, 2025
0a3729a
Update admin portal frontpage
IIamaseconds Aug 23, 2025
f0a6e90
Add IsDisabled property to Button component
IIamaseconds Aug 24, 2025
c2adec9
Update ModalTextInput to support error messages
IIamaseconds Aug 24, 2025
7fc787c
Add ModalMessageBox component
IIamaseconds Aug 24, 2025
a0a2e0c
Create chunks when building project
IIamaseconds Aug 24, 2025
bdc2e7d
Handle statuscode 400 separately
IIamaseconds Aug 24, 2025
2e73e71
Disable pages that are not currently implemented
IIamaseconds Aug 24, 2025
482bca9
Add profile features for overview, add, remove and refresh token
IIamaseconds Aug 24, 2025
a0715d9
Update auth package to support profile removal
IIamaseconds Aug 24, 2025
397d53b
Add handlers for adding and removing profiles
IIamaseconds Aug 24, 2025
0d7111c
Prepare for admin portal SSE implementation
IIamaseconds Aug 24, 2025
21f36e8
Map server endpoints for profile add, remove
IIamaseconds Aug 24, 2025
7b64ec8
Fix lint issues
IIamaseconds Aug 24, 2025
ad68839
Fix lint errors
IIamaseconds Aug 24, 2025
75a4225
Merge pull request #1 from IIamaseconds/admin-portal
IIamaseconds Aug 24, 2025
ec9a721
Add vendors to gitignore
IIamaseconds Aug 24, 2025
306c44d
Remove redundant profile policy
IIamaseconds Aug 24, 2025
7210b38
Return empty instead of error when no profiles are present
IIamaseconds Aug 24, 2025
e42bf96
Unmarshal to internal Profile type before converting to PublicProfile
IIamaseconds Aug 24, 2025
1dc01ea
ProfilePage.tsx lint
IIamaseconds Aug 24, 2025
7d931de
Allow for stream to takeover
IIamaseconds Aug 24, 2025
0a5e6e9
Attempt to avoid premature closure of stream
IIamaseconds Aug 24, 2025
3959e5e
Revert attempt
IIamaseconds Aug 24, 2025
c74e30d
Remove debugging logs
IIamaseconds Sep 4, 2025
6402c4e
Add temp favicon
IIamaseconds Sep 4, 2025
ffd8986
Refactor frontend for simplier component use
IIamaseconds Sep 4, 2025
7f67159
Refactor endpoints and add endpoints for streaming profile
IIamaseconds Sep 5, 2025
aff1577
Add Streaming Profile endpoints
IIamaseconds Sep 5, 2025
8ed0774
Refactor frontend UI
IIamaseconds Sep 5, 2025
567039c
Fix profile lookup bug
IIamaseconds Sep 5, 2025
106d2fb
Cleanup debugging
IIamaseconds Sep 5, 2025
1998ebf
Find and update current sessions when updating profile
IIamaseconds Sep 5, 2025
39d2813
Add MOTD to status for AvailableStreams button subTitle
IIamaseconds Sep 5, 2025
e582411
Add channels
IIamaseconds Sep 5, 2025
94a688a
Add Button support for subtitle
IIamaseconds Sep 5, 2025
72a11f6
Add motd to status provider
IIamaseconds Sep 5, 2025
201e77c
Add MOTD to AvailableStreams button
IIamaseconds Sep 5, 2025
13b8913
Only use profile if it has been found
IIamaseconds Sep 5, 2025
20d0f8b
Use typed result from ice endpoint, and dont force 'relay' connection
IIamaseconds Sep 5, 2025
541ef97
Allow adding public streams directly from Available list
IIamaseconds Sep 5, 2025
5861c37
Implementation of Locales support
IIamaseconds Sep 8, 2025
ed6c497
Fix nav size
IIamaseconds Sep 9, 2025
5c14d57
Change width of locale selector buttons
IIamaseconds Sep 9, 2025
7809788
Add gap to toggle buttons icon and text
IIamaseconds Sep 9, 2025
f1eb565
Update frontend and backend dependencies
IIamaseconds Sep 13, 2025
7054fb7
Add backend log output to admin page
IIamaseconds Sep 13, 2025
c3cbda8
Update locales
IIamaseconds Sep 13, 2025
de499bb
Update TextInputDialog to support Passwords and custom button title
IIamaseconds Sep 13, 2025
00dd888
Set login input to be password type and custom button title
IIamaseconds Sep 13, 2025
d76dfbc
Remove unneeded logging
IIamaseconds Sep 13, 2025
b4e45e9
TrackMultiCodec logging changes
IIamaseconds Sep 13, 2025
36a744e
Improve UI for Player component
IIamaseconds Sep 13, 2025
0a72311
Cleanup
IIamaseconds Sep 13, 2025
5590076
Correct by linter
IIamaseconds Sep 13, 2025
94c0929
Fix incorrect whip profile path
IIamaseconds Sep 17, 2025
e1bfa39
Remove text from ModalTextInput to only use locale
IIamaseconds Sep 17, 2025
1a8cd2c
Add Copy icon
IIamaseconds Sep 17, 2025
038f868
Add Yes/No locale for profiles page
IIamaseconds Sep 17, 2025
199ce5a
Add Copy token to clipboard
IIamaseconds Sep 17, 2025
bc56988
Refactor helpers
IIamaseconds Sep 29, 2025
873a400
Allow stream profile to use UTF-8 characters
IIamaseconds Sep 29, 2025
fcbc697
Add utility for base64 utf8
IIamaseconds Sep 29, 2025
ec576da
Update bearer to support utf8 streamkeys and tokens in frontend
IIamaseconds Sep 29, 2025
e68bb8e
Do not manipulate streamkey in GetStream func
IIamaseconds Sep 29, 2025
5fba257
Include whitespace in bearer prefix
IIamaseconds Sep 29, 2025
53a56d7
Use json object for whep requests instead of auth header
IIamaseconds Sep 29, 2025
7751f0c
Add description to functions
IIamaseconds Oct 4, 2025
544bb73
Use locale for Settings header
IIamaseconds Oct 4, 2025
0996628
Move NetworkTest to Test folder
IIamaseconds Oct 4, 2025
8004573
Bug: ASCII strings caught as B64 strings
IIamaseconds Oct 4, 2025
4d0c9f5
Cleanup
IIamaseconds Oct 4, 2025
67cb135
Remove debug logging
IIamaseconds Oct 4, 2025
3976e3f
Fix various RW-locks for streams
IIamaseconds Oct 4, 2025
14f7bf5
Move Layers into current read lock to avoid deadlock
IIamaseconds Oct 4, 2025
184fce9
Remove uneccesary whip sessions lock
IIamaseconds Oct 4, 2025
6157282
Remove debugging log
IIamaseconds Oct 4, 2025
bd40baa
Bump dependency version
IIamaseconds Oct 20, 2025
5837559
Broadcast component has missing locales
IIamaseconds Oct 20, 2025
b0c4ce3
Update locale paths
IIamaseconds Oct 20, 2025
8127797
Update Player component
IIamaseconds Oct 20, 2025
badd743
Backend rewrite
IIamaseconds Oct 20, 2025
c4f351c
Temp removal of whip test
IIamaseconds Oct 20, 2025
2dcfb3b
Add error logging on evtSource error for player
IIamaseconds Oct 20, 2025
40aa49a
Temporarily remove waiting for ice gathering on peerconnection
IIamaseconds Oct 20, 2025
f8248ca
Add cinemamode toggle for player page
IIamaseconds Oct 20, 2025
fddd81b
Temp PeerConnection check
IIamaseconds Oct 20, 2025
e03a618
Do not send to event channel if not initiated
IIamaseconds Oct 22, 2025
54baa60
Do not send status to whip session
IIamaseconds Oct 22, 2025
fa222b5
Add and update descriptions
IIamaseconds Oct 27, 2025
7f042db
Remove redundant ticker stop
IIamaseconds Oct 27, 2025
37e18d1
Update Whip audio/video writers
IIamaseconds Oct 27, 2025
6178707
Update whep writers to support channels
IIamaseconds Oct 27, 2025
1637651
Add session monitor for stale sessions
IIamaseconds Oct 27, 2025
2ec5624
Check for keyframe
IIamaseconds Oct 27, 2025
ab1a7c7
Downgrade dependencies
IIamaseconds Oct 27, 2025
843be48
Bump dependencies
IIamaseconds Oct 27, 2025
abe398f
Minor changes
IIamaseconds Oct 27, 2025
390e543
Reintroduce packet sequence
IIamaseconds Oct 27, 2025
8fa88a8
Optimize stability through channels
IIamaseconds Nov 1, 2025
7161303
Increase channel size for whep sessions
IIamaseconds Nov 1, 2025
4e73747
Remove debug logging
IIamaseconds Nov 1, 2025
996d899
Comment out session cleanup
IIamaseconds Nov 1, 2025
587c639
Stability fixes
IIamaseconds Nov 2, 2025
30789dd
Increase channel size for Audio/Video
IIamaseconds Nov 2, 2025
93b117f
Test locking
IIamaseconds Nov 2, 2025
ac12ef7
Reverse log output
IIamaseconds Nov 2, 2025
cae392a
Rename snapshot func
IIamaseconds Nov 2, 2025
9bcbcfe
Capture PLI from Whep sessions to trigger keyframe
IIamaseconds Nov 2, 2025
3b9ce1a
Monitor dropped packets for WHEP sessions
IIamaseconds Nov 2, 2025
b63235d
Remove debug logging and reintroduce session monitor
IIamaseconds Nov 2, 2025
8b548eb
Cleanup
IIamaseconds Nov 2, 2025
8970d76
Minor refactoring
IIamaseconds Nov 2, 2025
f098994
Ignore gathering
IIamaseconds Nov 2, 2025
974f202
Close go routine when ending whip session
IIamaseconds Nov 2, 2025
7895579
Fix slow connection issue
IIamaseconds Nov 2, 2025
4e503c2
Cleanup
IIamaseconds Nov 2, 2025
5a13f37
Cleanup logging
IIamaseconds Nov 2, 2025
f602bf6
Cleanup
IIamaseconds Nov 2, 2025
fa8018d
Frontend minor changes
IIamaseconds Nov 2, 2025
1dee5d1
Handle stream stability
IIamaseconds Nov 2, 2025
4aebfe9
Include startup time
IIamaseconds Nov 2, 2025
716225d
Change datetime format
IIamaseconds Nov 2, 2025
2da584b
Include time import
IIamaseconds Nov 2, 2025
7ff70a4
Use pointer instead of copy
IIamaseconds Nov 2, 2025
5295cb1
Revert pointer until fixed
IIamaseconds Nov 2, 2025
53887a9
Update README.md
IIamaseconds Nov 4, 2025
fb517d4
Minor changes
IIamaseconds Nov 10, 2025
238940e
Cancel existing context if any present
IIamaseconds Nov 14, 2025
51c9c47
Avoid deadlock in session loop
IIamaseconds Nov 14, 2025
7bae33a
Add log for RemoveWhepSessions
IIamaseconds Nov 14, 2025
7c2c8a1
Better packet handling and logging
IIamaseconds Nov 14, 2025
98d456d
Minor improvements
IIamaseconds Nov 14, 2025
a514c6b
Cleanup and error handling
IIamaseconds Nov 15, 2025
13e3b4f
Testing spamming keyframes
IIamaseconds Nov 15, 2025
b4fe387
WhepSession improvement
IIamaseconds Nov 18, 2025
10bc185
Add check for whip host and packets dropped for track states
IIamaseconds Nov 18, 2025
7c849b2
Use ctx cancel instead of calling Close on Whep
IIamaseconds Nov 18, 2025
5ed74bb
Add packets dropped to whip session
IIamaseconds Nov 18, 2025
4714135
Use seconds for readabililty
IIamaseconds Nov 18, 2025
64864f1
Whip packets check for current layer, and add overflow packets to buffer
IIamaseconds Nov 18, 2025
58e9f1c
Add additional environment variables
IIamaseconds Nov 27, 2025
0e3d726
Only run profiling if set in envar
IIamaseconds Nov 27, 2025
88cac0b
Vendor update
IIamaseconds Nov 27, 2025
ab196b5
Update locales
IIamaseconds Nov 27, 2025
ae4b342
Update statusprovider to include packets dropped for future use
IIamaseconds Nov 27, 2025
997cb44
Update statistics page
IIamaseconds Nov 27, 2025
062cc18
Extend SSE timeouts
IIamaseconds Nov 27, 2025
8d0f757
Refactor
IIamaseconds Nov 27, 2025
1e9537b
Allow 5 PLI messages for PLI Channel
IIamaseconds Nov 27, 2025
ea2e2e8
Minor improvements to player UI
IIamaseconds Nov 27, 2025
29e01af
Replace unused logging
IIamaseconds Nov 28, 2025
960ba0d
Make stream writing more synchronous
IIamaseconds Nov 28, 2025
ea63214
Remove unused import
IIamaseconds Nov 28, 2025
68fe96a
Set WhepSessions to nil if stream concludes
IIamaseconds Nov 28, 2025
9b9b5ec
Only active sessions should be in whip session snapshot
IIamaseconds Nov 28, 2025
33da8a3
Remove unused import
IIamaseconds Nov 28, 2025
6c7dff7
Reduce uneccessary code from AudioWriter
IIamaseconds Nov 28, 2025
3205082
Reintroduce buffer to attempt to reduce jitter
IIamaseconds Nov 28, 2025
69a6123
Attempt packet buffer for video to reduce jitter
IIamaseconds Nov 28, 2025
0b1fdfd
Use correct RTPCodecType for Audio streams
IIamaseconds Nov 28, 2025
32068d7
Use empty map instead of nil when removing snapshot
IIamaseconds Nov 29, 2025
87c27af
Comment out unused AudioTimestamp
IIamaseconds Nov 29, 2025
498edd0
Stability improvements made by reverting channelized packet distribut…
IIamaseconds Nov 29, 2025
40edd73
Fix lint error
IIamaseconds Nov 29, 2025
52b9664
Fix variable name
IIamaseconds Nov 30, 2025
4baf03a
Update README to include new variables
IIamaseconds Nov 30, 2025
5d45a32
Correct placement of StatusMessage and move to its own component
IIamaseconds Nov 30, 2025
f487d10
Cleanup
IIamaseconds Nov 30, 2025
0cd5386
Fix indentation
IIamaseconds Nov 30, 2025
d6963e1
Remove unused debugging color
IIamaseconds Nov 30, 2025
1338602
Merge pull request #6 from IIamaseconds/fix-player-ui
IIamaseconds Nov 30, 2025
a0683d0
Move Player MOTD to separate component
IIamaseconds Dec 2, 2025
a92634d
Cleanup unused imports
IIamaseconds Dec 2, 2025
c703415
Use CameraIcon without slash when loading stream
IIamaseconds Dec 3, 2025
4668a91
Add mouse scroll to volume component
IIamaseconds Dec 4, 2025
c347d89
Fix close button and cleanup formatting
IIamaseconds Dec 6, 2025
215f8c1
Merge pull request #8 from IIamaseconds/fix-player-close-button
IIamaseconds Dec 6, 2025
f2d7326
Add Eslint
IIamaseconds Dec 16, 2025
116c79f
Merge pull request #9 from IIamaseconds/eslint-add
IIamaseconds Dec 16, 2025
a36bdd1
Rework backend structure for easier maintainability
IIamaseconds Jan 25, 2026
1263b6c
Add golangci config
IIamaseconds Jan 25, 2026
3ee31c9
Update locales
IIamaseconds Jan 25, 2026
446c665
Update statistics to include bitrates
IIamaseconds Jan 25, 2026
04104b7
Cleanup on player
IIamaseconds Jan 25, 2026
1694fc3
Add default sort order on status page
IIamaseconds Jan 25, 2026
d12ef7f
Cleanup
IIamaseconds Jan 25, 2026
036b798
Add new status values to provider
IIamaseconds Jan 25, 2026
a797268
Update dependencies
IIamaseconds Jan 25, 2026
063ae9b
Replace deprecated depacketizer
IIamaseconds Jan 25, 2026
9967e4d
Replace deprecated functions
IIamaseconds Jan 25, 2026
d84d560
Improved Bearer token B64 handling
IIamaseconds Jan 27, 2026
868c052
Merge all forked changes into origin.
IIamaseconds Jan 27, 2026
5d763ff
Update dependencies
IIamaseconds Jan 27, 2026
3ce06bf
Remove tests for now
IIamaseconds Jan 27, 2026
5fd9aa6
Include logging origin
IIamaseconds Feb 14, 2026
eb4b0df
Add PeerConnectionLock to Whep
IIamaseconds Feb 14, 2026
0af7691
Add util for SDP Offer Validation
IIamaseconds Feb 14, 2026
2f22363
Implement ICE-Trickle Patching
IIamaseconds Feb 14, 2026
6347f8d
Check return value for patch
IIamaseconds Feb 14, 2026
c2b0ba7
Move validation of Offer into PATCH segment for WHEP
IIamaseconds Feb 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ################
# SERVER
# ################

# HTTP_ADDRESS=:8080
# HTTPS_REDIRECT_PORT=80
# HTTP_ENABLE_REDIRECT=TRUE
# NETWORK_TEST_ON_START=TRUE
# INCLUDE_PUBLIC_IP_IN_NAT_1_TO_1_IP=TRUE

# ################
# SSL
# ################

# USE_SSL=TRUE
# SSL_KEY=./certs/key.pem
# SSL_CERT=./certs/cert.pem

# ################
# AUTHORIZATION
# ################

# LOCAL STREAM PROFILE
# STREAM_PROFILE_ACTIVE=TRUE
# STREAM_PROFILE_PATH=./profiles

# WEBHOOK AUTHORIZATION
# WEBHOOK_URL=http://your-server

# ################
# FRONTEND
# ################

# DISABLE_FRONTEND=TRUE
# FRONTEND_PATH="./web/build"

# ################
# DEBUGGING
# ################

# DEBUG_INCOMING_API_REQUEST=TRUE
# DEBUG_PRINT_ANSWER=TRUE
# DEBUG_PRINT_OFFER=TRUE
69 changes: 62 additions & 7 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,9 +1,64 @@
HTTP_ADDRESS=":8080"
ENABLE_HTTP_REDIRECT=
VITE_API_PATH="http://localhost:8080/api"
# ################
# SERVER
# ################

# /etc/letsencrypt/live/<your-domain-name>/privkey.pem
SSL_KEY=
# HTTP_ADDRESS=:8080
# HTTPS_REDIRECT_PORT=80
# HTTP_ENABLE_REDIRECT=TRUE
# NETWORK_TEST_ON_START=FALSE
# INCLUDE_PUBLIC_IP_IN_NAT_1_TO_1_IP=TRUE

# /etc/letsencrypt/live/<your-domain-name>/fullchain.pem
SSL_CERT=
# ################
# SSL
# ################

# USE_SSL=TRUE
# SSL_KEY=./certs/key.pem
# SSL_CERT=./certs/cert.pem

# ################
# AUTHORIZATION
# ################

# LOCAL STREAM PROFILE
# STREAM_PROFILE_ACTIVE=TRUE
# STREAM_PROFILE_PATH=./profiles

# WEBHOOK AUTHORIZATION
# WEBHOOK_URL=http://your-server

# ################
# FRONTEND
# ################

# DISABLE_FRONTEND=TRUE
# FRONTEND_PATH="./web/build"

# ################
# TURN/STUN
# ################

# STUN_SERVERS="192.168.1.101:3478|192.168.1.101:3478"
# TURN_SERVERS="192.168.1.123:3478|192.168.1.321:3478"
# TURN_SERVERS_INTERNAL="10.100.0.10:3478"
# STUN_SERVERS_INTERNAL="10.100.0.10:3478"
# TURN_SERVER_AUTH_SECRET="YouSecret"

# ################
# DEBUGGING
# ################

# DEBUG_INCOMING_API_REQUEST=TRUE
# DEBUG_PRINT_ANSWER=TRUE
# DEBUG_PRINT_OFFER=TRUE
# DEBUG_PRINT_SSE_MESSAGES=TRUE

# ################
# LOGGING
# ################
# LOGGING_ENABLED=TRUE
# LOGGING_DIRECTORY=logs
# LOGGING_SINGLEFILE=FALSE
# LOGGING_NEW_FILE_ON_STARTUP=FALSE
# LOGGING_API_ENABLED=TRUE
# LOGGING_API_KEY=YourApiKey
48 changes: 41 additions & 7 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,9 +1,43 @@
HTTP_ADDRESS=":8080"
ENABLE_HTTP_REDIRECT=
VITE_API_PATH="/api"
# ################
# SERVER
# ################

# /etc/letsencrypt/live/<your-domain-name>/privkey.pem
SSL_KEY=
# HTTP_ADDRESS=:8080
# HTTPS_REDIRECT_PORT=80
# HTTP_ENABLE_REDIRECT=TRUE
# NETWORK_TEST_ON_START=TRUE
# INCLUDE_PUBLIC_IP_IN_NAT_1_TO_1_IP=TRUE

# /etc/letsencrypt/live/<your-domain-name>/fullchain.pem
SSL_CERT=
# ################
# SSL
# ################

# USE_SSL=TRUE
# SSL_KEY=./certs/key.pem
# SSL_CERT=./certs/cert.pem

# ################
# AUTHORIZATION
# ################

# LOCAL STREAM PROFILE
# STREAM_PROFILE_ACTIVE=TRUE
# STREAM_PROFILE_PATH=./profiles

# WEBHOOK AUTHORIZATION
# WEBHOOK_URL=http://your-server

# ################
# FRONTEND
# ################

# DISABLE_FRONTEND=TRUE
# FRONTEND_PATH="./web/build"

# ################
# DEBUGGING
# ################

# DEBUG_INCOMING_API_REQUEST=TRUE
# DEBUG_PRINT_ANSWER=TRUE
# DEBUG_PRINT_OFFER=TRUE
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,15 @@ yarn-error.log*
# media files
*.ogg
*.h264

# build files
BroadcastBox.exe

# log files
/logs

# profile files
/profiles

# Go vendors
/vendor
22 changes: 22 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "2"
linters:
enable:
- unused
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
4 changes: 4 additions & 0 deletions GoRun.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
go build -o BroadcastBox.exe
if ($LASTEXITCODE -eq 0) {
.\BroadcastBox.exe $args
}
146 changes: 106 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
- [Docker](#docker)
- [Docker Compose](#docker-compose)
- [Environment variables](#environment-variables)
- [Authentication and Logging](#authentication-and-logging)
- [Webhook - Authentication and Logging](#webhook---authentication-and-logging)
- [Network Test on Start](#network-test-on-start)
- [Design](#design)

## What is Broadcast Box
## What is Broadcast Box

Broadcast Box lets you broadcast to others in sub-second time. It was designed
to be simple to use and easily modifiable. We wrote Broadcast Box to show off some
Expand Down Expand Up @@ -197,6 +197,7 @@ will be automatically updated every night. If you are running on a VPS/Cloud ser
export URL=my-server.com
docker-compose up -d
```

## URL Parameters

The frontend can be configured by passing these URL Parameters.
Expand All @@ -205,43 +206,105 @@ The frontend can be configured by passing these URL Parameters.

## Environment Variables

The backend can be configured with the following environment variables.

- `WEBHOOK_URL` - URL for Webhook Backend. Provides authentication and logging
- `DISABLE_STATUS` - Disable the status API
- `DISABLE_FRONTEND` - Disable the serving of frontend. Only REST APIs + WebRTC is enabled.
- `HTTP_ADDRESS` - HTTP Server Address
- `NETWORK_TEST_ON_START` - When "true" on startup Broadcast Box will check network connectivity

- `ENABLE_HTTP_REDIRECT` - HTTP traffic will be redirect to HTTPS
- `SSL_CERT` - Path to SSL certificate if using Broadcast Box's HTTP Server
- `SSL_KEY` - Path to SSL key if using Broadcast Box's HTTP Server

- `NAT_1_TO_1_IP` - Announce IPs that don't belong to local machine (like Public IP). delineated by '|'
- `INCLUDE_PUBLIC_IP_IN_NAT_1_TO_1_IP` - Like `NAT_1_TO_1_IP` but autoconfigured
- `INTERFACE_FILTER` - Only use a certain interface for UDP traffic
- `NAT_ICE_CANDIDATE_TYPE` - By default setting a NAT_1_TO_1_IP overrides. Set this to `srflx` to instead append IPs
- `STUN_SERVERS` - List of STUN servers delineated by '|'. Useful if Broadcast Box is running behind a NAT
- `NETWORK_TYPES` - List of network types to use, delineated by '|'. Default is `udp4|udp6`.
- `INCLUDE_LOOPBACK_CANDIDATE` - Also listen for WebRTC traffic on loopback, disabled by default

- `UDP_MUX_PORT_WHEP` - Like `UDP_MUX_PORT` but only for WHEP traffic
- `UDP_MUX_PORT_WHIP` - Like `UDP_MUX_PORT` but only for WHIP traffic
- `UDP_MUX_PORT` - Serve all UDP traffic via one port. By default Broadcast Box listens on a random port

- `TCP_MUX_ADDRESS` - If you wish to make WebRTC traffic available via TCP.
- `TCP_MUX_FORCE` - If you wish to make WebRTC traffic only available via TCP.

- `APPEND_CANDIDATE` - Append candidates to Offer that ICE Agent did not generate. Worse version of `NAT_1_TO_1_IP`

- `DEBUG_PRINT_OFFER` - Print WebRTC Offers from client to Broadcast Box. Debug things like accepted codecs.
- `DEBUG_PRINT_ANSWER` - Print WebRTC Answers from Broadcast Box to Browser. Debug things like IP/Ports returned to client.

## Authentication and Logging
### Server Configuration

| Variable | Description |
| ----------------------- | -------------------------------------------------------- |
| `HTTP_ADDRESS` | Address for the HTTP server to bind to. |
| `ENABLE_HTTP_REDIRECT` | Enables automatic redirection from HTTP to HTTPS. |
| `HTTPS_REDIRECT_PORT` | Port to redirect HTTP traffic to HTTPS when using HTTPS. |
| `NETWORK_TEST_ON_START` | If "true", checks network connectivity on startup. |
| `DISABLE_STATUS` | Disables the status API endpoint. |
| `ENABLE_PROFILING` | Enables PPROF profiling on localhost:6060 |

### SSL Configuration

| Variable | Description |
| ---------- | --------------------------------- |
| `USE_SSL` | Setup the server to run with SSL. |
| `SSL_CERT` | Path to the SSL certificate file. |
| `SSL_KEY` | Path to the SSL key file. |

### Authorization & Profiles

| Variable | Description |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `STREAM_PROFILE_PATH` | Path to store stream profile configurations. |
| `STREAM_PROFILE_POLICY` | Policy configuration for stream profiles. Default is 'Anyone' See [Stream Profile Policy](#stream-profile-policy). |
| `WEBHOOK_URL` | URL for webhook backend used for authentication and logging. see [Webhook - Authentication and Logging](#webhook---authentication-and-logging). |

### Frontend Configuration

| Variable | Description |
| ---------------------- | -------------------------------- |
| `DISABLE_FRONTEND` | Disables frontend serving. |
| `FRONTEND_PATH` | Path to frontend assets. |
| `FRONTEND_ADMIN_TOKEN` | Admin token for frontend access. |

### WebRTC & Networking

| Variable | Description |
| ------------------------------------ | ------------------------------------------------------------------------ |
| `INCLUDE_PUBLIC_IP_IN_NAT_1_TO_1_IP` | Automatically includes public IPs in NAT configuration. |
| `NAT_1_TO_1_IP` | Manually specify IPs (like Public IP) to announce, delineated by `\|` |
| `INTERFACE_FILTER` | Restrict UDP traffic to a specific network interface. |
| `NAT_ICE_CANDIDATE_TYPE` | Set to `srflx` to append IPs instead of overriding with `NAT_1_TO_1_IP`. |
| `NETWORK_TYPES` | List of network types to use delineated by `\|` (e.g.,`udp4 \|udp6`). |
| `INCLUDE_LOOPBACK_CANDIDATE` | Enables WebRTC traffic on loopback interface. |
| `UDP_MUX_PORT` | Port to multiplex all UDP traffic. Uses random port by default. |
| `UDP_MUX_PORT_WHEP` | Port to multiplex WHEP traffic only. |
| `UDP_MUX_PORT_WHIP` | Port to multiplex WHIP traffic only. |
| `TCP_MUX_ADDRESS` | Address to serve WebRTC traffic over TCP. |
| `TCP_MUX_FORCE` | Forces WebRTC traffic to use TCP only. |
| `APPEND_CANDIDATE` | Appends ICE candidates not generated by the agent. |
| `WHEP_SESSION_AUDIOCHANNEL_SIZE` | Tunes the AudioChannel size for WHEP sessions. |
| `WHEP_SESSION_VIDEOCHANNEL_SIZE` | Tunes the VideoChannel size for WHEP sessions. |

### STUN/TURN Servers

| Variable | Description |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `STUN_SERVERS` | List of public STUN servers separated by `\|`. |
| `STUN_SERVERS_INTERNAL` | List of internal STUN servers used by the backend in case it has trouble connecting to the public STUN server. Separated by `\|`. |
| `TURN_SERVERS` | List of public TURN servers separated by `\|`. |
| `TURN_SERVERS_INTERNAL` | List of internal TURN servers used by the backend in case it has trouble connecting to the public TURN server. Separated by `\|`. |
| `TURN_SERVER_AUTH_SECRET` | Shared secret for TURN server authentication. |

### Debugging

| Variable | Description |
| ---------------------------- | ------------------------------------------- |
| `DEBUG_PRINT_OFFER` | Prints WebRTC offers received from clients. |
| `DEBUG_PRINT_ANSWER` | Prints WebRTC answers sent to clients. |
| `DEBUG_INCOMING_API_REQUEST` | Logs incoming API request paths. |
| `DEBUG_PRINT_SSE_MESSAGES` | Logs Server-Sent Events messages. |

### Logging

| Variable | Description |
| ----------------------------- | -------------------------------------------------------------------------------------------------------- |
| `LOGGING_ENABLED` | Enables logging system. |
| `LOGGING_DIRECTORY` | Directory to store log files. |
| `LOGGING_SINGLEFILE` | Logs everything into a single file called 'log'. Default is log files are stamped with current date. |
| `LOGGING_NEW_FILE_ON_STARTUP` | Creates a new log file on each startup. Either a new 'log' file, or replaces the current dates log file. |
| `LOGGING_API_ENABLED` | Enables logging API to show current log entries on the backend. `/api/log` |
| `LOGGING_API_KEY` | When set, the logging API requires a bearer token that uses this key. |

## Stream Profile Policy

The `STREAM_PROFILE_POLICY` environment variable controls who is allowed to initiate streaming sessions based on profile reservation status.

| Value | Description |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `ANYONE_WITH_RESERVED` | If Stream keys are reserved in advance, only a valid token can be used with them. If not reserved, anyone can used the streamkey |
| `RESERVED` | Only users with a valid token **and** a reserved stream key are allowed to stream. This is the most restrictive mode. |

## Webhook - Authentication and Logging

To prevent random users from streaming to your server, you can set the `WEBHOOK_URL` and validate/process requests in your code. This enables you to separate the authorization between broadcasting (whip) and watching (whep). So you can safely share a watch link without exposing the key used for broadcasting.

If the request succeeds (meaning the stream key is accepted), broadcast-box redirects the stream to an url given by the external server, otherwise the streaming request is dropped.
If the request succeeds (meaning the stream key is accepted), broadcast-box redirects the stream to an url given
by the external server, otherwise the streaming request is dropped.

See [here](examples/webhook-server.go). For an example Webhook Server that only allows the stream `broadcastBoxRulez`

Expand Down Expand Up @@ -285,11 +348,14 @@ If you wish to disable the test set the environment variable `NETWORK_TEST_ON_ST

## Design

The backend exposes three endpoints (the status page is optional, if hosting locally).
The backend exposes the following endpoints to support WebRTC streaming and server-side monitoring:

- `/api/whip` - Start a WHIP Session. WHIP broadcasts video via WebRTC.
- `/api/whep` - Start a WHEP Session. WHEP is video playback via WebRTC.
- `/api/status` - Status of the all active WHIP streams
| Endpoint | Description |
| ------------- | ----------------------------------------------------------------------------------------------------------------- |
| `/api/whip` | Initiates a WHIP session for broadcasting video via WebRTC. Requires the Authorization header with a bearer token |
| `/api/whep` | Initiates a WHEP session for video playback via WebRTC. |
| `/api/status` | Returns the status of all active WHIP streams. If a Stream Profile is not public, it will not be included. |
| `/api/log` | Retrieves current server logs. Useful for debugging and monitoring runtime activity. |

[license-image]: https://img.shields.io/badge/License-MIT-yellow.svg
[license-url]: https://opensource.org/licenses/MIT
Expand Down
Loading