gowol

package module
v0.0.0-...-797e4d0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2018 License: MIT Imports: 2 Imported by: 15

README

Introduction

GoDoc

gowol is a library which provides an easy way to do Wake-on-LAN from your Go application.

The primary goal of gowol is to provide an abstraction which enables you to easily send Wake-on-LAN packets. It supports creation and dispatching of Wake-on-LAN packets of the provided MAC to the provided IP(and port).

Example usage

package main

import "github.com/linde12/gowol"

func main() {
	if packet, err := gowol.NewMagicPacket("03:AA:FF:67:64:05"); err == nil {
		packet.Send("255.255.255.255")          // send to broadcast
		packet.SendPort("255.255.255.255", "7") // specify receiving port
	}
}

Installation

go get github.com/linde12/gowol

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MagicPacket

type MagicPacket [102]byte

MagicPacket is a slice of 102 bytes containing the magic packet data.

func NewMagicPacket

func NewMagicPacket(macAddr string) (packet MagicPacket, err error)

NewMagicPacket allocates a new MagicPacket with the specified MAC.

func (MagicPacket) Send

func (mp MagicPacket) Send(addr string) error

Send writes the MagicPacket to the specified address on port 9.

func (MagicPacket) SendPort

func (mp MagicPacket) SendPort(addr string, port string) error

SendPort writes the MagicPacket to the specified address and port.

Jump to

Keyboard shortcuts

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