mirror of
https://github.com/datarhei/core.git
synced 2025-09-26 20:11:29 +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_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_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_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. |
|
||||
@@ -262,7 +264,11 @@ All other values will be filled with default values and persisted on disk. The e
|
||||
"enable": false,
|
||||
"address": ":6000",
|
||||
"passphrase": "",
|
||||
"token": ""
|
||||
"token": "",
|
||||
"log": {
|
||||
"enable": false,
|
||||
"topics": [],
|
||||
}
|
||||
},
|
||||
"ffmpeg": {
|
||||
"binary": "ffmpeg",
|
||||
|
@@ -696,12 +696,15 @@ func (a *api) start() error {
|
||||
|
||||
if cfg.SRT.Enable {
|
||||
config := srt.Config{
|
||||
Addr: cfg.SRT.Address,
|
||||
Passphrase: cfg.SRT.Passphrase,
|
||||
Token: cfg.SRT.Token,
|
||||
Logger: a.log.logger.core.WithComponent("SRT").WithField("address", cfg.SRT.Address),
|
||||
Collector: a.sessions.Collector("srt"),
|
||||
SRTLogTopics: []string{"listen", "handshake", "connection"},
|
||||
Addr: cfg.SRT.Address,
|
||||
Passphrase: cfg.SRT.Passphrase,
|
||||
Token: cfg.SRT.Token,
|
||||
Logger: a.log.logger.core.WithComponent("SRT").WithField("address", cfg.SRT.Address),
|
||||
Collector: a.sessions.Collector("srt"),
|
||||
}
|
||||
|
||||
if cfg.SRT.Log.Enable {
|
||||
config.SRTLogTopics = cfg.SRT.Log.Topics
|
||||
}
|
||||
|
||||
srtserver, err := srt.New(config)
|
||||
|
@@ -140,6 +140,10 @@ type Data struct {
|
||||
Address string `json:"address"`
|
||||
Passphrase string `json:"passphrase"`
|
||||
Token string `json:"token"`
|
||||
Log struct {
|
||||
Enable bool `json:"enable"`
|
||||
Topics []string `json:"topics"`
|
||||
} `json:"log"`
|
||||
} `json:"srt"`
|
||||
FFmpeg struct {
|
||||
Binary string `json:"binary"`
|
||||
@@ -262,6 +266,8 @@ func NewConfigFrom(d *Config) *Config {
|
||||
|
||||
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.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(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(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
|
||||
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": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"log": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"topics": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"passphrase": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -3504,7 +3518,7 @@ const docTemplate = `{
|
||||
"additionalProperties": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/api.SRTLog"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -3533,7 +3547,7 @@ const docTemplate = `{
|
||||
"additionalProperties": {
|
||||
"type": "array",
|
||||
"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": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -4241,6 +4269,20 @@ const docTemplate = `{
|
||||
"enable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"log": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"topics": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"passphrase": {
|
||||
"type": "string"
|
||||
},
|
||||
|
@@ -2667,6 +2667,20 @@
|
||||
"enable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"log": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"topics": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"passphrase": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -3496,7 +3510,7 @@
|
||||
"additionalProperties": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/api.SRTLog"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -3525,7 +3539,7 @@
|
||||
"additionalProperties": {
|
||||
"type": "array",
|
||||
"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": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -4233,6 +4261,20 @@
|
||||
"enable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"log": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"topics": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"passphrase": {
|
||||
"type": "string"
|
||||
},
|
||||
|
@@ -307,6 +307,15 @@ definitions:
|
||||
type: string
|
||||
enable:
|
||||
type: boolean
|
||||
log:
|
||||
properties:
|
||||
enable:
|
||||
type: boolean
|
||||
topics:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
passphrase:
|
||||
type: string
|
||||
token:
|
||||
@@ -854,7 +863,7 @@ definitions:
|
||||
log:
|
||||
additionalProperties:
|
||||
items:
|
||||
type: string
|
||||
$ref: '#/definitions/api.SRTLog'
|
||||
type: array
|
||||
type: object
|
||||
publisher:
|
||||
@@ -873,12 +882,21 @@ definitions:
|
||||
log:
|
||||
additionalProperties:
|
||||
items:
|
||||
type: string
|
||||
$ref: '#/definitions/api.SRTLog'
|
||||
type: array
|
||||
type: object
|
||||
stats:
|
||||
$ref: '#/definitions/api.SRTStatistics'
|
||||
type: object
|
||||
api.SRTLog:
|
||||
properties:
|
||||
msg:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
ts:
|
||||
type: integer
|
||||
type: object
|
||||
api.SRTStatistics:
|
||||
properties:
|
||||
avail_recv_buf_bytes:
|
||||
@@ -1392,6 +1410,15 @@ definitions:
|
||||
type: string
|
||||
enable:
|
||||
type: boolean
|
||||
log:
|
||||
properties:
|
||||
enable:
|
||||
type: boolean
|
||||
topics:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
passphrase:
|
||||
type: string
|
||||
token:
|
||||
|
Reference in New Issue
Block a user