Documentation
¶
Overview ¶
Package wifi provides access to IEEE 802.11 WiFi device operations on Linux using nl80211.
Index ¶
- Variables
- type BSS
- type BSSLoad
- type BSSStatus
- type BandAttributes
- type BaseModulationInfo
- type BitrateAttrs
- type ChannelWidth
- type Client
- func (c *Client) AccessPoints(ifi *Interface) ([]*BSS, error)
- func (c *Client) BSS(ifi *Interface) (*BSS, error)
- func (c *Client) Close() error
- func (c *Client) Connect(ifi *Interface, ssid string) error
- func (c *Client) ConnectWPAPSK(ifi *Interface, ssid, psk string) error
- func (c *Client) Disconnect(ifi *Interface) error
- func (c *Client) GetRegulatoryDomain() (*RegulatoryDomain, error)
- func (c *Client) Interfaces() ([]*Interface, error)
- func (c *Client) PHYs() ([]*PHY, error)
- func (c *Client) ReloadRegulatoryDatabase() error
- func (c *Client) Scan(ctx context.Context, ifi *Interface) error
- func (c *Client) SetDeadline(t time.Time) error
- func (c *Client) SetReadDeadline(t time.Time) error
- func (c *Client) SetRegulatoryRegion(region string, hint RegulatoryHint) error
- func (c *Client) SetWriteDeadline(t time.Time) error
- func (c *Client) StationInfo(ifi *Interface) ([]*StationInfo, error)
- func (c *Client) SurveyInfo(ifi *Interface) ([]*SurveyInfo, error)
- type EHTModulationInfo
- type FrequencyAttrs
- type HEModulationInfo
- type HTCapabilities
- type HTModulationInfo
- type Interface
- type InterfaceCombination
- type InterfaceCombinationLimit
- type InterfaceType
- type PHY
- type RSNAKM
- type RSNCipher
- type RSNInfo
- type RateInfo
- type RateModulationInfo
- type RateModulationInfoType
- type RegulatoryDomain
- type RegulatoryHint
- type StationInfo
- type SurveyInfo
- type VHTCapabilities
- type VHTModulationInfo
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BSS ¶
type BSS struct {
// The service set identifier, or "network name" of the BSS.
SSID string
// BSSID: The BSS service set identifier. In infrastructure mode, this is the
// hardware address of the wireless access point that a client is associated
// with.
BSSID net.HardwareAddr
// Frequency: The frequency used by the BSS, in MHz.
Frequency int
// BeaconInterval: The time interval between beacon transmissions for this BSS.
BeaconInterval time.Duration
// LastSeen: The time since the client last scanned this BSS's information.
LastSeen time.Duration
// Status: The status of the client within the BSS.
Status BSSStatus
// Signal: The signal strength of the BSS, in mBm (divide by 100 to get dBm).
Signal int32
// SignalUnspecified: The signal strength of the BSS, in percent.
SignalUnspecified uint32
// Load: The load element of the BSS (contains StationCount, ChannelUtilization and AvailableAdmissionCapacity).
Load BSSLoad
// RSN Robust Security Network Information Element (IEEE 802.11 Element ID 48)
RSN RSNInfo
}
A BSS is an 802.11 basic service set. It contains information about a wireless network associated with an Interface.
type BSSLoad ¶ added in v0.2.0
type BSSLoad struct {
// Version: Indicates the version of the BSS Load Element. Can be 1 or 2.
Version int
// StationCount: total number of STA currently associated with this BSS.
StationCount uint16
// ChannelUtilization: Percentage of time (linearly scaled 0 to 255) that the AP sensed the medium was busy. Calculated only for the primary channel.
ChannelUtilization uint8
// AvailableAdmissionCapacity: remaining amount of medium time available via explicit admission control in units of 32 us/s.
AvailableAdmissionCapacity uint16
}
BSSLoad is an Information Element containing measurements of the load on the BSS.
type BSSStatus ¶
type BSSStatus int
A BSSStatus indicates the current status of client within a BSS.
const ( // BSSStatusAuthenticated indicates that a client is authenticated with a BSS. BSSStatusAuthenticated BSSStatus = iota // BSSStatusAssociated indicates that a client is associated with a BSS. BSSStatusAssociated // BSSStatusNotAssociated indicates that a client is not associated with a BSS. BSSStatusNotAssociated // BSSStatusIBSSJoined indicates that a client has joined an independent BSS. BSSStatusIBSSJoined )
type BandAttributes ¶ added in v0.9.0
type BandAttributes struct {
// High Throughput (802.11n) device capabilities (nil if not supported).
HTCapabilities *HTCapabilities
// Very High Throughput (802.11ac) device capabilities (nil if not supported).
VHTCapabilities *VHTCapabilities
// Minimum spacing between A-MPDU frames. Used for both HT and VHT
// capable devices.
MinRxAMPDUSpacing time.Duration
// Per-frequency (channel) attributes.
FrequencyAttributes []FrequencyAttrs
// Per-bitrate attributes.
BitrateAttributes []BitrateAttrs
}
BandAttributes represent the RF band-specific attributes.
type BaseModulationInfo ¶ added in v0.9.0
func (BaseModulationInfo) GetMCS ¶ added in v0.9.0
func (mi BaseModulationInfo) GetMCS() int
func (BaseModulationInfo) GetNSS ¶ added in v0.9.0
func (mi BaseModulationInfo) GetNSS() int
func (BaseModulationInfo) HasShortGI ¶ added in v0.9.0
func (mi BaseModulationInfo) HasShortGI() bool
func (BaseModulationInfo) String ¶ added in v0.9.0
func (mi BaseModulationInfo) String() string
func (BaseModulationInfo) WifiGeneration ¶ added in v0.9.0
func (mi BaseModulationInfo) WifiGeneration() string
type BitrateAttrs ¶ added in v0.9.0
type BitrateAttrs struct {
// Bitrate is the bitrate in units of 100kbps.
Bitrate float32
// ShortPreamble indicates that a short preamble is supported in the
// 2.4GHz band.
ShortPreamble bool
}
BitrateAttrs represents the attributes of a bitrate.
type ChannelWidth ¶ added in v0.7.0
type ChannelWidth int
A ChannelWidth is the width of a WiFi channel.
On Linux, ChannelWidth copies the ordering of nl80211's channel width constants. This may not be the case on other operating systems. See: https://github.com/torvalds/linux/blob/v6.17/include/uapi/linux/nl80211.h#L5136-L5177
const ( ChannelWidth20NoHT ChannelWidth = iota ChannelWidth20 ChannelWidth40 ChannelWidth80 ChannelWidth80P80 ChannelWidth160 ChannelWidth5 ChannelWidth10 ChannelWidth1 ChannelWidth2 ChannelWidth4 ChannelWidth8 ChannelWidth16 ChannelWidth320 )
func (ChannelWidth) String ¶ added in v0.7.0
func (t ChannelWidth) String() string
String returns the string representation of an InterfaceType.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client is a type which can access WiFi device actions and statistics using operating system-specific operations.
func (*Client) AccessPoints ¶ added in v0.5.0
AccessPoints retrieves the currently known BSS around the specified Interface.
func (*Client) ConnectWPAPSK ¶
Connect starts connecting the interface to the specified ssid using WPA.
func (*Client) Disconnect ¶
Dissconnect disconnects the interface.
func (*Client) GetRegulatoryDomain ¶ added in v0.8.0
func (c *Client) GetRegulatoryDomain() (*RegulatoryDomain, error)
GetRegulatoryRegion gets the system-wide regulatory domain. See https://wireless.docs.kernel.org/en/latest/en/developers/regulatory/wireless-regdb.html
func (*Client) Interfaces ¶
Interfaces returns a list of the system's WiFi network interfaces.
func (*Client) ReloadRegulatoryDatabase ¶ added in v0.8.0
ReloadRegulatoryDatabase reloads the wireless regulatory database.
This can be used if cfg80211 was built into the kernel and the wireless regulatory database was not available during early boot.
See https://wireless.docs.kernel.org/en/latest/en/developers/regulatory/wireless-regdb.html
func (*Client) Scan ¶ added in v0.5.0
Scan requests the wifi interface to scan for new access points.
Use context.WithDeadline to set a timeout.
func (*Client) SetDeadline ¶ added in v0.3.0
SetDeadline sets the read and write deadlines associated with the connection.
func (*Client) SetReadDeadline ¶ added in v0.3.0
SetReadDeadline sets the read deadline associated with the connection.
func (*Client) SetRegulatoryRegion ¶ added in v0.8.0
func (c *Client) SetRegulatoryRegion(region string, hint RegulatoryHint) error
SetRegulatoryRegion sets the system-wide regulatory region used by all nl80211 devices. You may need to call Client.ReloadRegulatoryDatabase first to ensure the region is updated correctly.
region must be an ISO 3166-1 alpha-2 country code (e.g. "GB" or "US"). hint should almost always be RegulatoryHintUser.
See https://wireless.docs.kernel.org/en/latest/en/developers/regulatory/wireless-regdb.html
func (*Client) SetWriteDeadline ¶ added in v0.3.0
SetWriteDeadline sets the write deadline associated with the connection.
func (*Client) StationInfo ¶
func (c *Client) StationInfo(ifi *Interface) ([]*StationInfo, error)
StationInfo retrieves all station statistics about a WiFi interface.
Since v0.2.0: if there are no stations, an empty slice is returned instead of an error.
func (*Client) SurveyInfo ¶ added in v0.4.0
func (c *Client) SurveyInfo(ifi *Interface) ([]*SurveyInfo, error)
SurveyInfo retrieves the survey information about a WiFi interface.
type EHTModulationInfo ¶ added in v0.9.0
type EHTModulationInfo struct {
BaseModulationInfo
GI int
RUAlloc int
}
func (EHTModulationInfo) String ¶ added in v0.9.0
func (mi EHTModulationInfo) String() string
func (EHTModulationInfo) WifiGeneration ¶ added in v0.9.0
func (mi EHTModulationInfo) WifiGeneration() string
type FrequencyAttrs ¶ added in v0.9.0
type FrequencyAttrs struct {
// Frequency is the radio frequency in MHz.
Frequency int
// Disabled indicates that the channel is disabled due to regulatory
// requirements.
Disabled bool
// NoIR indicates that no mechanisms that initiate radiation are
// permitted on this channel.
NoIR bool
// RadarDetection indicates that radar detection is mandatory on this
// channel.
RadarDetection bool
// MaxTxPower gives the maximum transmission power in mBm (100 * dBm).
MaxTxPower float32
}
FrequencyAttrs represents the attributes of a WiFi frequency/channel.
type HEModulationInfo ¶ added in v0.9.0
type HEModulationInfo struct {
BaseModulationInfo
GI int
DCM int
RUAlloc int
}
func (HEModulationInfo) String ¶ added in v0.9.0
func (mi HEModulationInfo) String() string
func (HEModulationInfo) WifiGeneration ¶ added in v0.9.0
func (mi HEModulationInfo) WifiGeneration() string
type HTCapabilities ¶ added in v0.9.0
type HTCapabilities struct {
// Device supports Low Density Parity Check codes.
RxLDPC bool
// Device supports 40MHz channels (in addition to 20MHz channels).
CW40 bool
// Device supports HT Greenfield (802.11n-only) mode, in which a/b/g
// frames will be ignored.
HTGreenfield bool
// Device supports short guard intervals in 20MHz channels.
SGI20 bool
// Device supports short guard intervals in 40MHz channels.
SGI40 bool
// Device supports Space-Time Block Coding transmission.
TxSTBC bool
// Number of STBC receive streams supported by the device. Valid values
// are 0-3.
RxSTBCStreams uint8
// Device supports delayed Block Ack frames when acknowledging an
// A-MPDU.
HTDelayedBlockAck bool
// Device supports long (7935 bytes) maximum A-MSDU length, compared to
// standard 3839 bytes.
LongMaxAMSDULength bool
// Device supports DSSS/CCK in 40MHz channels.
DSSSCCKHT40 bool
// (2.4GHz) Band cannot tolerate 40MHz channels because someone has
// requested it support 20MHz channels.
FortyMhzIntolerant bool
// Device supports L-SIG (non-HT) Transmit Oppportunity protection.
LSIGTxOPProtection bool
// Maximum receivable A-MPDU (Aggregated MAC Protocol Data Unit) frame
// size.
MaxRxAMPDULength int
// Supported MCS for HT mode
// Todo:
// - Parse them are according to Section 7.3.2.56.4 IEEE 80211n
SupportedMCS [16]byte
}
HTCapabilities represents 802.11n (High Throughput) capabilities. This group of attributes is specific to each band of frequencies. Failure to support any given attribute may be due to lack support in the driver or the firmware, not only in the hardware. Some of them may also be overridden during station association.
The fields represent those in the HT Capabilities element (802.11-2016, 9.4.2.56). Notably missing is information about the device's Spatial Multiplexing Power Save (SMPS) capability. SMPS support must be determined by retrieving the device feature flags (not yet supported).
type HTModulationInfo ¶ added in v0.9.0
type HTModulationInfo struct {
BaseModulationInfo
HTMCS int
ShortGI bool
}
HTModulationInfo represents modulation information for HT rates. MCS Indexes originally range from 0 to 31. NSS is coded in the MCS index as follows: NSS = (MCS / 8) + 1 MCS = MCS % 8 original MCS index is available as HTMCS
func (HTModulationInfo) HasShortGI ¶ added in v0.9.0
func (mi HTModulationInfo) HasShortGI() bool
func (HTModulationInfo) String ¶ added in v0.9.0
func (mi HTModulationInfo) String() string
func (HTModulationInfo) WifiGeneration ¶ added in v0.9.0
func (mi HTModulationInfo) WifiGeneration() string
type Interface ¶
type Interface struct {
// The index of the interface.
Index int
// The name of the interface.
Name string
// The hardware address of the interface.
HardwareAddr net.HardwareAddr
// The physical device that this interface belongs to.
PHY int
// The virtual device number of this interface within a PHY.
Device int
// The operating mode of the interface.
Type InterfaceType
// The interface's wireless frequency in MHz.
Frequency int
// The interface's wireless channel width.
ChannelWidth ChannelWidth
}
An Interface is a WiFi network interface.
type InterfaceCombination ¶ added in v0.9.0
type InterfaceCombination struct {
CombinationLimits []InterfaceCombinationLimit
// Total is the maximum number of interfaces that can be created in this
// group.
Total int
// NumChannels is the number of different channels which may be used in
// this group.
NumChannels int
// StaApBiMatch indicates that beacon intervals within this group must
// all be the same, regardless of interface type.
StaApBiMatch bool
}
InterfaceCombination represents a group of valid combinations of interface types which can be simultaneously supported on a device.
type InterfaceCombinationLimit ¶ added in v0.9.0
type InterfaceCombinationLimit struct {
InterfaceTypes []InterfaceType
// Max is the maximum number of interfaces that can be chosen from the
// set of interface types in InterfaceTypes.
Max int
}
InterfaceCombinationLimit represents a single combination of interface types which may be run simultaneously on a device.
type InterfaceType ¶
type InterfaceType int
An InterfaceType is the operating mode of an Interface.
const ( // InterfaceTypeUnspecified indicates that an interface's type is unspecified // and the driver determines its function. InterfaceTypeUnspecified InterfaceType = iota // InterfaceTypeAdHoc indicates that an interface is part of an independent // basic service set (BSS) of client devices without a controlling access // point. InterfaceTypeAdHoc // InterfaceTypeStation indicates that an interface is part of a managed // basic service set (BSS) of client devices with a controlling access point. InterfaceTypeStation // InterfaceTypeAP indicates that an interface is an access point. InterfaceTypeAP // InterfaceTypeAPVLAN indicates that an interface is a VLAN interface // associated with an access point. InterfaceTypeAPVLAN // InterfaceTypeWDS indicates that an interface is a wireless distribution // interface, used as part of a network of multiple access points. InterfaceTypeWDS // InterfaceTypeMonitor indicates that an interface is a monitor interface, // receiving all frames from all clients in a given network. InterfaceTypeMonitor // InterfaceTypeMeshPoint indicates that an interface is part of a wireless // mesh network. InterfaceTypeMeshPoint // InterfaceTypeP2PClient indicates that an interface is a client within // a peer-to-peer network. InterfaceTypeP2PClient // InterfaceTypeP2PGroupOwner indicates that an interface is the group // owner within a peer-to-peer network. InterfaceTypeP2PGroupOwner // InterfaceTypeP2PDevice indicates that an interface is a device within // a peer-to-peer client network. InterfaceTypeP2PDevice // InterfaceTypeOCB indicates that an interface is outside the context // of a basic service set (BSS). InterfaceTypeOCB // InterfaceTypeNAN indicates that an interface is part of a near-me // area network (NAN). InterfaceTypeNAN )
func (InterfaceType) String ¶
func (t InterfaceType) String() string
String returns the string representation of an InterfaceType.
type PHY ¶ added in v0.9.0
type PHY struct {
// The index of the interface.
Index int
// The name of the interface.
Name string
// The interface types this device supports.
SupportedIftypes []InterfaceType
// The software-only interface types this device supports.
SoftwareIftypes []InterfaceType
// An array of attributes related to each radio frequency band.
BandAttributes []BandAttributes
// A description of what combinations of interfaces the device can
// support running simultaneously, on virtual MACs.
InterfaceCombinations []InterfaceCombination
// All the attributes the kernel has told us about, but we haven't
// parsed.
Extra map[uint16][]byte
}
A PHY represents the physical attributes of a wireless device.
type RSNAKM ¶ added in v0.6.0
type RSNAKM uint32
RSNAKM represents an Authentication and Key Management suite in RSN IE. Values correspond to OUIs (00-0F-AC-XX) in the wire format as defined in IEEE 802.11-2020 standard, section 9.4.2.24.3 (AKM Suites).
const ( RSNAkmReserved0 RSNAKM = 0x000FAC00 // Reserved RSNAkm8021X RSNAKM = 0x000FAC01 // 802.1X (WPA-Enterprise) RSNAkmPSK RSNAKM = 0x000FAC02 // PSK (WPA2-Personal) RSNAkmFT8021X RSNAKM = 0x000FAC03 // FT-802.1X (Fast BSS transition with EAP) RSNAkmFTPSK RSNAKM = 0x000FAC04 // FT-PSK (Fast BSS transition with PSK) RSNAkm8021XSHA256 RSNAKM = 0x000FAC05 // 802.1X-SHA256 (WPA2 with SHA256 auth) RSNAkmPSKSHA256 RSNAKM = 0x000FAC06 // PSK-SHA256 (WPA2-PSK with SHA256) RSNAkmTDLS RSNAKM = 0x000FAC07 // TDLS TPK handshake RSNAkmSAE RSNAKM = 0x000FAC08 // SAE (WPA3-Personal) RSNAkmFTSAE RSNAKM = 0x000FAC09 // FT-SAE (WPA3-Personal with Fast Roaming) RSNAkmAPPeerKey RSNAKM = 0x000FAC0A // APPeerKey Authentication with SHA-256 RSNAkm8021XSuiteB RSNAKM = 0x000FAC0B // 802.1X using Suite B compliant EAP (SHA-256) RSNAkm8021XCNSA RSNAKM = 0x000FAC0C // 802.1X using CNSA Suite compliant EAP (SHA-384) RSNAkmFT8021XSHA384 RSNAKM = 0x000FAC0D // FT-802.1X using SHA-384 RSNAkmFILSSHA256 RSNAKM = 0x000FAC0E // FILS key management using SHA-256 RSNAkmFILSSHA384 RSNAKM = 0x000FAC0F // FILS key management using SHA-384 RSNAkmFTFILSSHA256 RSNAKM = 0x000FAC10 // FT authentication over FILS with SHA-256 RSNAkmFTFILSSHA384 RSNAKM = 0x000FAC11 // FT authentication over FILS with SHA-384 RSNAkmReserved18 RSNAKM = 0x000FAC12 // Reserved RSNAkmFTPSKSHA384 RSNAKM = 0x000FAC13 // FT-PSK using SHA-384 RSNAkmPSKSHA384 RSNAKM = 0x000FAC14 // PSK using SHA-384 )
RSN AKM suite constants (Wi-Fi Alliance OUI: 00-0F-AC)
type RSNCipher ¶ added in v0.6.0
type RSNCipher uint32
RSNCipher represents a cipher suite in RSN IE. Values correspond to OUIs (00-0F-AC-XX) in the wire format as defined in IEEE 802.11-2020 standard, section 9.4.2.24.2 (Cipher Suites).
const ( RSNCipherUseGroup RSNCipher = 0x000FAC00 // Use group cipher suite RSNCipherWEP40 RSNCipher = 0x000FAC01 // WEP-40 (insecure, legacy) RSNCipherTKIP RSNCipher = 0x000FAC02 // TKIP (insecure, deprecated) RSNCipherReserved3 RSNCipher = 0x000FAC03 // Reserved RSNCipherCCMP128 RSNCipher = 0x000FAC04 // CCMP-128 (AES) - WPA2 RSNCipherWEP104 RSNCipher = 0x000FAC05 // WEP-104 (insecure, legacy) RSNCipherBIPCMAC128 RSNCipher = 0x000FAC06 // BIP-CMAC-128 (802.11w MFP/PMF) RSNCipherGroupNotAllowed RSNCipher = 0x000FAC07 // Group addressed traffic not allowed RSNCipherGCMP128 RSNCipher = 0x000FAC08 // GCMP-128 (AES-GCMP) - WPA3 RSNCipherGCMP256 RSNCipher = 0x000FAC09 // GCMP-256 (AES-GCMP) - WPA3-Enterprise RSNCipherCCMP256 RSNCipher = 0x000FAC0A // CCMP-256 (AES, 256-bit key) RSNCipherBIPGMAC128 RSNCipher = 0x000FAC0B // BIP-GMAC-128 RSNCipherBIPGMAC256 RSNCipher = 0x000FAC0C // BIP-GMAC-256 RSNCipherBIPCMAC256 RSNCipher = 0x000FAC0D // BIP-CMAC-256 )
type RSNInfo ¶ added in v0.6.0
type RSNInfo struct {
Version uint16
GroupCipher RSNCipher // Group cipher suite
PairwiseCiphers []RSNCipher // Pairwise cipher suites
AKMs []RSNAKM // Authentication and Key Management suites
Capabilities uint16 // RSN capability flags
GroupMgmtCipher RSNCipher // Group management cipher (present only with WPA3/802.11w)
}
Robust Security Network Information Element The RSN IE structure is defined in IEEE 802.11-2020 standard, section 9.4.2.24 (page 1051) .
func (RSNInfo) IsInitialized ¶ added in v0.6.0
type RateInfo ¶ added in v0.9.0
type RateInfo struct {
// Bitrate in 100 kbit/s units (nl80211 rate_info convention).
// For example, 867 means 86.7 MBit/s.
Bitrate int
// The type of modulation used. Can also be inferred from Modulation.(type)
ModulationType RateModulationInfoType
// Modulation information.
Modulation RateModulationInfo
// Channel width used for this rate.
ChannelWidth ChannelWidth
}
rateInfo provides information about the receive or transmit rate of an interface.
type RateModulationInfo ¶ added in v0.9.0
type RateModulationInfo interface {
// MCS is the modulation and coding scheme index.
GetMCS() int
// NSS is the number of spatial streams.
GetNSS() int
// String returns a human-readable description of the modulation info.
// Format is more verbose and includes all relevant information.
String() string
// WifiGeneration returns the WiFi generation (e.g., "802.11n (WiFi 4)", "802.11ac (WiFi 5)", "802.11ax (WiFi 6)", "802.11be (WiFi 7)")
WifiGeneration() string
// HasShortGI reports whether this modulation currently uses short guard interval.
HasShortGI() bool
// contains filtered or unexported methods
}
RateModulationInfo is implemented by modulation types in this package. External implementations are not supported.
type RateModulationInfoType ¶ added in v0.9.0
type RateModulationInfoType int
RateModulationInfoType indicates the type of modulation used for a rate.
const ( RateModulationInfoTypeHT RateModulationInfoType = iota RateModulationInfoTypeVHT RateModulationInfoTypeHE RateModulationInfoTypeEHT RateModulationInfoTypeLegacy RateModulationInfoTypeUNKNOWN )
type RegulatoryDomain ¶ added in v0.8.0
type RegulatoryDomain struct {
Region string // ISO 3166-1 alpha-2 country code
}
RegulatoryDomain contains information about the regulatory domain the device or system operates in.
type RegulatoryHint ¶ added in v0.8.0
type RegulatoryHint uint32
RegulatoryHint describes why the regulatory region is being set. See: - https://wireless.docs.kernel.org/en/latest/en/developers/regulatory/processing_rules.html#cellular-base-station-regulatory-hints - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/nl80211.h?h=a55f7f5f29b32c2c53cc291899cf9b0c25a07f7c#n4803
const ( RegulatoryHintUser RegulatoryHint = 0x0 // Set by the userspace (default) RegulatoryHintCellBase RegulatoryHint = 0x1 // Set based on cellular network information RegulatoryHintIndoor RegulatoryHint = 0x2 // Set because the device is indoors )
type StationInfo ¶
type StationInfo struct {
// The interface that this station is associated with.
InterfaceIndex int
// The hardware address of the station.
HardwareAddr net.HardwareAddr
// The time since the station last connected.
Connected time.Duration
// The time since wireless activity last occurred.
Inactive time.Duration
// The number of bytes received by this station.
ReceivedBytes int
// The number of bytes transmitted by this station.
TransmittedBytes int
// The number of packets received by this station.
ReceivedPackets int
// The number of packets transmitted by this station.
TransmittedPackets int
// The current data receive bitrate, in bits/second.
ReceiveBitrate int
// The current data transmit bitrate, in bits/second.
TransmitBitrate int
// The signal strength of the last received PPDU, in dBm.
Signal int
// The average signal strength, in dBm.
SignalAverage int
// The number of times the station has had to retry while sending a packet.
TransmitRetries int
// The number of times a packet transmission failed.
TransmitFailed int
// The number of times a beacon loss was detected.
BeaconLoss int
// The current receive rate and detailed modulation information.
ReceiveRateInfo RateInfo
// The current transmit rate and detailed modulation information.
TransmitRateInfo RateInfo
}
StationInfo contains statistics about a WiFi interface operating in station mode.
func ParseStationInfo ¶ added in v0.7.0
func ParseStationInfo(b []byte) (*StationInfo, error)
ParseStationInfo parses StationInfo attributes from a byte slice of netlink attributes.
type SurveyInfo ¶ added in v0.4.0
type SurveyInfo struct {
// The interface that this station is associated with.
InterfaceIndex int
// The frequency in MHz of the channel.
Frequency int
// The noise level in dBm.
Noise int
// The time the radio has spent on this channel.
ChannelTime time.Duration
// The time the radio has spent on this channel while it was active.
ChannelTimeActive time.Duration
// The time the radio has spent on this channel while it was busy.
ChannelTimeBusy time.Duration
// The time the radio has spent on this channel while it was busy with external traffic.
ChannelTimeExtBusy time.Duration
// The time the radio has spent on this channel receiving data from a BSS.
ChannelTimeBssRx time.Duration
// The time the radio has spent on this channel receiving data.
ChannelTimeRx time.Duration
// The time the radio has spent on this channel transmitting data.
ChannelTimeTx time.Duration
// The time the radio has spent on this channel while it was scanning.
ChannelTimeScan time.Duration
// Indicates if the channel is currently in use.
InUse bool
}
type VHTCapabilities ¶ added in v0.9.0
type VHTCapabilities struct {
// Maximum MPDU length supported by the device.
MaxMPDULength int
// Device supports 160MHz channel width.
VHT160 bool
// Device supports 80+80MHz channel width (non-contiguous 160MHz) along with 160MHz channel.
VHT8080 bool
// Device supports receiving Low Density Parity Check codes.
RXLDPC bool
// Device supports short guard intervals in 80MHz channels.
ShortGI80 bool
// Device supports short guard intervals in 160MHz and 80+80MHz channels.
ShortGI160 bool
// Device supports transmission of at least 2x1 Space-Time Block Coding transmission.
TXSTBC bool
// Number of STBC receive streams supported by the device. Valid values are 0-4.
RXSTBC int
// Device supports SU (Single User) Beamforming as a transmitter.
SuBeamFormer bool
// Device supports SU (Single User) Beamforming as a receiver.
SuBeamFormee bool
// Number of sounding antennas supported by the device for SU Beamforming transmission.
BFAntenna int
// Maximum sounding dimensions supported by the device for SU Beamforming.
SoundingDimension int
// Device supports MU (Multi-User) Beamforming as a transmitter.
MuBeamformer bool
// Device supports MU (Multi-User) Beamforming as a receiver.
MuBeamformee bool
// Device supports VHT TXOP power save mode.
VTHTXOPPS bool
// Device supports HT Control field when operating in VHT mode.
HTCVHT bool
// Maximum A-MPDU (Aggregated MAC Protocol Data Unit) frame size supported by the device.
MaxAMPDU int
// Device supports VHT Link Adaptation capabilities. Valid values
// specify the type of link adaptation supported (e.g., no feedback,
// unsolicited feedback, or both).
VHTLinkAdapt int
// Device supports receive antenna pattern consistency.
RXAntennaPattern bool
// Device supports transmit antenna pattern consistency.
TXAntennaPattern bool
//Indicates whether the STA is capable of interpreting the Extended NSS BW
//Support subfield of the VHT Capabilities Information field.
ExtendedNSSBW int
// Supported MCS for VHT mode
// Todo:
// - Parse them according to Section 8.4.2.160.3 IEEE Std 80211ac-2013
SupportedMCS [8]byte
}
VHTCapabilities represents 802.11ac (Very High Throughput) capabilities.
The fields represent those in the VHT Capabilities element (802.11-2020, 9.4.2.157).
type VHTModulationInfo ¶ added in v0.9.0
type VHTModulationInfo struct {
BaseModulationInfo
ShortGI bool
}
VHTModulationInfo represents modulation information for VHT rates.
func (VHTModulationInfo) HasShortGI ¶ added in v0.9.0
func (mi VHTModulationInfo) HasShortGI() bool
func (VHTModulationInfo) String ¶ added in v0.9.0
func (mi VHTModulationInfo) String() string
func (VHTModulationInfo) WifiGeneration ¶ added in v0.9.0
func (mi VHTModulationInfo) WifiGeneration() string