Documentation
¶
Index ¶
- func NewDualTapFactory(svc *Service, baseTunnelID string, username string, maxEvents int, ...) tunnel.TapFactory
- func NewPerRemoteTapFactory(svc *Service, baseTunnelID string, username string, maxEvents int, ...) tunnel.TapFactory
- func NewTapFactory(svc *Service, tunnelID string, username string, maxEvents int) tunnel.TapFactory
- func NewTripleTapFactoryWithCanonical(svc *Service, baseTunnelID string, username string, maxEvents int, ...) tunnel.TapFactory
- type Event
- type EventType
- type Meta
- type Ring
- type Service
- func (s *Service) AddEvent(tunnelID string, e Event, maxEvents int)
- func (s *Service) GetRecent(tunnelID string, maxEvents int) []Event
- func (s *Service) LatestLogFile(tunnelID, connID string) (string, error)
- func (s *Service) ListConnections(tunnelID string) ([]string, error)
- func (s *Service) SetOnConnDelta(fn func(tunnelID string, delta int))
- func (s *Service) SetOnMetric(fn func(tunnelID string, sent, received int64))
- func (s *Service) Subscribe(tunnelID string) chan Event
- func (s *Service) Unsubscribe(tunnelID string, ch chan Event)
- type TapImpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDualTapFactory ¶
func NewDualTapFactory(svc *Service, baseTunnelID string, username string, maxEvents int, portToIndex map[string]int) tunnel.TapFactory
NewDualTapFactory emits capture to both base session ID and per-remote IDs
func NewPerRemoteTapFactory ¶
func NewPerRemoteTapFactory(svc *Service, baseTunnelID string, username string, maxEvents int, portToIndex map[string]int) tunnel.TapFactory
NewPerRemoteTapFactory creates a TapFactory which assigns events to per-remote IDs (baseID-r{index}) portToIndex maps remote.LocalPort -> index used in the ID suffix
func NewTapFactory ¶
NewTapFactory creates a tunnel TapFactory bound to this capture Service and a tunnel id/user
func NewTripleTapFactoryWithCanonical ¶
func NewTripleTapFactoryWithCanonical(svc *Service, baseTunnelID string, username string, maxEvents int, portToIndex map[string]int, unameEnc string) tunnel.TapFactory
NewTripleTapFactoryWithCanonical emits capture to: - base session ID (sess-...) - per-remote session IDs (sess-...-rN) - canonical per-user+ports tunnel ID (tun-<b64user>-<lp>-<rp>)
Types ¶
type Event ¶
type Event struct {
Time time.Time `json:"time"`
TunnelID string `json:"tunnel_id"`
User string `json:"user"`
ConnID string `json:"conn_id"`
Type EventType `json:"type"`
Meta any `json:"meta,omitempty"`
Data []byte `json:"data,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
Event represents a captured event for a tunnel/connection.
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
Ring is a fixed-size ring buffer of events.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages capture buffers per tunnel and persistence.
func NewService ¶
func (*Service) LatestLogFile ¶
LatestLogFile returns the latest file path for a given connection (base or highest rotated)
func (*Service) ListConnections ¶
ListConnections returns known connection IDs for a tunnel based on persisted files
func (*Service) SetOnConnDelta ¶
SetOnConnDelta sets a hook to be called when a connection opens (+1) or closes (-1).
func (*Service) SetOnMetric ¶
SetOnMetric sets a hook to be called when a connection closes with byte counts.
func (*Service) Subscribe ¶
Subscribe returns a channel that will receive future events for a tunnel.
func (*Service) Unsubscribe ¶
Unsubscribe removes a subscriber channel.