### List All Aliases Source: https://context7.com/xaner4/gowakeup/llms.txt Displays all configured device aliases and their corresponding MAC addresses. If no aliases are set, it provides instructions on how to add one. ```bash gowakeup alias ``` -------------------------------- ### Wake Device by Alias Source: https://context7.com/xaner4/gowakeup/llms.txt Wake a device using a pre-configured alias. Ensure the alias is added using the 'alias add' command. ```bash gowakeup wake my-desktop ``` -------------------------------- ### Build Application via Makefile Source: https://context7.com/xaner4/gowakeup/llms.txt Cross-compiles the application for various platforms using the provided Makefile. ```bash # Build for Linux (amd64) make linux # Build for Windows (amd64) make windows # Build for macOS (amd64) make darwin # Build for Raspberry Pi (ARM) make pi_linux # Build all platforms make all # Clean build artifacts make clean ``` -------------------------------- ### Wake up a device using Gowakeup Source: https://github.com/xaner4/gowakeup/blob/master/README.md Sends a magic packet to the specified device identified by its MAC address or alias. ```bash gowakeup wake ``` -------------------------------- ### Add New Alias Source: https://context7.com/xaner4/gowakeup/llms.txt Creates a new alias for a device, mapping a friendly name to its MAC address. The alias is saved to `alias.json`. ```bash gowakeup alias add my-desktop AA:BB:CC:DD:EE:FF ``` ```bash gowakeup alias add homelab-server 11:22:33:44:55:66 ``` ```bash gowakeup alias add gaming-pc 12-34-56-78-9A-BC ``` -------------------------------- ### wol.CreateMagicPacket Source: https://context7.com/xaner4/gowakeup/llms.txt Generates a standard Wake-on-LAN magic packet from a given MAC address string. ```APIDOC ## wol.CreateMagicPacket ### Description Creates a Wake-on-LAN magic packet from a MAC address. The magic packet consists of 6 bytes of 0xFF followed by the MAC address repeated 16 times. Supports both colon and hyphen delimiters in MAC addresses. ### Parameters - **macAddress** (string) - Required - The MAC address of the target device (e.g., "12:34:56:78:9A:BC" or "AA-BB-CC-DD-EE-FF"). ### Response - **packet** ([]byte) - The generated magic packet bytes. - **err** (error) - Returns an error if the provided MAC address format is invalid. ``` -------------------------------- ### Wake Device by MAC Address Source: https://context7.com/xaner4/gowakeup/llms.txt Use this command to send a magic packet to a device using its MAC address. Supports both colon and hyphen separated formats. ```bash gowakeup wake 12:34:56:78:9A:BC ``` ```bash gowakeup wake 12-34-56-78-9A-BC ``` -------------------------------- ### Create Wake-on-LAN Magic Packet Source: https://context7.com/xaner4/gowakeup/llms.txt Generates a Wake-on-LAN magic packet from a given MAC address. Supports both colon and hyphen delimiters. The packet is 102 bytes long. ```go package main import ( "fmt" "gitlab.com/xaner4/gowakeup/pkg/wol" ) func main() { // Create magic packet with colon-separated MAC packet, err := wol.CreateMagicPacket("12:34:56:78:9A:BC") if err != nil { fmt.Printf("Error: %v\n", err) // Output: Error: "invalid" is not a MAC address return } fmt.Printf("Magic packet created: %d bytes\n", len(packet)) // Output: Magic packet created: 102 bytes // Also works with hyphen-separated MAC addresses packet2, err := wol.CreateMagicPacket("AA-BB-CC-DD-EE-FF") if err != nil { fmt.Printf("Error: %v\n", err) return } fmt.Printf("Magic packet created: %d bytes\n", len(packet2)) // Output: Magic packet created: 102 bytes } ``` -------------------------------- ### Check Alias Existence in Go Source: https://context7.com/xaner4/gowakeup/llms.txt Verifies if an alias exists by name or MAC address. Returns a boolean and the index of the alias in the slice. ```go package main import ( "fmt" "gitlab.com/xaner4/gowakeup/pkg/alias" ) func main() { // Check by alias name exists, index := alias.Exists("my-server", "") if exists { fmt.Printf("Found alias at index %d\n", index) fmt.Printf("MAC: %s\n", alias.Aliases[index].Mac) } // Check by MAC address exists, index = alias.Exists("", "AA:BB:CC:DD:EE:FF") if exists { fmt.Printf("Found alias: %s\n", alias.Aliases[index].Name) } } ``` -------------------------------- ### Wake Device with Custom IP and Port Source: https://context7.com/xaner4/gowakeup/llms.txt Specify a custom IP address and port for sending the wake packet. Useful for directed broadcasts or non-standard WoL ports. ```bash gowakeup wake 12:34:56:78:9A:BC --ip 192.168.1.255 ``` ```bash gowakeup wake 12:34:56:78:9A:BC --port 7 ``` ```bash gowakeup wake my-server -i 10.0.0.255 -p 9 ``` -------------------------------- ### Add Alias in Go Source: https://context7.com/xaner4/gowakeup/llms.txt Adds a new alias to the in-memory list and persists it to disk. Returns an error if the alias name or MAC address already exists. ```go package main import ( "fmt" "gitlab.com/xaner4/gowakeup/pkg/alias" ) func main() { // Add a new alias err := alias.Add("my-server", "AA:BB:CC:DD:EE:FF") if err != nil { fmt.Printf("Error: %v\n", err) // Output: Error: alias my-server or mac address AA:BB:CC:DD:EE:FF already exists as an alias return } // Persist to disk err = alias.Write() if err != nil { fmt.Printf("Failed to save: %v\n", err) return } fmt.Println("Alias saved successfully") } ``` -------------------------------- ### Alias Add Source: https://context7.com/xaner4/gowakeup/llms.txt Adds a new alias to the in-memory alias list. Returns an error if the alias name or MAC address already exists. ```APIDOC ## Alias Add ### Description Adds a new alias to the in-memory alias list. Returns an error if the alias name or MAC address already exists. ### Parameters - **name** (string) - Required - The alias name to add. - **mac** (string) - Required - The MAC address associated with the alias. ### Request Example alias.Add("my-server", "AA:BB:CC:DD:EE:FF") ``` -------------------------------- ### Alias Exists Source: https://context7.com/xaner4/gowakeup/llms.txt Checks if an alias exists by name or MAC address. Returns a boolean indicating existence and the index in the Aliases slice. ```APIDOC ## Alias Exists ### Description Checks if an alias exists by name or MAC address. Returns a boolean indicating existence and the index in the Aliases slice. ### Parameters - **name** (string) - Optional - The alias name to search for. - **mac** (string) - Optional - The MAC address to search for. ### Response - **exists** (bool) - Indicates if the alias was found. - **index** (int) - The index of the alias in the internal slice. ``` -------------------------------- ### wol.SendMagicPacket Source: https://context7.com/xaner4/gowakeup/llms.txt Transmits a previously generated magic packet to a target IP address and port via UDP. ```APIDOC ## wol.SendMagicPacket ### Description Sends a magic packet to the specified IP address and port via UDP. Typically uses the broadcast address (255.255.255.255) on port 9 to reach all devices on the local network. ### Parameters - **packet** ([]byte) - Required - The magic packet byte slice generated by CreateMagicPacket. - **ip** (string) - Required - The destination IP address or broadcast address. - **port** (int) - Required - The destination UDP port (default is 9). ### Response - **err** (error) - Returns an error if the packet transmission fails. ``` -------------------------------- ### Send Wake-on-LAN Magic Packet Source: https://context7.com/xaner4/gowakeup/llms.txt Transmits a pre-generated magic packet over UDP to a specified IP address and port. Defaults to broadcast address 255.255.255.255 and port 9. ```go package main import ( "fmt" "gitlab.com/xaner4/gowakeup/pkg/wol" ) func main() { // Create the magic packet first packet, err := wol.CreateMagicPacket("12:34:56:78:9A:BC") if err != nil { fmt.Printf("Failed to create packet: %v\n", err) return } // Send to broadcast address on default WoL port 9 err = wol.SendMagicPacket(packet, "255.255.255.255", 9) if err != nil { fmt.Printf("Failed to send packet: %v\n", err) return } fmt.Println("Magic packet sent successfully") // Output: Magic packet sent successfully // Send to a specific subnet broadcast err = wol.SendMagicPacket(packet, "192.168.1.255", 9) if err != nil { fmt.Printf("Failed to send packet: %v\n", err) return } fmt.Println("Packet sent to subnet") // Output: Packet sent to subnet } ``` -------------------------------- ### Remove Alias in Go Source: https://context7.com/xaner4/gowakeup/llms.txt Removes an alias from the in-memory list by name or MAC address. Requires a call to Write() to persist changes. ```go package main import ( "fmt" "gitlab.com/xaner4/gowakeup/pkg/alias" ) func main() { // Remove by alias name err := alias.Remove("my-server", "") if err != nil { fmt.Printf("Error: %v\n", err) // Output: Error: The alias 'my-server' or mac '' does not exists return } // Persist the removal alias.Write() fmt.Println("Alias removed successfully") } ``` -------------------------------- ### Remove Alias by Name or MAC Source: https://context7.com/xaner4/gowakeup/llms.txt Deletes an existing alias. You can specify the alias by its name or its associated MAC address. The `alias.json` file is updated. ```bash gowakeup alias remove my-desktop ``` ```bash gowakeup alias remove AA:BB:CC:DD:EE:FF ``` -------------------------------- ### Alias Remove Source: https://context7.com/xaner4/gowakeup/llms.txt Removes an alias from the in-memory list by name or MAC address. ```APIDOC ## Alias Remove ### Description Removes an alias from the in-memory list by name or MAC address. Call Write() afterward to persist the change. ### Parameters - **name** (string) - Optional - The alias name to remove. - **mac** (string) - Optional - The MAC address to remove. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.