WIFI-CLI
WIFI CLI is a command line interface to select WIFI networks.
There's two main features:
- AP mode: Select the best wifi channel for your AP.
- Terminal mode: Select the best wifi network.
Install the CLI
go get github.com/Joffref/wifi-cli
Note: You need to have go
installed on your machine.
See golang.org for more information.
You also need to have git
installed on your machine.
See git-scm.com for more information.
Build the CLI from source
git clone https://github.com/Joffref/wifi-cli
cd wifi-cli
make build
Usage
AP mode
Usage:
wifi-cli ap [flags]
Flags:
-a, --AccessPointNumberWeight int AccessPointNumberWeight (default 1)
-r, --CoverageWeight int CoverageWeight (default 1)
-s, --SignalStrengthWeight int SignalStrengthWeight (default 1)
-h, --help help for ap
-i, --interface string wifi interface (default "wlan0")
Terminal mode
Usage:
wifi-cli terminal [flags]
Flags:
-h, --help help for terminal
-i, --interface string wifi interface (default "wlan0")
Using the library
As a library, you can use the ap
and terminal
packages to get the best wifi channel or the best wifi network.
Plus, we define an interface SelectionMiddleware
to define your own selection algorithm or use the included one (coverage
, empty
, number
, signal
).
package ap
type SelectionMiddleware interface {
Select(ScoredChannels map[int]int, UsedChannels map[int]*Channel) (map[int]int, error)
Criteria() string
Name() string
SetWeight(int)
}
Then you can use the ap
package to get the best channel.
package main
import (
"log"
"github.com/Joffref/wifi-cli/ap"
)
func main() {
chain := ap.SelectionChain{
&ap.UnoccupiedChannel{
Weight: ap.Infinite,
},
&ap.AccessPointNumber{
Weight: 1,
},
&ap.Signal{
Weight: 20,
},
&ap.Coverage{
Weight: 100,
},
}
chanel, err := BestChanel(ifname, chain)
if err != nil {
log.Errorf("Error while finding best channel: %v", err)
}
log.Infof("Best channel is %v", chanel)
}
func BestChanel(ifname string, chain ap.SelectionChain) (int, error) {
return ap.FindBestChannel(ifname, chain)
}
To go further
Roadmap
License
This project is licensed under the MIT License - see the LICENSE file for details