opts.bend checks
raw source on the hub · import 0xfbc4773809086afacef84e7fba6d620c/opts.bend as Opts
What a program says to a session and what a session says back when it fails: the options, and errors with a reason. Pure: the laws hold them.
1 import
import Base
Types
type Opts source · line 12 · raw
Data
url: the stream's address. user, pass: the login, when it is not in the URL. wait: how long, in ms, the server may stay silent. audio: whether to ask for the audio too. ca: a PEM file to check a TLS server's certificate against, "" for the system's store.
Opts@url:String -> @user:String -> @pass:String -> @wait:U32 -> @audio:Bool -> @ca:String -> Opts
type Why source · line 60 · raw
Data
Why something failed, for a program to act on: try again later (NoRoute, Silent, Hangup), ask for another password (NoLogin), give up (NoStream, Unsafe, Refused, Garbled, BadUrl). Ended is no failure: the stream came to its end. Moved is what a redirect is inside the client, its words the new address; open follows it, so a program sees it only after too many in a row.
NoRouteWhy
UnsafeWhy
NoLoginWhy
NoStreamWhy
SilentWhy
HangupWhy
RefusedWhy
GarbledWhy
BadUrlWhy
EndedWhy
MovedWhy
type Err source · line 75 · raw
Data
An error: why, the system's or the server's code (0 for none), and words for a person.
Err@why:Why -> @code:U32 -> @msg:String -> Err
Definitions
def Opts.new source · line 15 · raw
@url:String -> Opts
def Opts.login source · line 18 · raw
@o:Opts -> @user:String -> @pass:String -> Opts
def Opts.wait source · line 22 · raw
@o:Opts -> @ms:U32 -> Opts
def Opts.audio source · line 26 · raw
@o:Opts -> @yes:Bool -> Opts
def Opts.ca source · line 30 · raw
@o:Opts -> @path:String -> Opts
def Opts.to source · line 35 · raw
@o:Opts -> @url:String -> Opts
The same options for another address.
def Opts.wait.of source · line 39 · raw
@o:Opts -> U32
def Opts.url source · line 43 · raw
@o:Opts -> String
def Opts.ca.of source · line 47 · raw
@o:Opts -> String
def Why.name source · line 78 · raw
@w:Why -> String
def Why.ended source · line 103 · raw
@w:Why -> Bool
def Why.again source · line 112 · raw
@w:Why -> Bool
Whether opening again may work: the network or the server faltered (NoRoute, Silent, Hangup), as against an answer that will not change.
def Why.lasting source · line 126 · raw
@w:Why -> Bool
Whether no amount of waiting will help: the login, the certificate or the URL is wrong. Anything else may pass once a stream that was flowing comes back (a server that restarts has no stream for a while).
def Err.lasting source · line 137 · raw
@e:Err -> Bool
def Err.moved source · line 141 · raw
@e:Err -> Bool
def Err.again source · line 149 · raw
@e:Err -> Bool
def Err.show source · line 154 · raw
@e:Err -> String
An error in a line: "login refused (401): wrong user or password".