1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-27 19:12:07 +02:00

Use : as more conventional separator for user:password

This commit is contained in:
Yohann D'ANELLO
2020-10-02 22:39:38 +02:00
parent 596beeeb89
commit 087d6eee3b
4 changed files with 9 additions and 7 deletions

View File

@ -63,7 +63,7 @@ func TestForwardStream(t *testing.T) {
ffmpeg := exec.Command("ffmpeg",
"-re", "-f", "lavfi", "-i", "testsrc=size=640x480:rate=10",
"-f", "flv", "srt://127.0.0.1:9712?streamid=demo|")
"-f", "flv", "srt://127.0.0.1:9712?streamid=demo:")
output, err := ffmpeg.StdoutPipe()
errOutput, err := ffmpeg.StderrPipe()

View File

@ -59,6 +59,7 @@ func Serve(cfg *Options, backend auth.Backend, forwarding chan Packet) {
options := make(map[string]string)
options["transtype"] = "live"
options["mode"] = "listener"
// Start SRT in listen mode
log.Printf("SRT server listening on %s", cfg.ListenAddress)
@ -135,11 +136,12 @@ func authenticateSocket(s *srtgo.SrtSocket) (string, error) {
if err != nil {
return "", fmt.Errorf("error while fetching stream key: %s", err)
}
if !strings.Contains(streamID, "|") {
return streamID, fmt.Errorf("warning: stream id must be at the format streamID|password. Input: %s", streamID)
log.Println(s.GetSockOptString(C.SRTO_PASSPHRASE))
if !strings.Contains(streamID, ":") {
return streamID, fmt.Errorf("warning: stream id must be at the format streamID:password. Input: %s", streamID)
}
splittedStreamID := strings.SplitN(streamID, "|", 2)
splittedStreamID := strings.SplitN(streamID, ":", 2)
streamName, password := splittedStreamID[0], splittedStreamID[1]
loggedIn, err := authBackend.Login(streamName, password)
if !loggedIn {

View File

@ -40,7 +40,7 @@ func TestServeSRT(t *testing.T) {
ffmpeg := exec.Command("ffmpeg",
"-i", "http://ftp.crans.org/events/Blender%20OpenMovies/big_buck_bunny_480p_stereo.ogg",
"-f", "flv", "srt://127.0.0.1:9711?streamid=demo|")
"-f", "flv", "srt://127.0.0.1:9711?streamid=demo:")
output, err := ffmpeg.StdoutPipe()
errOutput, err := ffmpeg.StderrPipe()