Documentation
¶
Overview ¶
Package system covers the mesh-wide and unit-level maintenance functions of an AmpliFi mesh: the site configuration, the admin password, the internet speed test, iperf, support bundles, statistics and HomeKit.
Index ¶
- func DisableHomeKit(ctx context.Context, c *amplifi.Client) error
- func DownloadSupportBundle(ctx context.Context, c *amplifi.Client, f *SupportBundle, w io.Writer) error
- func ResetSpeedTestHistory(ctx context.Context, c *amplifi.Client) error
- func ResetThroughputStats(ctx context.Context, c *amplifi.Client) error
- func SetAdminPassword(ctx context.Context, c *amplifi.Client, password string) error
- func StartIperf(ctx context.Context, c *amplifi.Client, port int) error
- func StartSpeedTest(ctx context.Context, c *amplifi.Client) error
- func UpdateSite(ctx context.Context, c *amplifi.Client, u SiteUpdate) error
- type HomeKit
- type Site
- type SiteUpdate
- type SpeedTest
- type SpeedTestResult
- type SpeedTestState
- type SupportBundle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableHomeKit ¶
DisableHomeKit turns the HomeKit service off (Device.HomeKit with action manage_service).
func DownloadSupportBundle ¶
func DownloadSupportBundle(ctx context.Context, c *amplifi.Client, f *SupportBundle, w io.Writer) error
DownloadSupportBundle copies a created support bundle to w, chunk by chunk, and verifies its MD5 checksum. Each chunk arrives as a "data" string; it is taken to be base64 and used as is when it is not.
func ResetSpeedTestHistory ¶
ResetSpeedTestHistory clears the unit's speed test history.
func ResetThroughputStats ¶
ResetThroughputStats clears the unit's throughput statistics.
func SetAdminPassword ¶
SetAdminPassword changes the admin password of the whole mesh (ClusterNode.SetUsersConfig, app: packSetUsersConfigCall). The router derives the SRP verifier itself. Hashes from amplifi.PasswordHash become invalid.
func StartIperf ¶
StartIperf starts an iperf server (iperf -s) on the unit for 30 seconds, so a client on the LAN can measure throughput to it. A port of 0 uses the iperf default.
func StartSpeedTest ¶
StartSpeedTest starts the unit's internet speed test. Follow it with GetSpeedTest until the state returns to SpeedTestStateIdle.
func UpdateSite ¶
UpdateSite applies u to the site configuration: it reads the whole config, applies the changes and writes it back.
Types ¶
type HomeKit ¶
type HomeKit struct {
Enabled bool `json:"administratively_enabled"`
Provisioned bool `json:"provisioned"`
CanRun bool `json:"service_can_potentially_run"`
CanRunNow bool `json:"service_can_run_now"`
}
HomeKit is the state of the unit's Apple HomeKit service.
type Site ¶
type Site struct {
SiteID int `json:"site_id"`
Country string `json:"country"`
Timezone string `json:"timezone"`
ZoneName string `json:"zone_name"`
ClockType int `json:"clock_type"`
BandSteering bool `json:"band_steering"`
RouterSteering bool `json:"router_steering"`
MultipleHops bool `json:"multiple_hops"`
Channel24 int `json:"channel_2_4ghz"`
Channel5 int `json:"channel_5ghz"`
FirmwareUpdateChannel string `json:"firmware_update_channel"`
WPSFromLCD bool `json:"wps_from_lcd"`
AcceptQoSOverhead bool `json:"accept_qos_overhead"`
AcceptDFS bool `json:"accept_dfs_radar_interruptions"`
GuestClientLimit int `json:"guest_client_limit"`
GuestDisableTime string `json:"guest_disable_time"`
GuestDurationLimit int `json:"guest_duration_limit"`
FriendClientLimit int `json:"friend_client_limit"`
FriendDisableTime string `json:"friend_disable_time"`
FriendDurationLimit int `json:"friend_duration_limit"`
Secrets map[string]string `json:"secrets"`
Fields map[string]any `json:"fields"`
}
Site is the mesh-wide site configuration. Fields holds every option code returned, so unmapped ones are still visible. Secrets holds the remote access (Teleport) credentials; see Redacted. Channels use -1 for automatic selection. The duration limits are the router's raw values; their unit is unconfirmed.
type SiteUpdate ¶
type SiteUpdate struct {
// ZoneName is an IANA zone such as "America/Chicago".
ZoneName *string
ClockType *int
WPSFromLCD *bool
AcceptQoSOverhead *bool
AcceptDFS *bool
FriendClientLimit *int
FriendDurationLimit *int
}
SiteUpdate is a change to the site configuration. Nil fields are left as they are. These are the options the app writes; the guest network limits are changed with wifi.UpdateGuest.
type SpeedTest ¶
type SpeedTest struct {
State SpeedTestState `json:"state"`
StateText string `json:"state_text"`
Result SpeedTestResult `json:"result"`
ResultText string `json:"result_text"`
Progress int `json:"progress"`
Latency time.Duration `json:"latency"`
DownloadKbps int `json:"download_kbps"`
WANDownloadKbps int `json:"wan_download_kbps"`
UploadKbps int `json:"upload_kbps"`
WANUploadKbps int `json:"wan_upload_kbps"`
Time time.Time `json:"time,omitzero"`
ServerID string `json:"server_id"`
Name string `json:"name"`
Sponsor string `json:"sponsor"`
City string `json:"city"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
Provider string `json:"provider"`
URL string `json:"url"`
DownloadURL string `json:"download_url"`
}
SpeedTest is the state and result of the unit's internet speed test. The WAN rates are what the WAN interface carried during the test, including other traffic.
func GetSpeedTest ¶
GetSpeedTest reports the progress of a running speed test, or the result of the last one.
func SpeedTestHistory ¶
SpeedTestHistory lists past speed test results, oldest first as the unit returns them. The request format is untested.
func (SpeedTest) MarshalJSON ¶
MarshalJSON renders Latency in seconds.
type SpeedTestResult ¶
type SpeedTestResult int
SpeedTestResult is the outcome of a speed test (app: SpeedTest.TR_*).
const ( SpeedTestResultNone SpeedTestResult = 0 SpeedTestResultSuccess SpeedTestResult = 1 SpeedTestResultFailure SpeedTestResult = 2 )
Speed test results.
type SpeedTestState ¶
type SpeedTestState int
SpeedTestState is the phase of a speed test (app: SpeedTest.TS_*).
const ( SpeedTestStateIdle SpeedTestState = 0 SpeedTestStateGetInfo SpeedTestState = 1 SpeedTestStatePing SpeedTestState = 2 SpeedTestStateDownload SpeedTestState = 3 SpeedTestStateUpload SpeedTestState = 4 )
Speed test states.
type SupportBundle ¶
type SupportBundle struct {
File string `json:"file"`
MD5Sum string `json:"md5sum"`
Size int64 `json:"size"`
}
SupportBundle is a support bundle the unit has created.
func CreateSupportBundle ¶
CreateSupportBundle has the unit build a support bundle (logs and configuration) for download with DownloadSupportBundle and waits for it. It can take up to two minutes.