Mercurial > mercurial > hgweb_golang.cgi
comparison src/magicpacket.go @ 39:523416ca4b83
diet magicpacket.go
| author | pyon@macmini |
|---|---|
| date | Tue, 04 Feb 2020 21:31:50 +0900 |
| parents | 90659c7171ed |
| children | c6df3bae683e |
comparison
equal
deleted
inserted
replaced
| 38:05bdd37e3000 | 39:523416ca4b83 |
|---|---|
| 8 "os" | 8 "os" |
| 9 ) | 9 ) |
| 10 | 10 |
| 11 func main() { | 11 func main() { |
| 12 if len(os.Args) < 2 { | 12 if len(os.Args) < 2 { |
| 13 fmt.Fprintln(os.Stderr, "wol mac-address1 mac-address2 ...") | 13 fmt.Fprintln(os.Stderr, "magicpacket mac-address1 mac-address2 ...") |
| 14 os.Exit(1) | 14 os.Exit(1) |
| 15 } | 15 } |
| 16 for i, m := range os.Args { | 16 for _, mac := range os.Args[1:] { |
| 17 if i == 0 { | 17 hw, err := net.ParseMAC(mac) |
| 18 continue | |
| 19 } | |
| 20 hw, err := net.ParseMAC(m) | |
| 21 if err != nil { | 18 if err != nil { |
| 22 log.Fatal(err) | 19 log.Fatal(err) |
| 23 } | 20 } |
| 24 | 21 |
| 25 b := [][]byte{bytes.Repeat([]byte{255}, 6), bytes.Repeat([]byte(hw), 16)} | 22 b := [][]byte{bytes.Repeat([]byte{255}, 6), bytes.Repeat([]byte(hw), 16)} |
