Documentation
¶
Overview ¶
Package health is the panel's health module: the synthetic checker (the panel dials every inbound as a client and probes through the tunnel), the alerts derived from node state, doctor reports and check results with their lifecycle, the storage and relay of the node doctor, and the retention jobs of all of it. It serves the admin HealthService and implements the small fleet.Health seam.
It imports neither the fleet nor the access module: the fleet is reached through the Fleet interface below, and cmd/mistgate wires both directions.
Index ¶
- Constants
- Variables
- func DuePortCheckNodes(now time.Time, nodes []PortCheckScheduleNode) []string
- func NetworkOperator(country string, asn uint32) string
- type Config
- type CountryBudget
- type CountryConfig
- type CountryLimitError
- type CountryNowRun
- type CountryNowSource
- type CountryObserved
- type CountryRound
- type CountrySource
- type CountryTarget
- type CountryWant
- type DialOptions
- type Dialer
- type ExtCond
- type ExternalState
- type Fleet
- type ObservedNode
- type ObservedPort
- type ObservedProbe
- type PortCheckScheduleNode
- type ProbeError
- type ProbeNode
- type ProbeTarget
- type Result
- type Service
- func (s *Service) AddConditionSource(f func(ctx context.Context) []ExtCond)
- func (s *Service) AlertCounts(ctx context.Context) (active, critical uint32)
- func (s *Service) CountryHistory(ctx context.Context, since time.Time, family int) (sources []string, nodes []*adminv1.NodeReachabilityHistory, err error)
- func (s *Service) CountryTargets(ctx context.Context) ([]CountryTarget, error)
- func (s *Service) CountryTick(ctx context.Context) bool
- func (s *Service) DoctorReport(ctx context.Context, nodeID string, r *agentv1.DoctorReport)
- func (s *Service) EvaluateOnce(ctx context.Context)
- func (s *Service) Handler(opts ...connect.HandlerOption) (string, http.Handler)
- func (s *Service) NodeChecksPending(ctx context.Context, nodeID string, since time.Time) ([]string, error)
- func (s *Service) NodeChecksSince(ctx context.Context, nodeID string, since time.Time) (probeable, ok, failed int, timeoutsOnly bool, failedFor time.Duration, ...)
- func (s *Service) NodeHealthSummaries(ctx context.Context) map[string]store.NodeHealthSummary
- func (s *Service) NodeIPv4(ctx context.Context, n store.NodeRow) (netip.Addr, bool)
- func (s *Service) NodeLastRounds(ctx context.Context, nodeID string) ([]store.CheckSample, error)
- func (s *Service) NodeReturned(ctx context.Context, nodeID string, silentSince, now time.Time)
- func (s *Service) ProbeNodes(ctx context.Context) ([]ProbeNode, error)
- func (s *Service) ProbeTargets(ctx context.Context) ([]ProbeTarget, error)
- func (s *Service) ReconcileCountry(ctx context.Context)
- func (s *Service) RelayHints(ctx context.Context, entryID string, nodeIDs []string) (country map[string]*adminv1.RelayCountryHint, ...)
- func (s *Service) Retention(ctx context.Context)
- func (s *Service) Run(ctx context.Context)
- func (s *Service) RunChecksNow(ctx context.Context, nodeID string) (scheduled, skipped int, retry time.Duration, err error)
- func (s *Service) RunCountryNow(ctx context.Context, nodeID string) *adminv1.CountryNow
- func (s *Service) WithProbeCreds(ctx context.Context, in []statehash.Inbound) []statehash.Inbound
- type TSPUState
- type Target
- type Transition
- type Tunnel
Constants ¶
const PortCheckInterval = 6 * time.Hour
PortCheckInterval is the minimum time between periodic UDP delivery checks of one node.
Variables ¶
var ErrCountryNoProbes = errors.New("country check source: no probes")
ErrCountryNoProbes is what a source returns when it has no probe that can run the round at all: for an IPv6 round, no probe of the country has IPv6. The round stores unknown rows with the reason "no_probes".
var ErrCountryStopped = errors.New("country check source: switched off")
ErrCountryStopped is what a source returns when the owner switched it off in the middle of a round. The round ends and stores nothing.
Functions ¶
func DuePortCheckNodes ¶ added in v0.1.29
func DuePortCheckNodes(now time.Time, nodes []PortCheckScheduleNode) []string
DuePortCheckNodes returns eligible nodes whose last check is at least six hours old. Nodes without a stored check get a stable first-check slot in the six-hour window; later checks keep their cadence from the stored timestamp.
func NetworkOperator ¶
NetworkOperator returns the curated roll-up name for one operator ASN in a country, when known.
Types ¶
type Config ¶
type Config struct {
// Edge runs alert evaluation from EdgeTick and leaves one-off doctor actions to that evaluator in the jobs isolate.
Edge bool
// Dialers maps a protocol plugin id to its client probe. Default: hysteria2, awg, vless and mtproto. A protocol without
// one is SKIPPED (client_unsupported).
Dialers map[string]Dialer
// Probe URLs of the client-eye checks; hostnames go into the tunnel unresolved. A relay also downloads the bounded
// ProbeDownloadURL body to detect transfers that stall after the handshake.
Probe204URL, ProbeTraceURL string
ProbeDownloadURL string
// ProbeTLS is the TLS configuration of the probes (tests with their own CA). Default: system roots.
ProbeTLS *tls.Config
HandshakeTimeout time.Duration // QUIC handshake + auth; default 8 s
ProbeTimeout time.Duration // one probe request; default 10 s
RetryDelay time.Duration // between the attempt and its retry inside a round; default 15 s
FailedEvery time.Duration // probe period while an inbound fails; default 60 s
// Interval between rounds of one inbound. 0 = the setting health.check_interval_s, else 300 s.
Interval time.Duration
Workers int // concurrent rounds; default 4
// Tick is how often the scheduler looks for inbounds that are due; default 1 s.
Tick time.Duration
// SnapshotTTL is how long the list of probe targets is reused; default 5 s.
SnapshotTTL time.Duration
// StartGrace after Run starts: no NODE_DOWN is opened, agents are still reconnecting after a panel
// restart. Default 90 s.
StartGrace time.Duration
// BlipWindow: a silence shorter than this is a blip, not an outage. Default 10 min (fleet.blipWindow);
// only the end-to-end test shortens it (MISTGATE_HEALTH_BLIP_WINDOW).
BlipWindow time.Duration
// Actor returns the admin id for audit rows. Default: the signed-in admin from the auth interceptor.
Actor func(context.Context) string
// CheckPorts runs the fleet's bounded UDP delivery check. When set, the VPS scheduler uses it every six hours.
CheckPorts func(context.Context, string, []uint16) ([]store.PortCheck, string, string)
// ControlRelay evaluates automatic relay mode after a client-eye round or an agent bridge report.
ControlRelay func(context.Context, string)
// CheckPortsUDP is the same without the TCP half, for the confirming second sample after UDP loss. nil = CheckPorts.
CheckPortsUDP func(context.Context, string, []uint16) ([]store.PortCheck, string, string)
// Country returns the owner's choice for the country check and the source that measures it (the Globalping integration),
// read on every use so that a change applies at once. nil, or Enabled false, or a nil source: the check is off.
Country func(context.Context) (CountryConfig, CountrySource)
// Lists says whether the block-list source of the country check (internal/panel/blocklist) is on and covers the country,
// read on every use. When it is, GetChecks adds what the lists say of each node to the verdict (countryreach.Combine).
// nil: it is off. The lists never open an alert.
Lists func(context.Context) bool
// TSPU says whether the TSPU probe source (internal/panel/countryprobe) is on and covers the country, which probe node's rows to
// read and how old a row may be, read on every use. When it is, the probe node's verdicts join the live round in the combined
// verdict (countryreach.Combine) and in the COUNTRY_BLOCKED alert. nil: it is off.
TSPU func(context.Context) TSPUState
// External says which external source rows are enabled and how long their newest row stays fresh. nil is no external source.
External func(context.Context) []ExternalState
// Resolve looks a node's name up on the panel's side, for the country check. Default: the system resolver (DNS over
// HTTPS on the Cloudflare edition, which has none).
Resolve func(ctx context.Context, host string) ([]netip.Addr, error)
// CountryRoundTimeout bounds one whole country round. Default 60 s.
CountryRoundTimeout time.Duration
// RoundLease, when set, must grant a due edge pass before it runs, for ttl. The Cloudflare edition takes a D1 lease
// (store.TakeLease): cron ticks can overlap in two isolates, each with its own local mutex. Nil on the VPS.
RoundLease func(ctx context.Context, name string, ttl time.Duration) bool
// CountryNow are the sources besides Globalping that "Check now" of a node asks for a round of the country check out of turn
// (country_now.go): the TSPU probe, cheburcheck and the owner's own probes. Empty on the Cloudflare edition.
CountryNow []CountryNowSource
// OnTransition is called after an alert was opened or resolved (notifications attach here).
OnTransition func(Transition)
Log *slog.Logger
Now func() time.Time // the clock (tests)
}
Config configures Service. The zero value is production: only Actor and Log are usually set.
type CountryBudget ¶
type CountryBudget interface {
// Remaining is the tests left in the current window and the time until it resets.
Remaining(ctx context.Context) (left int, resetIn time.Duration, err error)
}
CountryBudget is what a country source that counts its tests can say about the window of its limit.
type CountryConfig ¶ added in v0.1.41
type CountryConfig struct {
Enabled bool
// Country is ISO 3166-1 alpha-2, upper case.
Country string
// Interval between rounds, at least ten minutes.
Interval time.Duration
// IPv6: also measure nodes with working IPv6 when their IPv6 entry is on or IPv4 is blocked (including TCP-only) or partial,
// in separate rounds (CountryRound.Family 6).
IPv6 bool
}
CountryConfig is what the owner chose.
type CountryLimitError ¶ added in v0.1.41
CountryLimitError is returned by a source that hit its rate limit: no round before Reset has passed.
func (*CountryLimitError) Error ¶ added in v0.1.41
func (e *CountryLimitError) Error() string
type CountryNowRun ¶
CountryNowRun is the work of a country source for a round out of turn, run in the background once the source has taken the request. It returns the state the source ends in ("done", "queued": asked, the answer comes by itself later, or "failed") and the reason of a failure.
type CountryNowSource ¶
type CountryNowSource struct {
Source string
Plan func(ctx context.Context, nodeID string) (run CountryNowRun, skip string)
}
CountryNowSource is a source of the country check that can be asked for a round of one node out of turn (country_now.go). Plan is quick and runs inside the request: it says why the source will not run now (the reason words of adminv1.CountryNowSource) or returns the work to do. A source that keeps no other state has nothing else to do; a plan that takes a lock for its run releases it when the run ends, and when it returns a reason, at once.
type CountryObserved ¶ added in v0.1.41
type CountryObserved struct {
// Eyeball: the probes are home or mobile networks (false: any network, too few of them were online).
Eyeball bool
Probes []ObservedProbe
NoProbe []string // named operators without a matching online home or mobile probe
Asked []string // operators pinned in the control request, whether or not their probes answered
}
CountryObserved is what the source saw.
type CountryRound ¶ added in v0.1.41
type CountryRound struct {
Country string
// Family is the address family of the round: 0 and 4 are IPv4 (a target's IP is an IPv4 address), 6 is IPv6 (IPv6 literals).
// An IPv6 round has no Want, and its control site is a name that has an IPv6 address: the source must reach it over IPv6,
// so that a probe without IPv6 is not counted against a node.
Family int
// Probes is the number of probes per measurement the budget allows (2 or 3).
Probes int
// Want asks a source for named networks first; City pins a probe when set. Empty means the generic country selection.
Want []CountryWant
// Control is a site that is never blocked in the country: a probe that cannot open TCP Port of Host is not counted.
ControlHost string
ControlPort uint16
Targets []CountryTarget
}
CountryRound is one round to measure.
type CountrySource ¶ added in v0.1.41
type CountrySource interface {
// Name is a short machine name for logs ("globalping").
Name() string
// HourlyLimit is how many tests (one probe running one measurement) the source allows an hour; 0 = no limit known.
HourlyLimit() int
// Measure runs one round. A *CountryLimitError means the source wants the caller to wait.
Measure(ctx context.Context, r CountryRound) (CountryObserved, error)
}
CountrySource measures from inside a country.
type CountryTarget ¶ added in v0.1.41
type CountryTarget struct {
Key string
IP string
Ports []uint16 // TCP ports; none = ICMP only
PreferredPort uint16 // the TLS endpoint a paid source tests, one of Ports; 0 = none, fall back to 443 then the lowest
}
CountryTarget is one node. IP is its address of the round's family (the only address that is measured).
type CountryWant ¶ added in v0.1.62
CountryWant is a named network to ask during a round. A want with an empty City can match any of its ASNs.
type DialOptions ¶
type DialOptions struct {
HandshakeTimeout time.Duration
ProbeTimeout time.Duration
// contains filtered or unexported fields
}
DialOptions bound a dial.
type Dialer ¶
Dialer connects to an inbound as a client. It returns a *ProbeError for the failures it can name and errClientUnsupported for a configuration it has no client for.
type ExtCond ¶
ExtCond is a condition another module holds right now. Only kinds this module knows are accepted (update_failed, os_update_failed, warp_reach, and the scheduled tasks' scheduled_check and scheduled_task_failing); the rest is dropped. Why is the i18n key of the explanation, Severity one of 1 info, 2 warning, 3 critical.
type ExternalState ¶ added in v0.1.63
ExternalState configures one external source for the combined country verdict.
type Fleet ¶
type Fleet interface {
// Live reads the durable view once for a pass; an error must stop that pass before alerts are reconciled.
Live(ctx context.Context) ([]store.NodeLiveRow, error)
// NodeLive reads one node's durable projection for a node-scoped check.
NodeLive(ctx context.Context, nodeID string) (store.NodeLiveRow, error)
// NodeStatusWithLive derives a node's status from its projection and the summaries (Service.NodeHealthSummaries) the
// caller read once for the request.
NodeStatusWithLive(ctx context.Context, n store.NodeRow, live store.NodeLiveRow, summaries map[string]store.NodeHealthSummary) adminv1.NodeStatus
// RunDoctor asks a node to run checks (nil = all) and waits for the report. FAILED_PRECONDITION: not
// connected, or an agent without "doctor/1".
RunDoctor(ctx context.Context, nodeID string, checks []string, wait time.Duration) (*agentv1.DoctorReport, error)
// ApplyFix sends a fix (or its dry run) and waits for the CommandResult; same preconditions.
ApplyFix(ctx context.Context, nodeID, fixID string, dryRun bool, params map[string]string) (*agentv1.CommandResult, error)
// CheckRelay performs the bounded leg/path diagnosis that refines the stage of a failed client-eye relay check.
CheckRelay(ctx context.Context, relayID string, stages ...string) (store.RelayCheck, error)
// OnlineByInbound counts the open sessions of every inbound of the connected nodes (the restart dialogs say how
// many connections drop).
OnlineByInbound(ctx context.Context) map[string]int
}
Fleet is what the module needs from the fleet module (*fleet.Fleet implements it).
type ObservedNode ¶ added in v0.1.41
type ObservedNode struct {
// Answered: the probe returned a result for this target (it was not offline or broken in the middle of the round).
Answered bool
// Complete: the probe answered the ICMP test and every TCP port test for this target.
Complete bool
ICMPOK bool
ICMPMs uint32
TCP []ObservedPort
}
ObservedNode is what one probe saw of one target.
type ObservedPort ¶ added in v0.1.41
ObservedPort is one TCP port of a target.
type ObservedProbe ¶ added in v0.1.41
type ObservedProbe struct {
Network string
ASN uint32
City string
// Eyeball is derived from this probe's tags, including in a fallback round with mixed probe types.
Eyeball bool
// Online: the probe took part in the round at all (not offline).
Online bool
// ControlOK: it opened TCP to the control site.
ControlOK bool
// Nodes by CountryTarget.Key. A target missing here was not answered by this probe.
Nodes map[string]ObservedNode
}
ObservedProbe is one probe of the round.
type PortCheckScheduleNode ¶ added in v0.1.29
type PortCheckScheduleNode struct {
ID string
State string
Online bool
UDPCheck bool
HasEnabledInbound bool
LastCheckedAt time.Time
UDPFilteredAt time.Time
UDPFilteredCheckedAt time.Time
}
PortCheckScheduleNode is the current eligibility and last stored check time used by DuePortCheckNodes.
type ProbeError ¶
type ProbeError struct {
Code, Detail string
Skip bool // not a failure: the inbound cannot be probed (the round is SKIPPED and not stored)
}
ProbeError is a failure with the machine code of health.proto CheckResult.error_code.
func (*ProbeError) Error ¶
func (e *ProbeError) Error() string
type ProbeNode ¶ added in v0.1.42
type ProbeNode struct {
ID, Name, Address, CountryCode string
Caps []string
Online bool
Ports []uint16
}
ProbeNode is an active node as the TSPU probe needs it: whether it is connected and what its agent can do (to choose the probe node), and the address and TCP ports the probe tests (the same ports Globalping uses).
type ProbeTarget ¶
type ProbeTarget struct {
NodeID string
IP string
Port uint16
Kind string // tcp, tls or fetch
SNI string
Path string
}
ProbeTarget is one public IPv4 measurement made by an owner-managed probe. It intentionally has no node name.
type Result ¶
type Result struct {
Status adminv1.CheckStatus
At time.Time
LatencyMS uint32 // the cold time of the round: dial start to the first generate_204 response
ConnectMS uint32 // dial start to the first connection through the tunnel being open; 0 = not measured
ResponseMS uint32 // one more generate_204 on that connection; 0 = not measured or the connection was not reused
UDPSent, UDPLost uint32 // packets the panel's own QUIC client sent and declared lost in the round (Hysteria2; 0 = none)
ExitIP, ExitCountry string
ErrorCode, ErrorDetail string
}
Result is one finished round.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the health module.
func New ¶
New builds the module. Call Run to start the background work and SetHealth of the fleet with the service.
func (*Service) AddConditionSource ¶
AddConditionSource registers a function the evaluator calls on every pass; the alerts it describes open while it returns them and resolve (cleared) when it stops. The function must be cheap and must not call back into Service.
func (*Service) AlertCounts ¶
AlertCounts is the badge: active alerts that are not muted and not INFO, and the critical ones among them. Alerts about people (ACCESS_ENDED, USER_CONNECTION, TORRENT, DEVICE_LIMIT) are not counted.
func (*Service) CountryHistory ¶ added in v0.1.43
func (s *Service) CountryHistory(ctx context.Context, since time.Time, family int) (sources []string, nodes []*adminv1.NodeReachabilityHistory, err error)
CountryHistory is what CountryReachabilityService.GetReachabilityHistory shows: for every source that is on (the same test GetChecks makes), what it said of each node since `since`, as a lane of verdicts where consecutive equal ones are one point. Globalping's lane holds the rounds of the selected country; the block lists' lane is LISTED or OK; the TSPU probe's lane holds the runs of the current probe node; external sources each add a lane. Sources keep the existing order, then external sources; nodes are by id. The family is familyV4 or familyV6: IPv6 is measured by Globalping alone, so its history is that one lane, and it is empty while Globalping's IPv6 checks are off; the lists, the TSPU probe and the external sources are IPv4.
func (*Service) CountryTargets ¶ added in v0.1.63
func (s *Service) CountryTargets(ctx context.Context) ([]CountryTarget, error)
CountryTargets are the online nodes as a paid external source tests them: the IPv4 (empty when the node has none, so the source can say so), the TCP ports and the preferred one.
func (*Service) CountryTick ¶ added in v0.1.41
CountryTick runs a round when one is due (the configured interval, stretched by the budget, since the last one, and not before a rate-limit hold ends) and reports whether it ran. The VPS scheduler and the edge cron both call it; it is safe to call often and never runs two rounds at once. With the IPv6 checks on, IPv4 and IPv6 are rounds of their own, each due once an interval (the budget counts both): the IPv4 round goes first when both are due, so an IPv6 round never delays it by more than its own time, and the IPv6 one follows on the next call.
func (*Service) DoctorReport ¶
DoctorReport stores a report of a node (fleet.Health). A full report replaces the node's rows, a partial one merges by check id; a report that says it did not run ("busy", "not_root") or holds nothing changes nothing. What a node says is bounded and cleaned first: it is stored and shown in the UI.
func (*Service) EvaluateOnce ¶ added in v0.1.49
EvaluateOnce is the evaluator pass of the Cloudflare edition's cron tick (the VPS runs runEvaluator). The caller gives the pass its deadline. The pass is skipped, not waited for, while this isolate is still in one (a mutex held across D1 I/O must never block the tick), and a D1 lease keeps two isolates from reconciling the same transitions twice.
func (*Service) Handler ¶
Handler is the admin HealthService (see fleet.NodeHandler for how it is mounted behind the session).
func (*Service) NodeChecksPending ¶
func (s *Service) NodeChecksPending(ctx context.Context, nodeID string, since time.Time) ([]string, error)
NodeChecksPending lists the inbounds NodeChecksSince does not count as ok: probeable, and without an OK round that ended at or after since. The OS update shows their profiles while it waits for the node to settle.
func (*Service) NodeChecksSince ¶
func (s *Service) NodeChecksSince(ctx context.Context, nodeID string, since time.Time) (probeable, ok, failed int, timeoutsOnly bool, failedFor time.Duration, err error)
NodeChecksSince counts the inbounds of the node that the synthetic checker can probe right now (no skip reason) and how many of them have a round that ended at or after since: ok = the newest round is OK, failed = FAILED or DEGRADED. An inbound without such a round is neither. timeoutsOnly: there is a failed inbound and every FAILED or DEGRADED round since `since` of the node's inbounds ended in the error code "timeout" (not refused, auth, tls, exit_unreachable: those are the node's own faults, not a lossy path). failedFor is how long the failure has lasted: the shortest, over the failed inbounds, span from the first to the last round of their current failed run.
func (*Service) NodeHealthSummaries ¶ added in v0.1.49
NodeHealthSummaries is the synthetic-check and doctor view of the nodes for their status, as of the last evaluation: a node without an entry has nothing to report. The edge admin and jobs roles have separate isolates, so the admin reads the one settings row (one D1 read); a request calls this once, not per node. The VPS copies its in-memory result.
func (*Service) NodeIPv4 ¶ added in v0.1.41
NodeIPv4 is a node's IPv4 address as the country sources use it: the address itself, or for a name the first IPv4 the panel resolves it to (DNS over HTTPS on the Cloudflare edition). ok is false when it has none.
func (*Service) NodeLastRounds ¶
NodeLastRounds returns the newest stored round (inbound id, time, status, error code) of every inbound of the node that the checker can probe right now and has probed at least once. The rollout reads from it which profiles were already failing before an update, and which ones did not pass after it and why.
func (*Service) NodeReturned ¶
NodeReturned writes the history record of a host blip: an INFO alert that was never active, from the start of the silence to the return (the hoster blipped: an event, no alert, no reboot). It never notifies.
func (*Service) ProbeNodes ¶ added in v0.1.42
ProbeNodes lists the active nodes for the TSPU probe.
func (*Service) ProbeTargets ¶
func (s *Service) ProbeTargets(ctx context.Context) ([]ProbeTarget, error)
ProbeTargets builds the panel-owned targets for the own-probe protocol. Only connected, active nodes with public IPv4 addresses are included, and no node contributes more than two targets. Fleet-wide rotation is applied by ownprobe.
func (*Service) ReconcileCountry ¶ added in v0.1.41
ReconcileCountry brings the COUNTRY_BLOCKED alerts up to date without the full evaluator, which the Cloudflare edition does not run on the admin isolate. Every source of the country check calls it (its Config.OnChange) when its settings change or it stored a result; the cron tick's evaluator (EvaluateOnce) derives these alerts itself. Alerts of other kinds are left alone.
func (*Service) RelayHints ¶ added in v0.1.65
func (s *Service) RelayHints(ctx context.Context, entryID string, nodeIDs []string) (country map[string]*adminv1.RelayCountryHint, reach map[string]*adminv1.RelayReachHint)
RelayHints is what the country check and the TSPU probe know about nodes that could be the exit of a relay through an entry node (access.ListRelayCandidates, relay.proto RelayCountryHint and RelayReachHint). A node the sources say nothing fresh about is left out of the maps: "no data" is the caller's word, never a guess here.
country: the combined verdict of the node seen from inside the country (also for entryID: do people see the entry?) and the networks that see it dark.
reach: whether the entry reaches the exit, known only when the TSPU probe runs from the entry node. The probe's row for the exit from this entry says it ("tspu_row"); without a row, a run that found no TSPU on the entry's path (a blocked reference answered: reason refs_pass) says nothing is cut there ("refs_pass").
func (*Service) Retention ¶ added in v0.1.31
Retention runs one retention pass for scheduled callers.
func (*Service) Run ¶
Run drives the checker, the evaluator and the retention sweeps until ctx ends.
func (*Service) RunChecksNow ¶
func (s *Service) RunChecksNow(ctx context.Context, nodeID string) (scheduled, skipped int, retry time.Duration, err error)
RunChecksNow schedules an immediate round for every inbound of a node (or of the fleet) that can be probed. Rounds that are running or started less than 30 s ago are refused: retry is the seconds until the soonest of them may run again (0 when nothing was refused for that reason).
func (*Service) RunCountryNow ¶
RunCountryNow asks the country check for a round of one node out of turn. It returns at once: the sources that took the request are "running" and finish in the background.
func (*Service) WithProbeCreds ¶
WithProbeCreds appends the system credential of every inbound that has a probe client to the desired state of a node (cmd/mistgate calls it on the result of access.Desired). The credential has no user and no device and lives in health_probe_cred, which no list, subscription or quota reads (an AWG one is a peer with its own key and an address from the profile's allocator; the node takes it for a device, which is why no agent update is needed). A credential that cannot be made is logged and left out: the node must not lose its real users over a probe.
type TSPUState ¶ added in v0.1.42
TSPUState is what the country check needs to know of the TSPU probe (internal/panel/countryprobe): whether its results count (it is on, has a probe node, and covers the country), the probe node whose rows to read, and how old a row may be to still say something about the node now. Run is the newest run's status, for GetChecks (nil: none).
type Target ¶
type Target struct {
Node store.NodeRow
Inbound store.FleetInboundRow
Spec plugin.InboundSpec
Settings []byte // merged profile settings (secrets in place)
CredID string // the system credential's id (AWG: the id of the probe "device", for its signature)
Secret string // the system credential's secret: what a client presents
}
Target is what a Dialer needs to connect to one inbound as a client.
type Transition ¶
type Transition struct {
Alert store.HealthAlert
Resolved bool // false: opened (or re-opened)
}
Transition is one alert changing state, for the notification hook.
type Tunnel ¶
type Tunnel interface {
// DialContext opens a TCP connection to addr ("host:port") through the node. The host name is NOT
// resolved here: the node resolves it, so a broken resolver on the node shows up as a failed probe.
DialContext(ctx context.Context, network, addr string) (net.Conn, error)
Close() error
}
Tunnel is an open client session of one inbound: a dialer that goes out through the node.
Source Files
¶
- auth_error_native.go
- awg.go
- censorsim_default.go
- censorsim_poll_default.go
- checker.go
- country.go
- country_history.go
- country_now.go
- country_now_types.go
- country_operators.go
- country_relay.go
- country_resolve_native.go
- country_run_native.go
- country_source.go
- country_tspu.go
- doctor.go
- eval.go
- eval_traffic.go
- health.go
- hooks.go
- hy2.go
- mtproto.go
- ownprobe_signal.go
- ownprobe_targets.go
- port_recheck.go
- port_recheck_native.go
- probe.go
- relay_hints.go
- relay_round.go
- retention.go
- retention_probe.go
- rpc.go
- targets.go
- updatehooks.go
- users.go
- vless.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package vlesshelper contains the Xray client used by the panel's short-lived VLESS health helper.
|
Package vlesshelper contains the Xray client used by the panel's short-lived VLESS health helper. |
|
Package vlesswire holds the messages between the panel and its VLESS health helper process.
|
Package vlesswire holds the messages between the panel and its VLESS health helper process. |