Documentation
¶
Index ¶
- func CreateHTTPClient(CAFile string) (*http.Client, error)
- func GetJSON(url string, obj interface{}, client *http.Client) (*http.Response, error)
- func GetTLSConfig(CAFile string) (*tls.Config, error)
- func InitLogger(verbose, debug, withSystemd bool)
- func PostJSON(url string, obj interface{}, client *http.Client) (*http.Response, error)
- type ClientCmd
- type CmdVerb
- type MirrorStatus
- type SyncStatus
- type WorkerCmd
- type WorkerStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateHTTPClient ¶
CreateHTTPClient returns a http.Client
func GetTLSConfig ¶
GetTLSConfig generate tls.Config from CAFile
func InitLogger ¶
func InitLogger(verbose, debug, withSystemd bool)
InitLogger initilizes logging format and level
Types ¶
type ClientCmd ¶
type ClientCmd struct {
Cmd CmdVerb `json:"cmd"`
MirrorID string `json:"mirror_id"`
WorkerID string `json:"worker_id"`
Args []string `json:"args"`
}
A ClientCmd is the command message send from client to the manager
type CmdVerb ¶
type CmdVerb uint8
A CmdVerb is an action to a job or worker
const ( // CmdStart start a job CmdStart CmdVerb = iota // CmdStop stop syncing, but keep the job CmdStop // CmdDisable disable the job (stops goroutine) CmdDisable // CmdRestart restart a syncing job CmdRestart // CmdPing ensures the goroutine is alive CmdPing // CmdReload tells a worker to reload mirror config CmdReload )
type MirrorStatus ¶
type MirrorStatus struct {
Name string `json:"name"`
Worker string `json:"worker"`
IsMaster bool `json:"is_master"`
Status SyncStatus `json:"status"`
LastUpdate time.Time `json:"last_update"`
Upstream string `json:"upstream"`
Size string `json:"size"`
ErrorMsg string `json:"error_msg"`
}
A StatusUpdateMsg represents a msg when a worker has done syncing
type SyncStatus ¶
type SyncStatus uint8
const ( None SyncStatus = iota Failed Success Syncing PreSyncing Paused Disabled )
func (SyncStatus) MarshalJSON ¶
func (s SyncStatus) MarshalJSON() ([]byte, error)
func (SyncStatus) String ¶
func (s SyncStatus) String() string
func (*SyncStatus) UnmarshalJSON ¶
func (s *SyncStatus) UnmarshalJSON(v []byte) error
type WorkerCmd ¶
type WorkerCmd struct {
Cmd CmdVerb `json:"cmd"`
MirrorID string `json:"mirror_id"`
Args []string `json:"args"`
}
A WorkerCmd is the command message send from the manager to a worker
type WorkerStatus ¶
type WorkerStatus struct {
ID string `json:"id"`
URL string `json:"url"` // worker url
Token string `json:"token"` // session token
LastOnline time.Time `json:"last_online"` // last seen
}
A WorkerStatus is the information struct that describe a worker, and sent from the manager to clients.
Click to show internal directories.
Click to hide internal directories.