Documentation ¶
Index ¶
- func GetAppToken(client *FreeboxHttpClient, apiVersion *FreeboxAPIVersion) (string, error)
- type FreeboxAPIVersion
- type FreeboxConnection
- func (f *FreeboxConnection) Close() error
- func (f *FreeboxConnection) GetAPIVersion() FreeboxAPIVersion
- func (f *FreeboxConnection) GetMetricsConnection() (*MetricsFreeboxConnectionAll, error)
- func (f *FreeboxConnection) GetMetricsLan() (*MetricsFreeboxLan, error)
- func (f *FreeboxConnection) GetMetricsSwitch() (*MetricsFreeboxSwitch, error)
- func (f *FreeboxConnection) GetMetricsSystem() (*MetricsFreeboxSystem, error)
- func (f *FreeboxConnection) GetMetricsWifi() (*MetricsFreeboxWifi, error)
- func (f *FreeboxConnection) WriteConfig(writer io.Writer) error
- type FreeboxDiscovery
- type FreeboxHttpClient
- type FreeboxHttpClientCallback
- type FreeboxSession
- type MetricsFreeboxConnection
- type MetricsFreeboxConnectionAll
- type MetricsFreeboxConnectionFtth
- type MetricsFreeboxConnectionXdsl
- type MetricsFreeboxConnectionXdslStats
- type MetricsFreeboxLan
- type MetricsFreeboxLanHost
- type MetricsFreeboxSwitch
- type MetricsFreeboxSwitchPortStats
- type MetricsFreeboxSwitchStatus
- type MetricsFreeboxSystem
- type MetricsFreeboxSystemSensor
- type MetricsFreeboxWifi
- type MetricsFreeboxWifiAp
- type MetricsFreeboxWifiBss
- type MetricsFreeboxWifiStation
- type MetricsFreeboxWifiStationStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAppToken ¶
func GetAppToken(client *FreeboxHttpClient, apiVersion *FreeboxAPIVersion) (string, error)
Types ¶
type FreeboxAPIVersion ¶
type FreeboxAPIVersion struct { APIDomain string `json:"api_domain"` UID string `json:"uid"` HTTPSAvailable bool `json:"https_available"` HTTPSPort uint16 `json:"https_port"` DeviceName string `json:"device_name"` APIVersion string `json:"api_version"` APIBaseURL string `json:"api_base_url"` DeviceType string `json:"device_type"` QueryApiVersion int `json:"-"` }
func NewFreeboxAPIVersion ¶
func NewFreeboxAPIVersion(client *FreeboxHttpClient, discovery FreeboxDiscovery, forceApiVersion int) (*FreeboxAPIVersion, error)
func (*FreeboxAPIVersion) GetURL ¶
func (f *FreeboxAPIVersion) GetURL(path string, miscPath ...interface{}) (string, error)
func (*FreeboxAPIVersion) IsValid ¶
func (f *FreeboxAPIVersion) IsValid() bool
type FreeboxConnection ¶
type FreeboxConnection struct {
// contains filtered or unexported fields
}
func NewFreeboxConnectionFromConfig ¶
func NewFreeboxConnectionFromConfig(reader io.Reader, forceApiVersion int) (*FreeboxConnection, error)
func NewFreeboxConnectionFromServiceDiscovery ¶
func NewFreeboxConnectionFromServiceDiscovery(discovery FreeboxDiscovery, forceApiVersion int) (*FreeboxConnection, error)
func (*FreeboxConnection) Close ¶
func (f *FreeboxConnection) Close() error
func (*FreeboxConnection) GetAPIVersion ¶
func (f *FreeboxConnection) GetAPIVersion() FreeboxAPIVersion
GetApiVersion get the connection info
func (*FreeboxConnection) GetMetricsConnection ¶
func (f *FreeboxConnection) GetMetricsConnection() (*MetricsFreeboxConnectionAll, error)
GetMetricsConnection http://mafreebox.freebox.fr/api/v5/connection/
func (*FreeboxConnection) GetMetricsLan ¶
func (f *FreeboxConnection) GetMetricsLan() (*MetricsFreeboxLan, error)
GetMetricsLan https://dev.freebox.fr/sdk/os/lan/
func (*FreeboxConnection) GetMetricsSwitch ¶
func (f *FreeboxConnection) GetMetricsSwitch() (*MetricsFreeboxSwitch, error)
GetMetricsSwitch http://mafreebox.freebox.fr/api/v5/switch/status/
func (*FreeboxConnection) GetMetricsSystem ¶
func (f *FreeboxConnection) GetMetricsSystem() (*MetricsFreeboxSystem, error)
GetMetricsSystem http://mafreebox.freebox.fr/api/v5/system/
func (*FreeboxConnection) GetMetricsWifi ¶
func (f *FreeboxConnection) GetMetricsWifi() (*MetricsFreeboxWifi, error)
GetMetricsWifi https://dev.freebox.fr/sdk/os/wifi/
func (*FreeboxConnection) WriteConfig ¶
func (f *FreeboxConnection) WriteConfig(writer io.Writer) error
type FreeboxDiscovery ¶
type FreeboxDiscovery int
const ( // FreeboxDiscoveryHTTP Freebox discovery by call to http://mafreebox.freebox.fr/api_version FreeboxDiscoveryHTTP FreeboxDiscovery = iota // FreeboxDiscoveryMDNS Freebox discovery by mDNS on service _fbx-api._tcp FreeboxDiscoveryMDNS )
type FreeboxHttpClient ¶
type FreeboxHttpClient struct {
// contains filtered or unexported fields
}
func NewFreeboxHttpClient ¶
func NewFreeboxHttpClient() *FreeboxHttpClient
func (*FreeboxHttpClient) Get ¶
func (f *FreeboxHttpClient) Get(url string, out interface{}, callbacks ...FreeboxHttpClientCallback) error
func (*FreeboxHttpClient) Post ¶
func (f *FreeboxHttpClient) Post(url string, in interface{}, out interface{}, callbacks ...FreeboxHttpClientCallback) error
type FreeboxSession ¶
type FreeboxSession struct {
// contains filtered or unexported fields
}
FreeboxSession represents all the variables used in a session
func NewFreeboxSession ¶
func NewFreeboxSession(appToken string, client *FreeboxHttpClient, apiVersion *FreeboxAPIVersion) (*FreeboxSession, error)
func (*FreeboxSession) AddHeader ¶
func (f *FreeboxSession) AddHeader(req *http.Request)
func (*FreeboxSession) IsValid ¶
func (f *FreeboxSession) IsValid() bool
func (*FreeboxSession) Refresh ¶
func (f *FreeboxSession) Refresh() error
type MetricsFreeboxConnection ¶
type MetricsFreeboxConnection struct { State string `json:"state"` Type string `json:"type"` Media string `json:"media"` IPv4 string `json:"ipv4"` IPv6 string `json:"ipv6"` RateUp *int64 `json:"rate_up"` RateDown *int64 `json:"rate_down"` BandwidthUp *int64 `json:"bandwidth_up"` BandwidthDown *int64 `json:"bandwidth_down"` BytesUp *int64 `json:"bytes_up"` BytesDown *int64 `json:"bytes_down"` }
MetricsFreeboxConnection https://dev.freebox.fr/sdk/os/connection/
type MetricsFreeboxConnectionAll ¶
type MetricsFreeboxConnectionAll struct { MetricsFreeboxConnection Xdsl *MetricsFreeboxConnectionXdsl Ftth *MetricsFreeboxConnectionFtth }
MetricsFreeboxConnectionAll is the result of GetMetricsConnection()
type MetricsFreeboxConnectionFtth ¶
type MetricsFreeboxConnectionFtth struct { SfpPresent *bool `json:"sfp_present"` SfpAlimOk *bool `json:"sfp_alim_ok"` SfpHasPowerReport *bool `json:"sfp_has_power_report"` SfpHasSignal *bool `json:"sfp_has_signal"` Link *bool `json:"link"` SfpSerial string `json:"sfp_serial"` SfpModel string `json:"sfp_model"` SfpVendor string `json:"sfp_vendor"` SfpPwrTx *int64 `json:"sfp_pwr_tx"` SfpPwrRx *int64 `json:"sfp_pwr_rx"` }
MetricsFreeboxConnectionFtth https://dev.freebox.fr/sdk/os/connection/#FtthStatus
type MetricsFreeboxConnectionXdsl ¶
type MetricsFreeboxConnectionXdsl struct { // https://dev.freebox.fr/sdk/os/connection/#XdslStatus Status *struct { Status string `json:"status"` Protocol string `json:"protocol"` Modulation string `json:"modulation"` Uptime *int64 `json:"uptime"` } `json:"status"` Down *MetricsFreeboxConnectionXdslStats `json:"down"` Up *MetricsFreeboxConnectionXdslStats `json:"up"` }
MetricsFreeboxConnectionXdsl https://dev.freebox.fr/sdk/os/connection/#XdslInfos
type MetricsFreeboxConnectionXdslStats ¶
type MetricsFreeboxConnectionXdslStats struct { Maxrate *int64 `json:"maxrate"` Rate *int64 `json:"rate"` Snr *int64 `json:"snr"` Attn *int64 `json:"attn"` Snr10 *int64 `json:"snr_10"` Attn10 *int64 `json:"attn_10"` Fec *int64 `json:"fec"` Crc *int64 `json:"crc"` Hec *int64 `json:"hec"` Es *int64 `json:"es"` Ses *int64 `json:"ses"` Phyr *bool `json:"phyr"` Ginp *bool `json:"ginp"` Nitro *bool `json:"nitro"` Rxmt *int64 `json:"rxmt"` // phyr RxmtCorr *int64 `json:"rxmt_corr"` // phyr RxmtUncorr *int64 `json:"rxmt_uncorr"` // phyr RtxTx *int64 `json:"rtx_tx"` // ginp RtxC *int64 `json:"rtx_c"` // ginp RtxUc *int64 `json:"rtx_uc"` // ginp }
MetricsFreeboxConnectionXdslStats https://dev.freebox.fr/sdk/os/connection/#XdslStats
type MetricsFreeboxLan ¶
type MetricsFreeboxLan struct {
Hosts map[string][]*MetricsFreeboxLanHost
}
MetricsFreeboxLan https://dev.freebox.fr/sdk/os/lan/
type MetricsFreeboxLanHost ¶
type MetricsFreeboxLanHost struct { ID string `json:"id"` PrimaryName string `json:"primary_name"` HostType string `json:"host_type"` PrimaryNameManual *bool `json:"primary_name_manual"` L2Ident *struct { ID string `json:"id"` Type string `json:"type"` } `json:"l2ident"` VendorName string `json:"vendor_name"` Persistent *bool `json:"persistent"` Reachable *bool `json:"reachable"` LastTimeReachable *int64 `json:"last_time_reachable"` Active *bool `json:"active"` LastActivity *int64 `json:"last_activity"` Names []*struct { Name string `json:"name"` Source string `json:"source"` } `json:"names"` L3Connectivities []*struct { Addr string `json:"addr"` Af string `json:"af"` Active *bool `json:"active"` Reachable *bool `json:"reachable"` LastActivity *int64 `json:"last_activity"` LastTimeReachable *int64 `json:"last_time_reachable"` } `json:"l3connectivities"` }
MetricsFreeboxLanHost https://dev.freebox.fr/sdk/os/lan/#LanHost
type MetricsFreeboxSwitch ¶
type MetricsFreeboxSwitch struct {
Ports []*MetricsFreeboxSwitchStatus
}
MetricsFreeboxSwitch https://dev.freebox.fr/sdk/os/switch/
type MetricsFreeboxSwitchPortStats ¶
type MetricsFreeboxSwitchPortStats struct { RxBadBytes *int64 `json:"rx_bad_bytes"` RxBroadcastPackets *int64 `json:"rx_broadcast_packets"` RxBytesRate *int64 `json:"rx_bytes_rate"` RxErrPackets *int64 `json:"rx_err_packets"` RxFcsPackets *int64 `json:"rx_fcs_packets"` RxFragmentsPackets *int64 `json:"rx_fragments_packets"` RxGoodBytes *int64 `json:"rx_good_bytes"` RxGoodPackets *int64 `json:"rx_good_packets"` RxJabberPackets *int64 `json:"rx_jabber_packets"` RxMulticastPackets *int64 `json:"rx_multicast_packets"` RxOversizePackets *int64 `json:"rx_oversize_packets"` RxPacketsRate *int64 `json:"rx_packets_rate"` RxPause *int64 `json:"rx_pause"` RxUndersizePackets *int64 `json:"rx_undersize_packets"` RxUnicastPackets *int64 `json:"rx_unicast_packets"` TxBroadcastPackets *int64 `json:"tx_broadcast_packets"` TxBytes *int64 `json:"tx_bytes"` TxBytesRate *int64 `json:"tx_bytes_rate"` TxCollisions *int64 `json:"tx_collisions"` TxDeferred *int64 `json:"tx_deferred"` TxExcessive *int64 `json:"tx_excessive"` TxFcs *int64 `json:"tx_fcs"` TxLate *int64 `json:"tx_late"` TxMulticastPackets *int64 `json:"tx_multicast_packets"` TxMultiple *int64 `json:"tx_multiple"` TxPackets *int64 `json:"tx_packets"` TxPacketsRate *int64 `json:"tx_packets_rate"` TxPause *int64 `json:"tx_pause"` TxSingle *int64 `json:"tx_single"` TxUnicastPackets *int64 `json:"tx_unicast_packets"` }
MetricsFreeboxSwitchPortStats https://dev.freebox.fr/sdk/os/switch/#switch-port-stats-object-unstable
type MetricsFreeboxSwitchStatus ¶
type MetricsFreeboxSwitchStatus struct { ID int64 `json:"id"` Duplex string `json:"duplex"` Link string `json:"link"` Mode string `json:"mode"` Speed string `json:"speed"` MacList []*struct { Mac string `json:"mac"` Hostname string `json:"hostname"` } `json:"mac_list"` Stats *MetricsFreeboxSwitchPortStats `json:"-"` }
MetricsFreeboxSwitchStatus https://dev.freebox.fr/sdk/os/switch/
type MetricsFreeboxSystem ¶
type MetricsFreeboxSystem struct { FirmwareVersion string `json:"firmware_version"` Mac string `json:"mac"` Serial string `json:"serial"` Uptime string `json:"uptime"` UptimeValue *int64 `json:"uptime_val"` BoardName string `json:"board_name"` TempCPUM *int64 `json:"temp_cpum"` // seems deprecated TempSW *int64 `json:"temp_sw"` // seems deprecated TempCPUB *int64 `json:"temp_cpub"` // seems deprecated FanRpm *int64 `json:"fan_rpm"` BoxAuthenticated *bool `json:"box_authenticated"` DiskStatus string `json:"disk_status"` BoxFlavor string `json:"box_flavor"` UserMainStorage string `json:"user_main_storage"` Sensors []MetricsFreeboxSystemSensor `json:"sensors"` // undocumented Fans []MetricsFreeboxSystemSensor `json:"fans"` // undocumented }
MetricsFreeboxSystem https://dev.freebox.fr/sdk/os/system/
type MetricsFreeboxSystemSensor ¶
type MetricsFreeboxSystemSensor struct { ID string `json:"id"` Name string `json:"name"` Value *int64 `json:"value"` }
MetricsFreeboxSystemSensor undocumented
type MetricsFreeboxWifi ¶
type MetricsFreeboxWifi struct { Ap []*MetricsFreeboxWifiAp Bss []*MetricsFreeboxWifiBss }
MetricsFreeboxWifi https://dev.freebox.fr/sdk/os/wifi/
type MetricsFreeboxWifiAp ¶
type MetricsFreeboxWifiAp struct { ID int64 `json:"id"` Name string `json:"name"` Status struct { State string `json:"state"` ChannelWidth string `json:"channel_width"` PrimaryChannel *int64 `json:"primary_channel"` SecondaryChannel *int64 `json:"secondary_channel"` DfsCacRemainingTime *int64 `json:"dfs_cac_remaining_time"` } `json:"status"` Capabilities map[string]map[string]bool `json:"capabilities"` Config struct { Band string `json:"band"` ChannelWidth string `json:"channel_width"` PrimaryChannel *int64 `json:"primary_channel"` SecondaryChannel *int64 `json:"secondary_channel"` DfsEnabled *bool `json:"dfs_enabled"` Ht struct { HtEnabled *bool `json:"ht_enabled"` AcEnabled *bool `json:"ac_enabled"` } `json:"ht"` } `json:"config"` Stations []*MetricsFreeboxWifiStation `json:"-"` }
MetricsFreeboxWifiAp https://dev.freebox.fr/sdk/os/wifi/#WifiAp
type MetricsFreeboxWifiBss ¶
type MetricsFreeboxWifiBss struct { ID string `json:"id"` PhyID int64 `json:"phy_id"` Status struct { State string `json:"state"` StaCount *int64 `json:"sta_count"` AuthorizedStaCount *int64 `json:"authorized_sta_count"` IsMainBss *bool `json:"is_main_bss"` } `json:"status"` Config struct { Enabled *bool `json:"enabled"` UseDefaultConfig *bool `json:"use_default_config"` Ssid string `json:"ssid"` HideSsid *bool `json:"hide_ssid"` Encryption string `json:"encryption"` Key string `json:"key"` EapolVersion *int64 `json:"eapol_version"` } `json:"config"` }
MetricsFreeboxWifiBss https://dev.freebox.fr/sdk/os/wifi/#WifiBss
type MetricsFreeboxWifiStation ¶
type MetricsFreeboxWifiStation struct { ID string `json:"id"` Mac string `json:"mac"` Bssid string `json:"bssid"` Hostname string `json:"hostname"` Host *MetricsFreeboxLanHost `json:"host"` State string `json:"state"` InactiveDuration *int64 `json:"inactive"` ConnDuration *int64 `json:"conn_duration"` RxBytes *int64 `json:"rx_bytes"` TxBytes *int64 `json:"tx_bytes"` RxRate *int64 `json:"rx_rate"` TxRate *int64 `json:"tx_rate"` Signal *int64 `json:"signal"` Flags struct { Legacy *bool `json:"legacy"` Ht *bool `json:"ht"` Vht *bool `json:"vht"` Authorized *bool `json:"authorized"` } `json:"flags"` LastRx *MetricsFreeboxWifiStationStats `json:"last_rx"` LastTx *MetricsFreeboxWifiStationStats `json:"last_tx"` Bss *MetricsFreeboxWifiBss `json:"-"` }
MetricsFreeboxWifiStation https://dev.freebox.fr/sdk/os/wifi/#WifiStation
type MetricsFreeboxWifiStationStats ¶
type MetricsFreeboxWifiStationStats struct { BitRate *int64 `json:"bitrate"` Mcs *int64 `json:"mcs"` VhtMcs *int64 `json:"vht_mcs"` Width string `json:"width"` Shortgi *bool `json:"shortgi"` }
MetricsFreeboxWifiStationStats https://dev.freebox.fr/sdk/os/wifi/#WifiStationStats