Documentation ¶
Index ¶
- type AdditionTrigger
- type Connection
- type DurationExtension
- type ExpirationTrigger
- type Host
- type HostHistory
- type State
- func (s *State) AddHost(connId string, h Host) error
- func (s *State) ExtendDurationForHost(h Host) (connId string, err error)
- func (s *State) ListStuck() []StuckConnection
- func (s *State) PrintHistory()
- func (s *State) RemoveHost(connId string, h Host, lock bool) error
- func (s *State) SignalReceiver(sig chan os.Signal, shutdown chan bool)
- type StuckConnection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdditionTrigger ¶
type Connection ¶
type Connection struct { Host Host Timer *time.Timer DurationExtensions []DurationExtension }
type DurationExtension ¶
type ExpirationTrigger ¶
type HostHistory ¶
type HostHistory struct { ConnectionID string Host Host Revoked time.Time DurationExtensions []DurationExtension }
type State ¶
type State struct { Connections map[string]*Connection AcceptNewConnections bool TriggerAddition AdditionTrigger TriggerExpiration ExpirationTrigger History []HostHistory StuckConnections []StuckConnection // contains filtered or unexported fields }
func Create ¶
func Create(addTrig AdditionTrigger, expTrig ExpirationTrigger) *State
func (*State) ExtendDurationForHost ¶
Prolongs the timer for a host if a connection exists and return its connectionId otherwise throw an error.
func (*State) ListStuck ¶
func (s *State) ListStuck() []StuckConnection
func (*State) PrintHistory ¶
func (s *State) PrintHistory()
func (*State) RemoveHost ¶
Removes a host connection. In case the triggerExpiration method fails, we will mark the connection as stuck. The lock should be always true, it is set to false only when used in the shutdown SignalReceiver so that it mass shutdowns all connections. The reasoning was since we have the lock the mutex in the function we cannot call the RemoveHost function since it will wait for the mutex to unlock. This admittedly is a terrible solution and the entire firewall tracker system would need to be refactored to support a more clean channel centric solution. TODO - refactor firewall tracker package to use channels instead of mutexes.
type StuckConnection ¶
type StuckConnection struct { ConnectionID string Host Host DurationExtension []DurationExtension Since time.Time }