Documentation
¶
Overview ¶
Package fleet holds the live state of the edges: sessions, assignments and observed addresses.
Index ¶
- func BuildAssignment(checks []store.Check, labels map[string]string) *netprobev1.Assignment
- type Addresses
- type Assigner
- type Checks
- type Hub
- func (h *Hub) AssignmentStatus(edgeID uuid.UUID) (assigned int, rejected []*netprobev1.RejectedCheck)
- func (h *Hub) Kick(edgeID uuid.UUID)
- func (h *Hub) Online(edgeID uuid.UUID) bool
- func (h *Hub) Register(edgeID uuid.UUID, labels map[string]string, kick context.CancelFunc, ...) *Session
- func (h *Hub) STUNCredential(user string) (uuid.UUID, string, bool)
- func (h *Hub) Sessions() []*Session
- func (h *Hub) Unregister(s *Session)
- type Recorder
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAssignment ¶
func BuildAssignment(checks []store.Check, labels map[string]string) *netprobev1.Assignment
BuildAssignment keeps the checks whose selector matches labels. The generation is a hash of the content: same checks, same generation.
Types ¶
type Addresses ¶
type Addresses interface {
ObserveAddress(ctx context.Context, edgeID uuid.UUID, src store.Source, family string, ip netip.Addr, info store.NetInfo, now time.Time) (bool, error)
}
Addresses is the address history.
type Assigner ¶
Assigner computes the checks of each edge and pushes changes to live sessions.
func (*Assigner) For ¶
func (a *Assigner) For(ctx context.Context, labels map[string]string) (*netprobev1.Assignment, error)
For builds the assignment of an edge with the given labels.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub tracks live sessions and their STUN credentials.
func (*Hub) AssignmentStatus ¶
func (h *Hub) AssignmentStatus(edgeID uuid.UUID) (assigned int, rejected []*netprobev1.RejectedCheck)
AssignmentStatus returns what an online edge runs and refused.
func (*Hub) Register ¶
func (h *Hub) Register(edgeID uuid.UUID, labels map[string]string, kick context.CancelFunc, now time.Time) *Session
Register opens a Session and kicks the previous one of the same edge.
func (*Hub) STUNCredential ¶
STUNCredential maps a STUN username to its edge and password.
func (*Hub) Unregister ¶
Unregister removes s unless a newer Session replaced it.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder writes address changes to the history, serialized.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is the live session of one edge.
func (*Session) Assignments ¶
func (s *Session) Assignments() <-chan *netprobev1.Assignment
Assignments delivers the assignments to send, newest only.
func (*Session) Push ¶
func (s *Session) Push(a *netprobev1.Assignment)
Push queues an assignment unless it is already the last one queued.
func (*Session) STUNUser ¶
STUNUser and STUNPass are the short-term STUN credentials of the session.
func (*Session) SetStatus ¶
func (s *Session) SetStatus(st *netprobev1.AssignmentStatus)
SetStatus records the edge answer for the current generation.