/srtgo

Go bindings for SRT. Advantages of SRT technology for an easy to use programming language

Primary LanguageGoMozilla Public License 2.0MPL-2.0

GoDoc

srtgo

Go bindings for SRT (Secure Reliable Transport), the open source transport technology that optimizes streaming performance across unpredictable networks.

Why srtgo?

To make easier the adoption of SRT transport technology. Using Go, with just a few lines of code you can implement an application that sends/receives data, with all the benefits of SRT technology: security and reliability, while keeping latency low.

Is this a new implementation of SRT?

No! We are just exposing the great work done by the community with [SRT project]((https://github.com/Haivision/srt) as a golang library. All the functionality and implementation still resides on SRT official project.

Features supported

  • Basic API exposed to easy develop SRT sender/receiver apps
  • Caller and Listener mode
  • Live transport type
  • File transport type
  • Message/Buffer API
  • SRT transport options up to SRT 1.4.1
  • SRT Stats retrieval

Usage

Example of a SRT receiver application:

package main

import (
    "github.com/haivision/srtgo"
    "fmt"
)

func main() int {
    options := make(map[string]string)
    options["transtype"] = "file"

	sck := srtgo.NewSrtSocket("0.0.0.0", 8090, options)
	sck.Listen(1)
    s, _ := sck.Accept()

    buff := make([]byte, 2048)
    for {
        n, _ := s.Read(buff, 10000)
        if n == 0 {
            break
        }
        fmt.Println("Received %d bytes", n)
    }
    //....
}

Dependencies

  • srtlib

You can find detailed instructions about how to install srtlib in its README file

gosrt has been developed with srt 1.4.1 as its main target and has been successfully tested in srt 1.3.4 and above.