go-wol: Wake on LAN in Go

p2p_network_compgo-wol is Wake on LAN packet generator written in Go. Wol on LAN (WOL) is a data link layer protocol to wake up systems remotely by sending a magic packet to the network card. Note that WOL should be supported by the hardware. Normally there is a setting in system BIOS to enable or disable WOL.

The WOL enabled device listens for a magic packet with its MAC address encoded in WOL scheme. As the protocol works in the data link layer, IP address is irrelevant. The magic packet has 6 bytes of 0xff followed by 16 repetitions of the target device’s MAC address (total of 102 bytes). go-wol generates this magic packet with the MAC address provided by the user and sends it out as a UDP broadcast.

Features

  • Wake up devices remotely using WOL
  • Store and manage MAC address aliases

Installation

To install the package you need to have golang packages installed on your device. Run the following commands to install go-wol:

$ sudo apt-get install golang
$ go get github.com/sabhiram/go-wol

Usage

  • Wake up a device
    $ wol wake 00:11:22:aa:bb:cc
  • Store an alias
    $ wol alias skynet 00:11:22:aa:bb:cc

    Aliases are stored in ~/.config/go-wol/aliases

  • Wake up a device using alias
    $ wol wake skynet
  • List aliases
    $ wol list
  • Delete an alias
    $ wol remove skynet
  • Specify broadcast IP and port
    $ wol wake 00:11:22:aa:bb:cc -b 255.255.255.255 -p 7
    OR
    $ wol wake skynet --bcast 255.255.255.255 --port 7

    Default broadcast IP: 255.255.255.255, port: 9

  • Supported MAC address formats
    01-23-45-56-67-89
    89:0A:CD:EF:00:12
    89:0a:cd:ef:00:12
  • Unsupported MAC address formats
    1-2-3-4-5-6
    01 23 45 56 67 89

On GitHub: go-wol

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s