Documentation
¶
Index ¶
Constants ¶
const ( GoXLRSocket = "/tmp/goxlr.socket" GetStatusCommand = `"GetStatus"` )
Variables ¶
This section is empty.
Functions ¶
func DialSocket ¶
DialSocket dials the GoXLR socket.
func MustGetAddress ¶
MustGetAddress returns the address the HTTP API is bound on.
This function will panic if any error occurs, or if the HTTP API is not enabled.
func PackRequest ¶
func PackRequest(msg json.RawMessage) ([]byte, error)
PackRequest will take any string payload and encoded it in the format the daemon expects.
The msg should be valid JSON and be one of the supported commands.
func UnpackResponse ¶
func UnpackResponse(r io.Reader) (json.RawMessage, error)
UnpackResponse will read a response from the Reader.
Beware that this can hang indefinitely if you pass a net.Conn and the command you sent is unknown to the daemon. It won't respond with an error message, it simply doesn't respond at all. Make sure to manage the net.Conn.ReadDeadline so that a read will eventually time out.
Types ¶
type DaemonStatus ¶
type DaemonStatus struct {
Status struct {
Config struct {
HTTPSettings struct {
Enabled bool `json:"enabled"`
BindAddress string `json:"bind_address"`
Port int `json:"port"`
} `json:"http_settings"`
} `json:"config"`
} `json:"Status"`
}
DaemonStatus is a partial struct representing the data returned by the GetStatus command.
It only represents the part of the response necessary to construct the HTTP API address.
func (DaemonStatus) GetAddress ¶
func (d DaemonStatus) GetAddress() (string, bool)
GetAddress returns a host:port for the HTTP API.
If the HTTP API is not enabled, the second return value will be false.