Documentation
¶
Index ¶
- Constants
- Variables
- func Banner() string
- func Exists(path string) bool
- func GetenvInt(key string) int
- func IsUser(i int) (bool, error)
- func KillActiveStream(x *ActiveStream) error
- func LocalhostServerGetParameters(d *CallbackText) (chan []byte, chan error)
- func Open(args []string) error
- func OpenInBrowserDefault(url string) error
- func PrintBanner()
- func S(s string) *string
- func SPointer(s string) *string
- func SharedValues(w http.ResponseWriter, r *http.Request)
- func SharedValuesDynamic(d *CallbackText) func(w http.ResponseWriter, r *http.Request)
- func StopActiveStream(x *ActiveStream) error
- func StrInt0(n string) int
- type ActiveStream
- type ActiveStreamerServer
- func (a *ActiveStreamerServer) ProxyRTMP(ctx context.Context, r *activestreamer.RTMPHost) (*activestreamer.Ack, error)
- func (a *ActiveStreamerServer) StartRTMP(ctx context.Context, r *activestreamer.RTMPHost) (*activestreamer.Ack, error)
- func (a *ActiveStreamerServer) StopRTMP(context.Context, *activestreamer.Null) (*activestreamer.Ack, error)
- func (a *ActiveStreamerServer) Transact(context.Context, *activestreamer.ClientConfig) (*activestreamer.Ack, error)
- type CallbackText
- type ExecResult
- type InteractiveTwitchClient
- type OBSClient
- type Stream
- type Streamer
- type TwitchCallbackParameters
- type YouTubeClient
Constants ¶
const ( ActiveStreamPID string = "/var/run/twinx.pid" ActiveStreamLog string = "/var/log/twinx.log" )
const ( ActiveStreamPIDWriteMode os.FileMode = 0600 ActiveStreamSocket = "/var/run/twinx.sock" ActiveStreamRTMPHost = "localhost" )
const ( ENVAR_OBSPort = "TWINX_OBS_PORT" ENVAR_OBSPassword = "TWINX_OBS_PASSWORD" ENVAR_OBSHost = "TWINX_OBS_HOST" )
const ( TWINX_PUBLIC_ID string = "ykiaywwbve0aa3vm15cruou06dpuct" TWINX_PUBLIC_CALLBACK_URL string = "http://localhost:1717" )
const ( // OpenCommand is linux specific OpenCommand = "xdg-open" // LocalhostListenPort will listen onport 1717 for requests LocalhostListenPort = "1717" )
const ( NivenlyDefaultPageHeader string = "Access-Control-Allow-Origin: *" // NivenlyDefaultPageTemplate // 4 string substitutions // 1. Title // 2. Main text // 3. Sub 1 // 4. Sub 2 NivenlyDefaultPageTemplate string = `` /* 12715-byte string literal not displayed */ )
const (
ENVAR_YouTubeAPIKey = "TWINX_YOUTUBE_API_KEY"
)
Variables ¶
var Browsers = []string{"/usr/bin/brave", "/usr/bin/firefox", "/usr/bin/google-chrome-stable"}
Browsers are default browser executables (in order) to try and use on Linux. taken from my personal Archlinux setup.
Please feel free to add these, but do not change the order as they are important to me!
var CompileFlagPrintBanner bool = true
CompileFlagPrintBanner will enable/disable the banner for the program.
var CompileTimeVersion string
CompileTimeVersion is set at compile time in the associated Makefile Do not change this!
var TwitchPermissions = []string{
"user:read:email",
}
TwitchPermissions is what we ask for in oAuth
These are very invasive, so please deny all! If you are unsure, do NOT add a permission!
Functions ¶
func KillActiveStream ¶
func KillActiveStream(x *ActiveStream) error
KillActiveStream will force kill an active stream.
func LocalhostServerGetParameters ¶
func LocalhostServerGetParameters(d *CallbackText) (chan []byte, chan error)
LocalhostServerGetParameters will run an HTTP server on localhost and listen for parameters passed back over the GET request to populate the parameters into JSON returned over the []byte channel
func OpenInBrowserDefault ¶
OpenInBrowserDefault will try to open a URL in one of the default browsers
func PrintBanner ¶
func PrintBanner()
func SharedValues ¶
func SharedValues(w http.ResponseWriter, r *http.Request)
SharedValues will plumb shared values back over the queue
func SharedValuesDynamic ¶
func SharedValuesDynamic(d *CallbackText) func(w http.ResponseWriter, r *http.Request)
func StopActiveStream ¶
func StopActiveStream(x *ActiveStream) error
StopActiveStream will stop an active stream.
Types ¶
type ActiveStream ¶
type ActiveStream struct { Title string Description string PID int PID64 int64 Client activestreamer.ActiveStreamerClient }
func GetActiveStream ¶
func GetActiveStream() (*ActiveStream, error)
GetActiveStream will attempt to lookup an active stream running locally.
func NewActiveStream ¶
func NewActiveStream(title, description string) (*ActiveStream, error)
NewActiveStream will create a new active stream as long as one does not exist.
func (*ActiveStream) Assure ¶
func (x *ActiveStream) Assure() error
Assure will run a sanity check against the active stream to assure that it is running, healthy, and that we can talk to it.
func (*ActiveStream) InfoChannel ¶
func (x *ActiveStream) InfoChannel() chan string
InfoChannel will return a channel that can be accessed to gain information about the stream.
type ActiveStreamerServer ¶
type ActiveStreamerServer struct { activestreamer.UnimplementedActiveStreamerServer Local *rtmp.URLAddr Remotes map[string]*rtmp.URLAddr Listener *rtmp.Listener Server *rtmp.Server }
func NewActiveStreamerServer ¶
func NewActiveStreamerServer() *ActiveStreamerServer
func (*ActiveStreamerServer) ProxyRTMP ¶
func (a *ActiveStreamerServer) ProxyRTMP(ctx context.Context, r *activestreamer.RTMPHost) (*activestreamer.Ack, error)
func (*ActiveStreamerServer) StartRTMP ¶
func (a *ActiveStreamerServer) StartRTMP(ctx context.Context, r *activestreamer.RTMPHost) (*activestreamer.Ack, error)
func (*ActiveStreamerServer) StopRTMP ¶
func (a *ActiveStreamerServer) StopRTMP(context.Context, *activestreamer.Null) (*activestreamer.Ack, error)
func (*ActiveStreamerServer) Transact ¶
func (a *ActiveStreamerServer) Transact(context.Context, *activestreamer.ClientConfig) (*activestreamer.Ack, error)
type CallbackText ¶
type ExecResult ¶
ExecResult is the response from executing a command
func ExecCommand ¶
func ExecCommand(cmd string, args []string) (*ExecResult, error)
ExecCommand is a wrapper for exec.Command but with a dedicated result{} struct. This works better for my brain.
type InteractiveTwitchClient ¶
type InteractiveTwitchClient struct { AppID string AppSecret string LoginURL string Client *helix.Client }
func NewInteractiveTwitchClient ¶
func NewInteractiveTwitchClient() *InteractiveTwitchClient
func (*InteractiveTwitchClient) Authenticate ¶
func (c *InteractiveTwitchClient) Authenticate() error
type OBSClient ¶
func NewOBSClient ¶
func NewOBSClient() *OBSClient
func (*OBSClient) Authenticate ¶
type Stream ¶
func (*Stream) ServerGRPC ¶
func (*Stream) SigHandler ¶
func (s *Stream) SigHandler()
type Streamer ¶
type Streamer struct { Title string Description string TwitchClient *InteractiveTwitchClient OBSClient *OBSClient YouTubeClient *YouTubeClient // contains filtered or unexported fields }
func NewStreamer ¶
type YouTubeClient ¶
type YouTubeClient struct {
Client *youtube.Service
}
func NewYouTubeClient ¶
func NewYouTubeClient() *YouTubeClient
func (*YouTubeClient) Authenticate ¶
func (c *YouTubeClient) Authenticate() error