Documentation
¶
Overview ¶
Package daemon provides daemon lifecycle management for omniproxyd.
Index ¶
- Variables
- func IsRunning(pidFile string) (bool, int, error)
- func StartBackground(args []string) error
- func StopByPID(pidFile string) error
- type Client
- type Config
- type Daemon
- func (d *Daemon) IncrementRequests()
- func (d *Daemon) SetCallbacks(onStart, onStop, onReload func() error)
- func (d *Daemon) SetTrafficQuerier(tq backend.TrafficQuerier)
- func (d *Daemon) Start(ctx context.Context) error
- func (d *Daemon) Status() *Status
- func (d *Daemon) Stop(ctx context.Context) error
- func (d *Daemon) Wait()
- type Status
- type TrafficResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultDir = filepath.Join(os.Getenv("HOME"), ".omniproxy") DefaultPIDFile = filepath.Join(DefaultDir, "omniproxyd.pid") DefaultSocketPath = filepath.Join(DefaultDir, "omniproxyd.sock") DefaultLogFile = filepath.Join(DefaultDir, "omniproxyd.log") )
Default paths for daemon files.
Functions ¶
func StartBackground ¶
StartBackground starts the daemon in the background.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides methods to communicate with the daemon.
type Config ¶
type Config struct {
PIDFile string
SocketPath string
LogFile string
ProxyPort int
Host string
Database string
Version string
}
Config holds daemon configuration.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns default daemon configuration.
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon manages the proxy daemon lifecycle.
func (*Daemon) IncrementRequests ¶
func (d *Daemon) IncrementRequests()
IncrementRequests increments the request counter.
func (*Daemon) SetCallbacks ¶
SetCallbacks sets the daemon lifecycle callbacks.
func (*Daemon) SetTrafficQuerier ¶
func (d *Daemon) SetTrafficQuerier(tq backend.TrafficQuerier)
SetTrafficQuerier sets the traffic querier for the /traffic endpoint.
type Status ¶
type Status struct {
Running bool `json:"running"`
PID int `json:"pid,omitempty"`
StartTime time.Time `json:"start_time,omitempty"`
Uptime string `json:"uptime,omitempty"`
ProxyPort int `json:"proxy_port,omitempty"`
MetricsPort int `json:"metrics_port,omitempty"`
Version string `json:"version,omitempty"`
Database string `json:"database,omitempty"`
Requests int64 `json:"requests,omitempty"`
}
Status represents the daemon status.
type TrafficResponse ¶
type TrafficResponse struct {
Records []*backend.TrafficRecord `json:"records"`
Total int64 `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
TrafficResponse is the response format for the /traffic endpoint.
Click to show internal directories.
Click to hide internal directories.