wpa

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package wpa provides a Config type for WPA protected network.

Index

Constants

View Source
const (
	RawPSKLen        = 64
	MinPassphraseLen = 8
	MaxPassphraseLen = 63
)

A PSK should be a string composed with 64 hex digits, or a ASCII passphrase whose length is between 8 and 63 (inclusive).

Variables

This section is empty.

Functions

This section is empty.

Types

type Cipher

type Cipher string

Cipher is the type for specifying WPA cipher algorithms.

const (
	CipherTKIP Cipher = "TKIP"
	CipherCCMP Cipher = "CCMP"
)

Cipher algorithms.

type Config

type Config struct {
	// Embedded base config so we don't have to re-implement credential-related methods.
	base.Config
	// contains filtered or unexported fields
}

Config implements security.Config interface for WPA protected network.

func (*Config) Class

func (c *Config) Class() string

Class returns security class of WPA network.

func (*Config) HostapdConfig

func (c *Config) HostapdConfig() (map[string]string, error)

HostapdConfig returns hostapd config of WPA network.

func (*Config) ShillServiceProperties

func (c *Config) ShillServiceProperties() (map[string]interface{}, error)

ShillServiceProperties returns shill properties of WPA network.

type ConfigFactory

type ConfigFactory struct {
	// contains filtered or unexported fields
}

ConfigFactory holds some Option and provides Gen method to build a new Config.

func NewConfigFactory

func NewConfigFactory(psk string, ops ...Option) *ConfigFactory

NewConfigFactory builds a ConfigFactory with the given Option.

func (*ConfigFactory) Gen

func (f *ConfigFactory) Gen() (security.Config, error)

Gen builds a Config with the given Option stored in ConfigFactory.

type FTModeEnum

type FTModeEnum int

FTModeEnum is the type for specifying WPA Fast Transition modes.

const (
	FTModeNone FTModeEnum = 1 << iota
	FTModePure
	FTModeMixed = FTModeNone | FTModePure
)

Fast Transition modes.

type ModeEnum

type ModeEnum int

ModeEnum is the type for specifying WPA modes.

const (
	ModePureWPA ModeEnum = 1 << iota
	ModePureWPA2
	ModePureWPA3
	ModeMixed     = ModePureWPA | ModePureWPA2
	ModeMixedWPA3 = ModePureWPA2 | ModePureWPA3
)

WPA modes.

type Option

type Option func(*Config)

Option is the function signature used to specify options of Config.

func Ciphers

func Ciphers(ciphers ...Cipher) Option

Ciphers returns an Option which sets the used WPA ciphers in Config.

func Ciphers2

func Ciphers2(ciphers ...Cipher) Option

Ciphers2 returns an Option which sets the used WPA2 ciphers in Config.

func FTMode

func FTMode(ft FTModeEnum) Option

FTMode returns an Option which sets fast transition mode in Config.

func GMKRekeyPeriod

func GMKRekeyPeriod(period int) Option

GMKRekeyPeriod returns an Option which sets time interval in seconds for rekeying GMK in Config.

func GTKRekeyPeriod

func GTKRekeyPeriod(period int) Option

GTKRekeyPeriod returns an Option which sets time interval in seconds for rekeying GTK in Config.

func Mode

func Mode(mode ModeEnum) Option

Mode returns an Option which sets WPA mode in Config.

func PTKRekeyPeriod

func PTKRekeyPeriod(period int) Option

PTKRekeyPeriod returns an Option which sets maximum lifetime in seconds for PTK in Config.

func UseStrictRekey

func UseStrictRekey(use bool) Option

UseStrictRekey returns an Option which sets strict rekey in Config.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL