-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handshake fails for certain RTMP clients #12
Labels
bug
Something isn't working
Comments
Seems owncast had the same issue: owncast/owncast#34 |
Need to look into if they maintain a fork of the RTMP library we should be using instead! |
clone1018
changed the title
Cannot use with Restream.io
Handshake fails for certain RTMP clients
May 19, 2022
Here's some quick code to do a basic RTMP handshake (and send an invalid one for testing): package main
import (
"bufio"
"crypto/rand"
"fmt"
"io"
"net"
)
func main() {
token := make([]byte, 1536)
rand.Read(token)
wrongResponse := make([]byte, 1536)
rand.Read(wrongResponse)
conn, err := net.Dial("tcp", "localhost:1935")
if err != nil {
panic(err)
}
reader := bufio.NewReader(conn)
// Write 0x03 and token
conn.Write([]byte{0x03})
conn.Write(token)
// Check status response
status := make([]byte, 1)
_, err = reader.Read(status)
if err != nil {
panic(err)
}
fmt.Printf("First Res: %#v\n", status)
// Generate handshake
handshake := make([]byte, 1536)
_, err = io.ReadFull(conn, handshake)
if err != nil {
panic(err)
}
conn.Write(handshake)
// Uncomment this if you want the handshake to fail
// conn.Write(wrongResponse)
_, err = reader.Read(status)
if err != nil {
panic(err)
}
fmt.Printf("Second Res: %#v\n", status)
} |
That fixed it it seems, there were two issues:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems for some reason the handshake does not shake successfully with restream, so connecting does not work.
The primary example of this is restream.io
The text was updated successfully, but these errors were encountered: