Documentation
¶
Overview ¶
Package sessions owns user admission and the lifecycle of logical proxy sessions.
Index ¶
- func CanonicalIP(raw string) (string, error)
- func IPBlockKey(user int, ip string) string
- type AccountingCounter
- type ActiveIP
- type AdmissionEvent
- type Connection
- type Lease
- type LimitStatus
- type Registry
- func (r *Registry) AccountingCounters() []AccountingCounter
- func (r *Registry) Acquire(ctx context.Context, id int, identity, tag, ip, destination, network string, ...) (*Lease, error)
- func (r *Registry) AcquireTracked(ctx context.Context, id int, identity, tag, ip, destination, network string, ...) (*Lease, error)
- func (r *Registry) ActiveIPs(user int) []ActiveIP
- func (r *Registry) Ban(id int, until time.Time)
- func (r *Registry) CloseAll()
- func (r *Registry) CloseConnection(id string) bool
- func (r *Registry) CloseUser(id int, tag string)
- func (r *Registry) CloseUserInbound(tag string)
- func (r *Registry) Counters() state.Traffic
- func (r *Registry) DropIP(ip string, user int) int
- func (r *Registry) ExpireBans(now time.Time) []int
- func (r *Registry) ExpireIPBlocks(now time.Time) []string
- func (r *Registry) ExpireUsers(now time.Time)
- func (r *Registry) List(after string, limit int) []Connection
- func (r *Registry) Pause(v bool)
- func (r *Registry) PruneAccounting()
- func (r *Registry) PruneCounters()
- func (r *Registry) Quiesce(ctx context.Context, id int) (func(), error)
- func (r *Registry) QuiescePeriod(ctx context.Context, id int, period string) (func(), error)
- func (r *Registry) RestoreBans(bans map[int]time.Time)
- func (r *Registry) RestoreIPBlocks(blocks map[string]protocol.IPBlock)
- func (r *Registry) SetIPBlock(key string, block protocol.IPBlock)
- func (r *Registry) SetInboundEpochs(epochs map[string]string)
- func (r *Registry) SetPorts(ports []protocol.PortRange)
- func (r *Registry) SetRates(delta protocol.Traffic, elapsed float64)
- func (r *Registry) SetReportIPs(enabled bool)
- func (r *Registry) SetUsers(users []protocol.User)
- func (r *Registry) Summary() Summary
- type SpeedStatus
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalIP ¶
func IPBlockKey ¶
Types ¶
type AccountingCounter ¶ added in v1.0.2
type AdmissionEvent ¶
type Connection ¶
type Connection struct {
ID string `json:"id"`
UserID int `json:"user_id"`
InboundTag string `json:"inbound_tag"`
SourceIP string `json:"source_ip"`
Destination string `json:"destination"`
DestinationPort int `json:"destination_port"`
Network string `json:"network"`
Started time.Time `json:"started"`
}
type Lease ¶
type Lease struct {
Info Connection
// contains filtered or unexported fields
}
type LimitStatus ¶
type Registry ¶
type Registry struct {
OnBan func(int, time.Time)
OnReject func(AdmissionEvent)
// contains filtered or unexported fields
}
func (*Registry) AccountingCounters ¶ added in v1.0.2
func (r *Registry) AccountingCounters() []AccountingCounter
AccountingCounters keeps old-period counters reachable until their leases and sampler finish.
func (*Registry) AcquireTracked ¶ added in v1.0.2
func (r *Registry) AcquireTracked(ctx context.Context, id int, identity, tag, ip, destination, network string, port int, cancel func()) (*Lease, error)
AcquireTracked keeps a separate completion barrier after admission slots are released.
func (*Registry) CloseConnection ¶
func (*Registry) CloseUserInbound ¶
func (*Registry) ExpireUsers ¶ added in v1.0.2
func (*Registry) PruneAccounting ¶ added in v1.0.2
func (r *Registry) PruneAccounting()
func (*Registry) PruneCounters ¶
func (r *Registry) PruneCounters()
func (*Registry) Quiesce ¶ added in v1.0.2
Quiesce requires an admission fence, closes streams, and waits for their native handlers. The returned release function must run after the actor seals its traffic barrier.
func (*Registry) QuiescePeriod ¶ added in v1.0.2
QuiescePeriod finishes only an old accounting period. The member's new term remains admitted, so reconnecting journals cannot interrupt renewed access.
func (*Registry) RestoreIPBlocks ¶
func (*Registry) SetInboundEpochs ¶
func (*Registry) SetReportIPs ¶
type SpeedStatus ¶
type Summary ¶
type Summary struct {
Connections map[int]int `json:"connections"`
ActiveIPs map[int][]string `json:"active_ips,omitempty"`
Rejections map[string]uint64 `json:"rejections"`
Status map[int]LimitStatus `json:"status"`
Speed map[int]SpeedStatus `json:"speed"`
Rates map[int]protocol.UserRate `json:"rates,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.