Documentation
¶
Index ¶
- Constants
- type BufferReader
- type Detection
- type Detector
- func (d *Detector) GetResetTime() time.Time
- func (d *Detector) GetState() RateLimitState
- func (d *Detector) ProcessOutput(data []byte)
- func (d *Detector) SetCooldown(cooldown time.Duration)
- func (d *Detector) SetDetectionCallback(callback func(Detection))
- func (d *Detector) SetResetBuffer(seconds int)
- func (d *Detector) SetState(state RateLimitState)
- type EventBus
- type Integration
- type Manager
- func (m *Manager) GetDetector() *Detector
- func (m *Manager) GetEventBus() *EventBus
- func (m *Manager) GetScheduler() *Scheduler
- func (m *Manager) GetState() RateLimitState
- func (m *Manager) IsEnabled() bool
- func (m *Manager) ProcessOutput(data []byte)
- func (m *Manager) SetCooldown(cooldown time.Duration)
- func (m *Manager) SetEnabled(enabled bool)
- func (m *Manager) SetResetBuffer(seconds int)
- func (m *Manager) Start()
- func (m *Manager) Stop()
- type PTYConsumer
- type Provider
- type RateLimitEvent
- type RateLimitState
- type RecoveryHandler
- type Scheduler
- func (s *Scheduler) CancelRecovery()
- func (s *Scheduler) GetScheduledTime() (time.Time, bool)
- func (s *Scheduler) IsScheduled() bool
- func (s *Scheduler) ScheduleRecovery(resetTime time.Time)
- func (s *Scheduler) SetBuffer(seconds int)
- func (s *Scheduler) SetRecoveryCallback(callback func() error)
- func (s *Scheduler) SetSessionStatusCheck(callback func() bool)
- type SessionAccessor
- type SessionStatus
Constants ¶
View Source
const ( DefaultCooldown = 30 * time.Second DefaultResetBuffer = 5 DefaultRecoveryInput = "1\n" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferReader ¶
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
func NewDetector ¶
func (*Detector) GetResetTime ¶
func (*Detector) GetState ¶
func (d *Detector) GetState() RateLimitState
func (*Detector) ProcessOutput ¶
func (*Detector) SetCooldown ¶
func (*Detector) SetDetectionCallback ¶
func (*Detector) SetResetBuffer ¶
func (*Detector) SetState ¶
func (d *Detector) SetState(state RateLimitState)
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
func NewEventBus ¶
func NewEventBus() *EventBus
func (*EventBus) Publish ¶
func (eb *EventBus) Publish(event RateLimitEvent)
func (*EventBus) Subscribe ¶
func (eb *EventBus) Subscribe(eventType eventType) <-chan RateLimitEvent
type Integration ¶
type Integration struct {
// contains filtered or unexported fields
}
func NewIntegrationWithAccessor ¶
func NewIntegrationWithAccessor(sessionID string, session SessionAccessor, buffer BufferReader) *Integration
func (*Integration) GetManager ¶
func (i *Integration) GetManager() *Manager
func (*Integration) IsEnabled ¶
func (i *Integration) IsEnabled() bool
func (*Integration) SetEnabled ¶
func (i *Integration) SetEnabled(enabled bool)
func (*Integration) Start ¶
func (i *Integration) Start()
func (*Integration) Stop ¶
func (i *Integration) Stop()
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(sessionID string, instance SessionAccessor) *Manager
func (*Manager) GetDetector ¶
func (*Manager) GetEventBus ¶
func (*Manager) GetScheduler ¶
func (*Manager) GetState ¶
func (m *Manager) GetState() RateLimitState
func (*Manager) ProcessOutput ¶
func (*Manager) SetCooldown ¶
func (*Manager) SetEnabled ¶
func (*Manager) SetResetBuffer ¶
type PTYConsumer ¶
type PTYConsumer struct {
// contains filtered or unexported fields
}
func NewPTYConsumer ¶
func NewPTYConsumer(buffer BufferReader, manager *Manager) *PTYConsumer
func (*PTYConsumer) GetRateLimitState ¶
func (pc *PTYConsumer) GetRateLimitState() RateLimitState
func (*PTYConsumer) IsEnabled ¶
func (pc *PTYConsumer) IsEnabled() bool
func (*PTYConsumer) SetEnabled ¶
func (pc *PTYConsumer) SetEnabled(enabled bool)
func (*PTYConsumer) Start ¶
func (pc *PTYConsumer) Start()
func (*PTYConsumer) Stop ¶
func (pc *PTYConsumer) Stop()
type RateLimitEvent ¶
type RateLimitState ¶
type RateLimitState int
const ( StateNone RateLimitState = iota StateWaiting StateRecovering StateRecovered StateFailed )
type RecoveryHandler ¶
type RecoveryHandler struct {
// contains filtered or unexported fields
}
func NewRecoveryHandler ¶
func NewRecoveryHandler(sessionID string, sendInput func([]byte) error) *RecoveryHandler
func (*RecoveryHandler) Execute ¶
func (h *RecoveryHandler) Execute(input []byte) error
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
func NewScheduler ¶
func (*Scheduler) CancelRecovery ¶
func (s *Scheduler) CancelRecovery()
func (*Scheduler) IsScheduled ¶
func (*Scheduler) ScheduleRecovery ¶
func (*Scheduler) SetRecoveryCallback ¶
func (*Scheduler) SetSessionStatusCheck ¶
type SessionAccessor ¶
type SessionStatus ¶
type SessionStatus int
const ( SessionStatusRunning SessionStatus = iota SessionStatusReady SessionStatusPaused SessionStatusStopped )
func StatusToSessionStatus ¶
func StatusToSessionStatus(s int) SessionStatus
Click to show internal directories.
Click to hide internal directories.