new: new wifi.ap.ttl and wifi.sta.ttl parameters

This commit is contained in:
evilsocket 2019-09-07 17:53:59 +02:00
commit 32e1bf8a7b
No known key found for this signature in database
GPG key ID: 82E42E7F3B34C97E
2 changed files with 24 additions and 5 deletions

View file

@ -32,6 +32,8 @@ type WiFiModule struct {
region string
txPower int
minRSSI int
apTTL int
staTTL int
channel int
hopPeriod time.Duration
hopChanges chan bool
@ -63,6 +65,8 @@ func NewWiFiModule(s *session.Session) *WiFiModule {
SessionModule: session.NewSessionModule("wifi", s),
iface: s.Interface,
minRSSI: -200,
apTTL: 300,
staTTL: 300,
channel: 0,
stickChan: 0,
hopPeriod: 250 * time.Millisecond,
@ -185,6 +189,14 @@ func NewWiFiModule(s *session.Session) *WiFiModule {
mod.AddHandler(assoc)
mod.AddParam(session.NewIntParameter("wifi.ap.ttl",
"300",
"Seconds of inactivity for an access points to be considered not in range anymore."))
mod.AddParam(session.NewIntParameter("wifi.sta.ttl",
"300",
"Seconds of inactivity for a client station to be considered not in range or not connected to its access point anymore."))
mod.AddParam(session.NewStringParameter("wifi.region",
"",
"",
@ -354,6 +366,12 @@ func (mod *WiFiModule) Configure() error {
var hopPeriod int
var err error
if err, mod.apTTL = mod.IntParam("wifi.ap.ttl"); err != nil {
return err
} else if err, mod.staTTL = mod.IntParam("wifi.sta.ttl"); err != nil {
return err
}
if err, mod.region = mod.StringParam("wifi.region"); err != nil {
return err
} else if err, mod.txPower = mod.IntParam("wifi.txpower"); err != nil {