Skip to content

Commit

Permalink
Add go2rtc package (SynoCommunity#5889)
Browse files Browse the repository at this point in the history
* Add go2rtc package
This commit adds the go2rtc package, a camera streaming application with support for various protocols. The package version is 1.7.1. The Makefile, PLIST, and digests for the package are created. The package is also added to the Synology package manager with the necessary configuration files, service setup script, and user interface files for installation and upgrade wizards. The package is configured to run as a background service with a dedicated user group.

* Update Maintainer in go2rtc Makefile
The maintainer of the go2rtc Makefile has been updated from AlexxIT to skrashevich. This change reflects the current responsibility for the maintenance of this file.

* fix PKG_DIST_{NAME,SITE,FILE} vars in cross/go2rtc/Makefile
Co-authored-by: hgy59 <[email protected]>

* Update go2rtc.png

* Add new configuration for go2rtc-srtp in go2rtc.sc and update service-setup.sh to include the new configuration if the package status is INSTALL

* backport AlexxIT/go2rtc#652

* fix srtp port typo

* Update cross/go2rtc/Makefile
Co-authored-by: hgy59 <[email protected]>

* update go2rtc configuration
- install go2rtc.yaml file
- remove environment-variables file
- remove obsolete variables
  - DSM_UI_DIR: no app icon is created in DSM UI (and app is the default DSM_UI_DIR anyway)
  - SPK_COMMANDS: there is no cli tool installed (go2rtc is used in SERVICE_COMMAND only)
- use sed to inject wizard variables into config file at package installation
- remove upgrade wizard

* update config
- avoid color codes in log output
- make config file more expressive by adding all listening ports (even the default ones)
- update WebRTC protocol description
- remove obsolete PATCH_LEVEL and include in cross/go2rtc/Makefile

* force use of ipv4 for srtp

* v1.8.1

---------

Co-authored-by: hgy59 <[email protected]>
  • Loading branch information
skrashevich and hgy59 authored Oct 18, 2023
1 parent 330056f commit 71d20d0
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 0 deletions.
30 changes: 30 additions & 0 deletions cross/go2rtc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
PKG_NAME = go2rtc
PKG_VERS = 1.8.1
PKG_EXT = tar.gz
PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/AlexxIT/go2rtc/archive
PKG_DIST_FILE = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
EXTRACT_PATH = $(WORK_DIR)/src/github.com/$(PKG_NAME)
PKG_DIR = src/github.com/$(PKG_NAME)/$(PKG_NAME)

BUILD_DEPENDS = native/go

HOMEPAGE = https://github.com/AlexxIT/go2rtc/
COMMENT = Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
LICENSE = MIT

POST_EXTRACT_TARGET = go2rtc_post_extract

GO_SRC_DIR = $(EXTRACT_PATH)/$(PKG_NAME)
GO_BIN_DIR = $(GO_SRC_DIR)/$(PKG_NAME)

GO_BUILD_ARGS = -trimpath
GO_LDFLAGS = -s -w

include ../../mk/spksrc.cross-go.mk

.PHONY: go2rtc_post_extract
go2rtc_post_extract:
@$(MSG) Rename extracted folder to make imports work when used as GOPATH
cd $(EXTRACT_PATH) && [ -d "$(PKG_NAME)-$(PKG_VERS)" ] && mv "$(PKG_NAME)-$(PKG_VERS)" $(PKG_NAME)
cd "$(EXTRACT_PATH)/$(PKG_NAME)" && env $(ENV) go mod edit -go=1.20 && env $(ENV) go get github.com/tillberg/autorestart
1 change: 1 addition & 0 deletions cross/go2rtc/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin:bin/go2rtc
3 changes: 3 additions & 0 deletions cross/go2rtc/digests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
go2rtc-1.8.1.tar.gz SHA1 3144ef9c6979a620abe92305f19853c57d0d8b72
go2rtc-1.8.1.tar.gz SHA256 5e0019f2e6e8df7b2fa0163064ffe5f2249795b270aca979c46c6a3bef9b7e5f
go2rtc-1.8.1.tar.gz MD5 0261df5faaedafd08eca30d6f6b502e5
35 changes: 35 additions & 0 deletions spk/go2rtc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
SPK_NAME = go2rtc
SPK_VERS = 1.8.1
SPK_REV = 1
SPK_ICON = src/go2rtc.png

DEPENDS = cross/go2rtc

UNSUPPORTED_ARCHS = $(PPC_ARCHS)

MAINTAINER = skrashevich
DESCRIPTION = Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc
DISPLAY_NAME = go2rtc
CHANGELOG = "Initial package release"
LICENSE_FILE = $(WORK_DIR)/src/github.com/go2rtc/go2rtc/LICENSE
HOMEPAGE = https://github.com/AlexxIT/go2rtc
LICENSE = MIT

WIZARDS_DIR = src/wizard

FWPORTS = src/go2rtc.sc
# Console Port (API and web UI Port)
ADMIN_PORT = 1984

SERVICE_USER = auto
STARTABLE = yes
SERVICE_SETUP = src/service-setup.sh

POST_STRIP_TARGET = go2rtc_extra_install

include ../../mk/spksrc.spk.mk

.PHONY: go2rtc_extra_install
go2rtc_extra_install:
@install -d -m 755 $(STAGING_DIR)/var
@install -m 644 src/go2rtc.yaml $(STAGING_DIR)/var/
Binary file added spk/go2rtc/src/go2rtc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions spk/go2rtc/src/go2rtc.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[go2rtc]
title="go2rtc API (HTTP)"
desc="go2rtc API"
port_forward="yes"
dst.ports="1984/tcp"

[go2rtc_rtsp]
title="go2rtc RTSP (TCP)"
desc="go2rtc RTSP"
port_forward="yes"
dst.ports="8554/tcp"

[go2rtc_webrtc]
title="go2rtc WebRTC (TCP,UDP)"
desc="go2rtc WebRTC"
port_forward="yes"
dst.ports="8555"

[go2rtc_srtp]
title="go2rtc SRTP (UDP)"
desc="go2rtc SRTP"
port_forward="yes"
dst.ports="18443/udp"
18 changes: 18 additions & 0 deletions spk/go2rtc/src/go2rtc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
api:
listen: ":1984"
username: @@root_user@@
password: @@root_password@@

log:
format: "text"
level: "info"

rtsp:
listen: ":8554"

srtp:
# force use of ipv4
listen: "0.0.0.0:18443"

webrtc:
listen: ":8555"
15 changes: 15 additions & 0 deletions spk/go2rtc/src/service-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

CFG_FILE="${SYNOPKG_PKGVAR}/go2rtc.yaml"
SERVICE_COMMAND="${SYNOPKG_PKGDEST}/bin/go2rtc -config ${CFG_FILE}"
SVC_BACKGROUND=y
SVC_WRITE_PID=y


service_postinst ()
{
if [ "${SYNOPKG_PKG_STATUS}" == "INSTALL" ]; then
sed -e "s|@@root_user@@|${wizard_root_user}|g" \
-e "s|@@root_password@@|${wizard_root_password}|g" \
-i ${CFG_FILE}
fi
}
43 changes: 43 additions & 0 deletions spk/go2rtc/src/wizard/install_uifile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[
{
"step_title": "go2rtc configuration",
"items": [
{
"type": "textfield",
"subitems": [
{
"key": "wizard_root_user",
"desc": "go2rtc root user",
"defaultValue": "",
"validator": {
"allowBlank": false,
"minLength": 3,
"regex": {
"expr": "/^[^<>:*/?\"|]*$/",
"errorText": "Not allowed character in username"
}
}
}
]
},
{
"type": "password",
"subitems": [
{
"key": "wizard_root_password",
"desc": "go2rtc root password",
"defaultValue": "",
"validator": {
"allowBlank": false,
"minLength": 8,
"regex": {
"expr": "/^[^\"|]*$/",
"errorText": "Not allowed character in password"
}
}
}
]
}
]
}
]

0 comments on commit 71d20d0

Please sign in to comment.