mirror of
https://github.com/datarhei/core.git
synced 2025-09-27 12:22:28 +08:00
Allow to configure SRT logging
This commit is contained in:
@@ -133,6 +133,8 @@ The currently known environment variables (but not all will be respected) are:
|
|||||||
| CORE_SRT_ADDRESS | `:6000` | SRT server listen address. |
|
| CORE_SRT_ADDRESS | `:6000` | SRT server listen address. |
|
||||||
| CORE_SRT_PASSPHRASE | (not set) | SRT passphrase. |
|
| CORE_SRT_PASSPHRASE | (not set) | SRT passphrase. |
|
||||||
| CORE_SRT_TOKEN | (not set) | SRT token for publishing and playing. The token is the value of the URL query parameter `token`. |
|
| CORE_SRT_TOKEN | (not set) | SRT token for publishing and playing. The token is the value of the URL query parameter `token`. |
|
||||||
|
| CORE_SRT_LOG_ENABLE | `false` | Enable SRT server logging. |
|
||||||
|
| CORE_SRT_LOG_TOPICS | (not set) | List topics to log from SRT server. See https://github.com/datarhei/gosrt#logging. |
|
||||||
| CORE_FFMPEG_BINARY | `ffmpeg` | Path to FFmpeg binary. |
|
| CORE_FFMPEG_BINARY | `ffmpeg` | Path to FFmpeg binary. |
|
||||||
| CORE_FFMPEG_MAXPROCESSES | `0` | Max. allowed simultaneously running FFmpeg instances. Any value <= 0 means unlimited. |
|
| CORE_FFMPEG_MAXPROCESSES | `0` | Max. allowed simultaneously running FFmpeg instances. Any value <= 0 means unlimited. |
|
||||||
| CORE_FFMPEG_ACCESS_INPUT_ALLOW | (not set) | List of pattern for allowed input URI (space-separated), leave emtpy to allow any. |
|
| CORE_FFMPEG_ACCESS_INPUT_ALLOW | (not set) | List of pattern for allowed input URI (space-separated), leave emtpy to allow any. |
|
||||||
@@ -262,7 +264,11 @@ All other values will be filled with default values and persisted on disk. The e
|
|||||||
"enable": false,
|
"enable": false,
|
||||||
"address": ":6000",
|
"address": ":6000",
|
||||||
"passphrase": "",
|
"passphrase": "",
|
||||||
"token": ""
|
"token": "",
|
||||||
|
"log": {
|
||||||
|
"enable": false,
|
||||||
|
"topics": [],
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ffmpeg": {
|
"ffmpeg": {
|
||||||
"binary": "ffmpeg",
|
"binary": "ffmpeg",
|
||||||
|
@@ -696,12 +696,15 @@ func (a *api) start() error {
|
|||||||
|
|
||||||
if cfg.SRT.Enable {
|
if cfg.SRT.Enable {
|
||||||
config := srt.Config{
|
config := srt.Config{
|
||||||
Addr: cfg.SRT.Address,
|
Addr: cfg.SRT.Address,
|
||||||
Passphrase: cfg.SRT.Passphrase,
|
Passphrase: cfg.SRT.Passphrase,
|
||||||
Token: cfg.SRT.Token,
|
Token: cfg.SRT.Token,
|
||||||
Logger: a.log.logger.core.WithComponent("SRT").WithField("address", cfg.SRT.Address),
|
Logger: a.log.logger.core.WithComponent("SRT").WithField("address", cfg.SRT.Address),
|
||||||
Collector: a.sessions.Collector("srt"),
|
Collector: a.sessions.Collector("srt"),
|
||||||
SRTLogTopics: []string{"listen", "handshake", "connection"},
|
}
|
||||||
|
|
||||||
|
if cfg.SRT.Log.Enable {
|
||||||
|
config.SRTLogTopics = cfg.SRT.Log.Topics
|
||||||
}
|
}
|
||||||
|
|
||||||
srtserver, err := srt.New(config)
|
srtserver, err := srt.New(config)
|
||||||
|
@@ -140,6 +140,10 @@ type Data struct {
|
|||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
Passphrase string `json:"passphrase"`
|
Passphrase string `json:"passphrase"`
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
|
Log struct {
|
||||||
|
Enable bool `json:"enable"`
|
||||||
|
Topics []string `json:"topics"`
|
||||||
|
} `json:"log"`
|
||||||
} `json:"srt"`
|
} `json:"srt"`
|
||||||
FFmpeg struct {
|
FFmpeg struct {
|
||||||
Binary string `json:"binary"`
|
Binary string `json:"binary"`
|
||||||
@@ -262,6 +266,8 @@ func NewConfigFrom(d *Config) *Config {
|
|||||||
|
|
||||||
data.Sessions.IPIgnoreList = copyStringSlice(d.Sessions.IPIgnoreList)
|
data.Sessions.IPIgnoreList = copyStringSlice(d.Sessions.IPIgnoreList)
|
||||||
|
|
||||||
|
data.SRT.Log.Topics = copyStringSlice(d.SRT.Log.Topics)
|
||||||
|
|
||||||
data.Router.BlockedPrefixes = copyStringSlice(d.Router.BlockedPrefixes)
|
data.Router.BlockedPrefixes = copyStringSlice(d.Router.BlockedPrefixes)
|
||||||
data.Router.Routes = copyStringMap(d.Router.Routes)
|
data.Router.Routes = copyStringMap(d.Router.Routes)
|
||||||
|
|
||||||
@@ -351,6 +357,8 @@ func (d *Config) init() {
|
|||||||
d.val(newAddressValue(&d.SRT.Address, ":6000"), "srt.address", "CORE_SRT_ADDRESS", nil, "SRT server listen address", false, false)
|
d.val(newAddressValue(&d.SRT.Address, ":6000"), "srt.address", "CORE_SRT_ADDRESS", nil, "SRT server listen address", false, false)
|
||||||
d.val(newStringValue(&d.SRT.Passphrase, ""), "srt.passphrase", "CORE_SRT_PASSPHRASE", nil, "SRT encryption passphrase", false, true)
|
d.val(newStringValue(&d.SRT.Passphrase, ""), "srt.passphrase", "CORE_SRT_PASSPHRASE", nil, "SRT encryption passphrase", false, true)
|
||||||
d.val(newStringValue(&d.SRT.Token, ""), "srt.token", "CORE_SRT_TOKEN", nil, "SRT token for publishing and playing", false, true)
|
d.val(newStringValue(&d.SRT.Token, ""), "srt.token", "CORE_SRT_TOKEN", nil, "SRT token for publishing and playing", false, true)
|
||||||
|
d.val(newBoolValue(&d.SRT.Log.Enable, false), "srt.log.enable", "CORE_SRT_LOG_ENABLE", nil, "Enable SRT server logging", false, false)
|
||||||
|
d.val(newStringListValue(&d.SRT.Log.Topics, []string{}, ","), "srt.log.topics", "CORE_SRT_LOG_TOPICS", nil, "List of topics to log", false, false)
|
||||||
|
|
||||||
// FFmpeg
|
// FFmpeg
|
||||||
d.val(newExecValue(&d.FFmpeg.Binary, "ffmpeg"), "ffmpeg.binary", "CORE_FFMPEG_BINARY", nil, "Path to ffmpeg binary", true, false)
|
d.val(newExecValue(&d.FFmpeg.Binary, "ffmpeg"), "ffmpeg.binary", "CORE_FFMPEG_BINARY", nil, "Path to ffmpeg binary", true, false)
|
||||||
|
46
docs/docs.go
46
docs/docs.go
@@ -2675,6 +2675,20 @@ const docTemplate = `{
|
|||||||
"enable": {
|
"enable": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"log": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"enable": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"topics": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"passphrase": {
|
"passphrase": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -3504,7 +3518,7 @@ const docTemplate = `{
|
|||||||
"additionalProperties": {
|
"additionalProperties": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"$ref": "#/definitions/api.SRTLog"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -3533,7 +3547,7 @@ const docTemplate = `{
|
|||||||
"additionalProperties": {
|
"additionalProperties": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"$ref": "#/definitions/api.SRTLog"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -3542,6 +3556,20 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"api.SRTLog": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"msg": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ts": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"api.SRTStatistics": {
|
"api.SRTStatistics": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -4241,6 +4269,20 @@ const docTemplate = `{
|
|||||||
"enable": {
|
"enable": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"log": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"enable": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"topics": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"passphrase": {
|
"passphrase": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
@@ -2667,6 +2667,20 @@
|
|||||||
"enable": {
|
"enable": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"log": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"enable": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"topics": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"passphrase": {
|
"passphrase": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -3496,7 +3510,7 @@
|
|||||||
"additionalProperties": {
|
"additionalProperties": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"$ref": "#/definitions/api.SRTLog"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -3525,7 +3539,7 @@
|
|||||||
"additionalProperties": {
|
"additionalProperties": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"$ref": "#/definitions/api.SRTLog"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -3534,6 +3548,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"api.SRTLog": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"msg": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ts": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"api.SRTStatistics": {
|
"api.SRTStatistics": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -4233,6 +4261,20 @@
|
|||||||
"enable": {
|
"enable": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"log": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"enable": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"topics": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"passphrase": {
|
"passphrase": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
@@ -307,6 +307,15 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
enable:
|
enable:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
log:
|
||||||
|
properties:
|
||||||
|
enable:
|
||||||
|
type: boolean
|
||||||
|
topics:
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
passphrase:
|
passphrase:
|
||||||
type: string
|
type: string
|
||||||
token:
|
token:
|
||||||
@@ -854,7 +863,7 @@ definitions:
|
|||||||
log:
|
log:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
items:
|
items:
|
||||||
type: string
|
$ref: '#/definitions/api.SRTLog'
|
||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
publisher:
|
publisher:
|
||||||
@@ -873,12 +882,21 @@ definitions:
|
|||||||
log:
|
log:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
items:
|
items:
|
||||||
type: string
|
$ref: '#/definitions/api.SRTLog'
|
||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
stats:
|
stats:
|
||||||
$ref: '#/definitions/api.SRTStatistics'
|
$ref: '#/definitions/api.SRTStatistics'
|
||||||
type: object
|
type: object
|
||||||
|
api.SRTLog:
|
||||||
|
properties:
|
||||||
|
msg:
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
|
ts:
|
||||||
|
type: integer
|
||||||
|
type: object
|
||||||
api.SRTStatistics:
|
api.SRTStatistics:
|
||||||
properties:
|
properties:
|
||||||
avail_recv_buf_bytes:
|
avail_recv_buf_bytes:
|
||||||
@@ -1392,6 +1410,15 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
enable:
|
enable:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
log:
|
||||||
|
properties:
|
||||||
|
enable:
|
||||||
|
type: boolean
|
||||||
|
topics:
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
passphrase:
|
passphrase:
|
||||||
type: string
|
type: string
|
||||||
token:
|
token:
|
||||||
|
Reference in New Issue
Block a user