tplink

command module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: MIT Imports: 1 Imported by: 0

README ¶

🔰 About

tplink provides a minimal CLI (implemented in Golang) for interacting with a TP Link Archer C9v1 home wifi router. My goals with this project were to:

  • learn how to write a basic API client in Golang
  • learn how to write a basic command-line interface in Golang
  • cross-compile the tplink application to run on a Raspberry Pi 3

🔌 Installation

go get -u github.com/aculclasure/tplink

This installs the tplink binary in your $GOPATH/bin location and installs the entire tplink module in your $GOPATH/go/pkg/mod location.

âš¡ Usage

$ tplink --help

tplink is a CLI app that provides a very minimal admin interface to a TP Link
Archer C9 V1 home wifi router. This app allows a user to retrieve information
about connected clients on the router and to also reboot the router.

Usage:
  tplink [command]

Available Commands:
  help        Help about any command
  list        lists information about the router
  reboot      reboots the router
  version     displays the version and exits

Flags:
  -h, --help   help for tplink

Use "tplink [command] --help" for more information about a command.

Example: Listing connected wireless clients

$ tplink list wirelessClients --help
wirelessClients queries the wifi router to get the currently connected wireless clients and
prints out the IP address, MAC address, and host name (if known) for each wireless client.

Usage:
  tplink list wirelessClients [flags]

Flags:
  -h, --help   help for wirelessClients

Global Flags:
  -P, --password string   router admin password (required) (default "admin")
      --url string        router URL (required) (default "http://192.168.168.1")
  -U, --user string       router admin user name (required) (default "admin")


$ tplink list wirelessClients --url http://some-tp-link-router --user <ROUTER-USER-NAME> --password <ROUTER-PASSWORD>
INFO: 2020/09/12 14:18:25 connections.go:67: sending request to get wireless connections as (POST http://some-tp-link-rtr/data/map_access_wireless_client_grid.json) ...
IP_ADDRESS         MAC_ADDRESS           HOST_NAME      
10.100.100.100     12-34-56-AA-BB-CC     FakeHost
10.100.100.55      1A-1A-1A-AA-AA-AA     Unknown         

One of the cool things I learned about Go when working on this project is that it supports cross-compilation for a number of different target architectures right out of the box! To produce a binary that will work on a Raspberry Pi 3, you can do this:

$ env GOOS=linux GOARCH=arm GOARM=6 go build

📄 Resources

Documentation ¶

Overview ¶

Copyright © 2020 Andrew Culclasure

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories ¶

Path Synopsis
Package archerc9v1 provides client logic for interacting with the TP Link Archer C9 V1 wifi router.
Package archerc9v1 provides client logic for interacting with the TP Link Archer C9 V1 wifi router.

Jump to

Keyboard shortcuts

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