This commit is contained in:
sm
2016-11-07 23:03:49 -08:00
commit 398e0f5740
3 changed files with 49 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package main
import (
"bufio"
"fmt"
"net"
"os"
)
func Hex(ip net.IP) string {
i := ip.To4()
r := ""
for _, b := range i {
r += fmt.Sprintf("%02X", b)
}
return r
}
func main() {
s := bufio.NewScanner(os.Stdin)
for s.Scan() {
ip := net.ParseIP(s.Text())
fmt.Printf("%+v\n", Hex(ip))
}
}