Documentation
¶
Overview ¶
Package service runs the proxy in the background: start spawns a detached copy of this binary, records its PID and address, and waits for it to bind; stop and status find it again through that record.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectHost ¶
ConnectHost turns a bind address into one a client can dial.
func Dir ¶
Dir is where the record and the background log live: COMFY_API_PROXY_STATE_DIR (the reference's override), else $XDG_STATE_HOME/comfy-api-proxy, else ~/.local/state/comfy-api-proxy.
Types ¶
type AlreadyRunningError ¶
type AlreadyRunningError struct{ Rec Record }
AlreadyRunningError means start found a live proxy of ours.
func (*AlreadyRunningError) Error ¶
func (e *AlreadyRunningError) Error() string
type PortBusyError ¶
type PortBusyError struct{ URL string }
PortBusyError means start found the port held by something else.
func (*PortBusyError) Error ¶
func (e *PortBusyError) Error() string
type Record ¶
type Record struct {
PID int `json:"pid"`
// Exe is the binary start launched. A PID counts as ours only while it
// still runs that binary, so a recycled PID is never signalled.
Exe string `json:"exe,omitempty"`
Host string `json:"host"`
Port int `json:"port"`
URL string `json:"url"`
}
Record is what start leaves behind in proxy.json.
func Read ¶
Read returns the saved record. A missing, corrupt, or oddly shaped record reads as nil: status and stop treat it as "not running" instead of failing.