Documentation
¶
Overview ¶
Package cheburcheck checks whether volunteer networks can send a SYN through the TSPU box to a node's IPv4 address. The site sees the node address, panel address and Mistgate User-Agent. The integration is off by default; own-probe credentials are sealed in the vault and are only sent to the site's probe endpoint.
Index ¶
Constants ¶
const ( SourcePublic = "cheburcheck" SourceOwn = "cheburcheck_own" )
const (
// DefaultBaseURL is cheburcheck's API. Tests override it with a local httptest server.
DefaultBaseURL = "https://cheburcheck.ru"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Store *store.Store
Vault *vault.Vault
// StepUp is auth.Service.RequireStepUp: changing the settings asks for it.
StepUp func(context.Context) error
// Address resolves a node the way health.Service.NodeIPv4 does. It must return an IPv4 address.
Address func(context.Context, store.NodeRow) (netip.Addr, bool)
// HTTPClient and BaseURL are transport overrides. Tests use an httptest server; BaseURL defaults to the public site.
HTTPClient *http.Client
BaseURL string
// Edge uses the shorter tick budget. RoundLease coordinates the shared site limit across edge isolates.
Edge bool
RoundLease func(context.Context, string, time.Duration) bool
// ProbeTimeout overrides the whole check+SSE budget in tests. Production uses the VPS or edge default.
ProbeTimeout time.Duration
// OnChange refreshes the country alerts after a setting change or stored result.
OnChange func(context.Context)
Log *slog.Logger
Now func() time.Time
}
Config configures Service. Store, Vault, StepUp and Address are required.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Run ¶
Run is the VPS polling loop. The edge build calls Tick from its cron job instead.
type SourceState ¶
SourceState is a source name with its current switch and freshness window, ready for health.Config.External.
type State ¶
type State struct {
On bool
PublicOn bool
OwnOn bool
PublicMaxAge time.Duration
OwnMaxAge time.Duration
Status string
TokenUnknown bool
HoldUntil time.Time
LastRun time.Time
LastVerdict string
}
State is the cheburcheck source state the health module needs. Its sources have separate intervals and freshness windows.
func (State) Sources ¶
func (st State) Sources() []SourceState
Sources maps State to the source entries consumed by health.Config.External.