Documentation
¶
Index ¶
- type ApplyAction
- type ApplyItemResult
- type ApplyResult
- type ApplySnapshotOptions
- type CertProvider
- type Collector
- func (collector *Collector) AddDownload(ruleID string, n int64)
- func (collector *Collector) AddUpload(ruleID string, n int64)
- func (collector *Collector) DecConns(ruleID string)
- func (collector *Collector) EnsureRule(ruleID string)
- func (collector *Collector) IncConns(ruleID string)
- func (collector *Collector) RemoveRule(ruleID string)
- func (collector *Collector) SetConns(ruleID string, value int64)
- func (collector *Collector) Snapshot(ruleID string) TrafficSnapshot
- func (collector *Collector) SnapshotAll() []TrafficSnapshot
- type Manager
- func (manager *Manager) ApplySnapshot(rules []Rule, opts ApplySnapshotOptions) ApplyResult
- func (manager *Manager) RemoveRule(ruleID string)
- func (manager *Manager) RestartRule(rule Rule) error
- func (manager *Manager) RunningCount() int
- func (manager *Manager) RunningRules() []Rule
- func (manager *Manager) Snapshot(ruleID string) TrafficSnapshot
- func (manager *Manager) SnapshotAll() []TrafficSnapshot
- func (manager *Manager) StartRule(rule Rule) error
- func (manager *Manager) StopAll()
- func (manager *Manager) StopRule(ruleID string)
- type Protocol
- type Rule
- type Runner
- type TrafficSnapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyAction ¶
type ApplyAction string
const ( ApplyActionStarted ApplyAction = "started" ApplyActionRestarted ApplyAction = "restarted" ApplyActionStopped ApplyAction = "stopped" ApplyActionRemoved ApplyAction = "removed" ApplyActionUnchanged ApplyAction = "unchanged" ApplyActionFailed ApplyAction = "failed" )
type ApplyItemResult ¶
type ApplyItemResult struct {
RuleID string `json:"rule_id"`
Revision int64 `json:"revision,omitempty"`
Action ApplyAction `json:"action"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
}
type ApplyResult ¶
type ApplyResult struct {
AppliedRules int `json:"applied_rules"`
StoppedRules int `json:"stopped_rules"`
FailedRules int `json:"failed_rules"`
TotalRules int `json:"total_rules"`
Items []ApplyItemResult `json:"items"`
}
type ApplySnapshotOptions ¶
type ApplySnapshotOptions struct {
ReplaceAll bool `json:"replace_all"`
}
type CertProvider ¶
type CertProvider interface {
GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
Obtain(ctx context.Context, domains []string) error
}
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
func NewCollector ¶
func NewCollector() *Collector
func (*Collector) AddDownload ¶
func (*Collector) EnsureRule ¶
func (*Collector) RemoveRule ¶
func (*Collector) Snapshot ¶
func (collector *Collector) Snapshot(ruleID string) TrafficSnapshot
func (*Collector) SnapshotAll ¶
func (collector *Collector) SnapshotAll() []TrafficSnapshot
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManagerWithCert ¶
func NewManagerWithCert(collector *Collector, certMgr CertProvider) *Manager
func (*Manager) ApplySnapshot ¶
func (manager *Manager) ApplySnapshot(rules []Rule, opts ApplySnapshotOptions) ApplyResult
func (*Manager) RemoveRule ¶
func (*Manager) RestartRule ¶
func (*Manager) RunningCount ¶
func (*Manager) RunningRules ¶
func (*Manager) Snapshot ¶
func (manager *Manager) Snapshot(ruleID string) TrafficSnapshot
func (*Manager) SnapshotAll ¶
func (manager *Manager) SnapshotAll() []TrafficSnapshot
type Rule ¶
type Rule struct {
RuleID string `json:"rule_id" yaml:"rule_id"`
Name string `json:"name" yaml:"name"`
Protocol Protocol `json:"protocol" yaml:"protocol"`
ListenAddr string `json:"listen_addr" yaml:"listen_addr"`
ListenPort int `json:"listen_port" yaml:"listen_port"`
TargetAddr string `json:"target_addr" yaml:"target_addr"`
TargetPort int `json:"target_port" yaml:"target_port"`
Enabled bool `json:"enabled" yaml:"enabled"`
SpeedLimit int64 `json:"speed_limit" yaml:"speed_limit"`
MaxConn int `json:"max_conn" yaml:"max_conn"`
Domains []string `json:"domains,omitempty" yaml:"domains,omitempty"`
Remark string `json:"remark,omitempty" yaml:"remark,omitempty"`
Revision int64 `json:"revision,omitempty" yaml:"revision,omitempty"`
CreatedTime int64 `json:"created_time,omitempty" yaml:"created_time,omitempty"`
UpdatedTime int64 `json:"updated_time,omitempty" yaml:"updated_time,omitempty"`
}
func (Rule) RuntimeEqual ¶
func (Rule) Standardize ¶
Click to show internal directories.
Click to hide internal directories.