mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-05-23 00:15:19 +03:00
Implements Wake On Lan and management features (#164)
This commit is contained in:
parent
037a6c56d3
commit
0224e1f137
12 changed files with 638 additions and 21 deletions
24
model/wake_on_lan_host.go
Normal file
24
model/wake_on_lan_host.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type WakeOnLanHost struct {
|
||||
MacAddress string `json:"MacAddress"`
|
||||
Name string `json:"Name"`
|
||||
LatestUsed *time.Time `json:"LatestUsed"`
|
||||
}
|
||||
|
||||
func (host WakeOnLanHost) ResolveResourceName() (string, error) {
|
||||
resourceName := strings.Trim(host.MacAddress, " \t\r\n\000")
|
||||
if len(resourceName) == 0 {
|
||||
return "", errors.New("mac Address is Empty")
|
||||
}
|
||||
resourceName = strings.ToUpper(resourceName)
|
||||
return strings.ReplaceAll(resourceName, ":", "-"), nil
|
||||
}
|
||||
|
||||
const WakeOnLanHostCollectionName = "wake_on_lan_hosts"
|
Loading…
Add table
Add a link
Reference in a new issue