]> Git repositories of Izuru Yakumo - mizuchi.git/commitdiff
Mirrored from mizuchi.git master
authorwww <www@d43f0565-c260-b346-bb61-879d4a80ce60>
Sun, 29 Sep 2024 21:29:50 +0000 (21:29 +0000)
committerwww <www@d43f0565-c260-b346-bb61-879d4a80ce60>
Sun, 29 Sep 2024 21:29:50 +0000 (21:29 +0000)
git-svn-id: https://svn.chaotic.ninja/svn/mizuchi-yakumo.izuru@1 d43f0565-c260-b346-bb61-879d4a80ce60

20 files changed:
branches/master/COPYING [new file with mode: 0644]
branches/master/README.md [new file with mode: 0644]
branches/master/cmd/mizuchi-ipapi/main.go [new file with mode: 0644]
branches/master/cmd/mizuchi-ipinfo/main.go [new file with mode: 0644]
branches/master/go.mod [new file with mode: 0644]
branches/origin-master/COPYING [new file with mode: 0644]
branches/origin-master/README.md [new file with mode: 0644]
branches/origin-master/cmd/mizuchi-ipapi/main.go [new file with mode: 0644]
branches/origin-master/cmd/mizuchi-ipinfo/main.go [new file with mode: 0644]
branches/origin-master/go.mod [new file with mode: 0644]
branches/origin/COPYING [new file with mode: 0644]
branches/origin/README.md [new file with mode: 0644]
branches/origin/cmd/mizuchi-ipapi/main.go [new file with mode: 0644]
branches/origin/cmd/mizuchi-ipinfo/main.go [new file with mode: 0644]
branches/origin/go.mod [new file with mode: 0644]
trunk/COPYING [new file with mode: 0644]
trunk/README.md [new file with mode: 0644]
trunk/cmd/mizuchi-ipapi/main.go [new file with mode: 0644]
trunk/cmd/mizuchi-ipinfo/main.go [new file with mode: 0644]
trunk/go.mod [new file with mode: 0644]

diff --git a/branches/master/COPYING b/branches/master/COPYING
new file mode 100644 (file)
index 0000000..b44f774
--- /dev/null
@@ -0,0 +1,13 @@
+Copyright (c) 2023 Izuru Yakumo <postmaster@chaotic.ninja>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
diff --git a/branches/master/README.md b/branches/master/README.md
new file mode 100644 (file)
index 0000000..3da9896
--- /dev/null
@@ -0,0 +1,23 @@
+![](https://raddle.me/submission_images/61e31cb98ba6f807847098560a6b29b2fbdf822069186d2cfe5fa67f747b13f2.gif)
+
+# mizuchi
+The above animated picture says it all. 
+That aside, this was a full port from a shell script that I have never used seriously. 
+
+## Build
+It has two flavors, and have slightly different output.
+
+### For [ip-api.com](https://ip-api.com)
+
+```
+go build ./cmd/mizuchi-ipapi
+```
+
+### For [ipinfo.io](https://ipinfo.io)
+
+```
+go build ./cmd/mizuchi-ipinfo
+```
+
+## Usage
+Only required argument is `-i`
diff --git a/branches/master/cmd/mizuchi-ipapi/main.go b/branches/master/cmd/mizuchi-ipapi/main.go
new file mode 100644 (file)
index 0000000..4e47454
--- /dev/null
@@ -0,0 +1,45 @@
+package main
+
+import (
+       "encoding/json"
+       "flag"
+       "fmt"
+       "net/http"
+)
+type Status struct {
+       Continent string `json:"continent"`
+       Country string `json:"country"`
+       Region string `json:"region"`
+       City string `json:"city"`
+       Zip string `json:"zip"`
+       Latitude string `json:"lat"`
+       Longitude string `json:"lon"`
+       Timezone string `json:"timezone"`
+       Query string `json:"query"`
+}
+const (
+       url = "http://ip-api.com"
+)
+var (
+       ip_addr string
+)
+func init() {
+       flag.StringVar(&ip_addr, "i", "1.1.1.1", "IP address to check")
+}
+func main() {
+       flag.Parse()
+
+       if len(ip_addr) == 0 {
+               fmt.Println("No IP address given, trying default")
+       }
+
+       var status Status
+       query_url := url + "/" + ip_addr
+       resp, err := http.Get(query_url)
+       if err != nil {
+               fmt.Println(err)
+       }
+       defer resp.Body.Close()
+       _ = json.NewDecoder(resp.Body).Decode(&status)
+       fmt.Printf("Continent: %v\nCountry: %v\nRegion: %v\nCity: %v\nZip: %v\nLatitude: %v\nLongitude: %v\nTimezone: %v\nQuery: %v\n", status.Continent, status.Country, status.Region, status.City, status.Zip, status.Latitude, status.Longitude, status.Timezone, status.Query)
+}
diff --git a/branches/master/cmd/mizuchi-ipinfo/main.go b/branches/master/cmd/mizuchi-ipinfo/main.go
new file mode 100644 (file)
index 0000000..02423c4
--- /dev/null
@@ -0,0 +1,45 @@
+package main
+
+import (
+       "encoding/json"
+       "flag"
+       "fmt"
+       "net/http"
+)
+type Status struct {
+       IP string `json:"ip"`
+       Hostname string `json:"hostname"`
+       City string `json:"city"`
+       Region string `json:"region"`
+       Country string `json:"country"`
+       Location string `json:"loc"`
+       Organization string `json:"org"`
+       Postal string `json:"postal"`
+       Timezone string `json:"timezone"`
+}
+const (
+       url = "https://ipinfo.io"
+)
+var (
+       ip_addr string
+)
+func init() {
+       flag.StringVar(&ip_addr, "i", "1.1.1.1", "IP address to check")
+}
+func main() {
+       flag.Parse()
+
+       if len(ip_addr) == 0 {
+               fmt.Println("No IP address given, trying default")
+       }
+
+       var status Status
+       query_url := url + "/" + ip_addr
+       resp, err := http.Get(query_url)
+       if err != nil {
+               fmt.Println(err)
+       }
+       defer resp.Body.Close()
+       _ = json.NewDecoder(resp.Body).Decode(&status)
+       fmt.Printf("IP: %v\nHostname: %v\nCity: %v\nRegion: %v\nCountry %v\nLocation: %v\nOrganization: %v\nPostal: %v\nTimezone: %v\n", status.IP, status.Hostname, status.City, status.Region, status.Country, status.Location, status.Organization, status.Postal, status.Timezone)
+}
diff --git a/branches/master/go.mod b/branches/master/go.mod
new file mode 100644 (file)
index 0000000..784d6a1
--- /dev/null
@@ -0,0 +1,3 @@
+module git.chaotic.ninja/yakumo.izuru/mizuchi
+
+go 1.20
diff --git a/branches/origin-master/COPYING b/branches/origin-master/COPYING
new file mode 100644 (file)
index 0000000..b44f774
--- /dev/null
@@ -0,0 +1,13 @@
+Copyright (c) 2023 Izuru Yakumo <postmaster@chaotic.ninja>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
diff --git a/branches/origin-master/README.md b/branches/origin-master/README.md
new file mode 100644 (file)
index 0000000..3da9896
--- /dev/null
@@ -0,0 +1,23 @@
+![](https://raddle.me/submission_images/61e31cb98ba6f807847098560a6b29b2fbdf822069186d2cfe5fa67f747b13f2.gif)
+
+# mizuchi
+The above animated picture says it all. 
+That aside, this was a full port from a shell script that I have never used seriously. 
+
+## Build
+It has two flavors, and have slightly different output.
+
+### For [ip-api.com](https://ip-api.com)
+
+```
+go build ./cmd/mizuchi-ipapi
+```
+
+### For [ipinfo.io](https://ipinfo.io)
+
+```
+go build ./cmd/mizuchi-ipinfo
+```
+
+## Usage
+Only required argument is `-i`
diff --git a/branches/origin-master/cmd/mizuchi-ipapi/main.go b/branches/origin-master/cmd/mizuchi-ipapi/main.go
new file mode 100644 (file)
index 0000000..4e47454
--- /dev/null
@@ -0,0 +1,45 @@
+package main
+
+import (
+       "encoding/json"
+       "flag"
+       "fmt"
+       "net/http"
+)
+type Status struct {
+       Continent string `json:"continent"`
+       Country string `json:"country"`
+       Region string `json:"region"`
+       City string `json:"city"`
+       Zip string `json:"zip"`
+       Latitude string `json:"lat"`
+       Longitude string `json:"lon"`
+       Timezone string `json:"timezone"`
+       Query string `json:"query"`
+}
+const (
+       url = "http://ip-api.com"
+)
+var (
+       ip_addr string
+)
+func init() {
+       flag.StringVar(&ip_addr, "i", "1.1.1.1", "IP address to check")
+}
+func main() {
+       flag.Parse()
+
+       if len(ip_addr) == 0 {
+               fmt.Println("No IP address given, trying default")
+       }
+
+       var status Status
+       query_url := url + "/" + ip_addr
+       resp, err := http.Get(query_url)
+       if err != nil {
+               fmt.Println(err)
+       }
+       defer resp.Body.Close()
+       _ = json.NewDecoder(resp.Body).Decode(&status)
+       fmt.Printf("Continent: %v\nCountry: %v\nRegion: %v\nCity: %v\nZip: %v\nLatitude: %v\nLongitude: %v\nTimezone: %v\nQuery: %v\n", status.Continent, status.Country, status.Region, status.City, status.Zip, status.Latitude, status.Longitude, status.Timezone, status.Query)
+}
diff --git a/branches/origin-master/cmd/mizuchi-ipinfo/main.go b/branches/origin-master/cmd/mizuchi-ipinfo/main.go
new file mode 100644 (file)
index 0000000..02423c4
--- /dev/null
@@ -0,0 +1,45 @@
+package main
+
+import (
+       "encoding/json"
+       "flag"
+       "fmt"
+       "net/http"
+)
+type Status struct {
+       IP string `json:"ip"`
+       Hostname string `json:"hostname"`
+       City string `json:"city"`
+       Region string `json:"region"`
+       Country string `json:"country"`
+       Location string `json:"loc"`
+       Organization string `json:"org"`
+       Postal string `json:"postal"`
+       Timezone string `json:"timezone"`
+}
+const (
+       url = "https://ipinfo.io"
+)
+var (
+       ip_addr string
+)
+func init() {
+       flag.StringVar(&ip_addr, "i", "1.1.1.1", "IP address to check")
+}
+func main() {
+       flag.Parse()
+
+       if len(ip_addr) == 0 {
+               fmt.Println("No IP address given, trying default")
+       }
+
+       var status Status
+       query_url := url + "/" + ip_addr
+       resp, err := http.Get(query_url)
+       if err != nil {
+               fmt.Println(err)
+       }
+       defer resp.Body.Close()
+       _ = json.NewDecoder(resp.Body).Decode(&status)
+       fmt.Printf("IP: %v\nHostname: %v\nCity: %v\nRegion: %v\nCountry %v\nLocation: %v\nOrganization: %v\nPostal: %v\nTimezone: %v\n", status.IP, status.Hostname, status.City, status.Region, status.Country, status.Location, status.Organization, status.Postal, status.Timezone)
+}
diff --git a/branches/origin-master/go.mod b/branches/origin-master/go.mod
new file mode 100644 (file)
index 0000000..784d6a1
--- /dev/null
@@ -0,0 +1,3 @@
+module git.chaotic.ninja/yakumo.izuru/mizuchi
+
+go 1.20
diff --git a/branches/origin/COPYING b/branches/origin/COPYING
new file mode 100644 (file)
index 0000000..b44f774
--- /dev/null
@@ -0,0 +1,13 @@
+Copyright (c) 2023 Izuru Yakumo <postmaster@chaotic.ninja>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
diff --git a/branches/origin/README.md b/branches/origin/README.md
new file mode 100644 (file)
index 0000000..3da9896
--- /dev/null
@@ -0,0 +1,23 @@
+![](https://raddle.me/submission_images/61e31cb98ba6f807847098560a6b29b2fbdf822069186d2cfe5fa67f747b13f2.gif)
+
+# mizuchi
+The above animated picture says it all. 
+That aside, this was a full port from a shell script that I have never used seriously. 
+
+## Build
+It has two flavors, and have slightly different output.
+
+### For [ip-api.com](https://ip-api.com)
+
+```
+go build ./cmd/mizuchi-ipapi
+```
+
+### For [ipinfo.io](https://ipinfo.io)
+
+```
+go build ./cmd/mizuchi-ipinfo
+```
+
+## Usage
+Only required argument is `-i`
diff --git a/branches/origin/cmd/mizuchi-ipapi/main.go b/branches/origin/cmd/mizuchi-ipapi/main.go
new file mode 100644 (file)
index 0000000..4e47454
--- /dev/null
@@ -0,0 +1,45 @@
+package main
+
+import (
+       "encoding/json"
+       "flag"
+       "fmt"
+       "net/http"
+)
+type Status struct {
+       Continent string `json:"continent"`
+       Country string `json:"country"`
+       Region string `json:"region"`
+       City string `json:"city"`
+       Zip string `json:"zip"`
+       Latitude string `json:"lat"`
+       Longitude string `json:"lon"`
+       Timezone string `json:"timezone"`
+       Query string `json:"query"`
+}
+const (
+       url = "http://ip-api.com"
+)
+var (
+       ip_addr string
+)
+func init() {
+       flag.StringVar(&ip_addr, "i", "1.1.1.1", "IP address to check")
+}
+func main() {
+       flag.Parse()
+
+       if len(ip_addr) == 0 {
+               fmt.Println("No IP address given, trying default")
+       }
+
+       var status Status
+       query_url := url + "/" + ip_addr
+       resp, err := http.Get(query_url)
+       if err != nil {
+               fmt.Println(err)
+       }
+       defer resp.Body.Close()
+       _ = json.NewDecoder(resp.Body).Decode(&status)
+       fmt.Printf("Continent: %v\nCountry: %v\nRegion: %v\nCity: %v\nZip: %v\nLatitude: %v\nLongitude: %v\nTimezone: %v\nQuery: %v\n", status.Continent, status.Country, status.Region, status.City, status.Zip, status.Latitude, status.Longitude, status.Timezone, status.Query)
+}
diff --git a/branches/origin/cmd/mizuchi-ipinfo/main.go b/branches/origin/cmd/mizuchi-ipinfo/main.go
new file mode 100644 (file)
index 0000000..02423c4
--- /dev/null
@@ -0,0 +1,45 @@
+package main
+
+import (
+       "encoding/json"
+       "flag"
+       "fmt"
+       "net/http"
+)
+type Status struct {
+       IP string `json:"ip"`
+       Hostname string `json:"hostname"`
+       City string `json:"city"`
+       Region string `json:"region"`
+       Country string `json:"country"`
+       Location string `json:"loc"`
+       Organization string `json:"org"`
+       Postal string `json:"postal"`
+       Timezone string `json:"timezone"`
+}
+const (
+       url = "https://ipinfo.io"
+)
+var (
+       ip_addr string
+)
+func init() {
+       flag.StringVar(&ip_addr, "i", "1.1.1.1", "IP address to check")
+}
+func main() {
+       flag.Parse()
+
+       if len(ip_addr) == 0 {
+               fmt.Println("No IP address given, trying default")
+       }
+
+       var status Status
+       query_url := url + "/" + ip_addr
+       resp, err := http.Get(query_url)
+       if err != nil {
+               fmt.Println(err)
+       }
+       defer resp.Body.Close()
+       _ = json.NewDecoder(resp.Body).Decode(&status)
+       fmt.Printf("IP: %v\nHostname: %v\nCity: %v\nRegion: %v\nCountry %v\nLocation: %v\nOrganization: %v\nPostal: %v\nTimezone: %v\n", status.IP, status.Hostname, status.City, status.Region, status.Country, status.Location, status.Organization, status.Postal, status.Timezone)
+}
diff --git a/branches/origin/go.mod b/branches/origin/go.mod
new file mode 100644 (file)
index 0000000..784d6a1
--- /dev/null
@@ -0,0 +1,3 @@
+module git.chaotic.ninja/yakumo.izuru/mizuchi
+
+go 1.20
diff --git a/trunk/COPYING b/trunk/COPYING
new file mode 100644 (file)
index 0000000..b44f774
--- /dev/null
@@ -0,0 +1,13 @@
+Copyright (c) 2023 Izuru Yakumo <postmaster@chaotic.ninja>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
diff --git a/trunk/README.md b/trunk/README.md
new file mode 100644 (file)
index 0000000..3da9896
--- /dev/null
@@ -0,0 +1,23 @@
+![](https://raddle.me/submission_images/61e31cb98ba6f807847098560a6b29b2fbdf822069186d2cfe5fa67f747b13f2.gif)
+
+# mizuchi
+The above animated picture says it all. 
+That aside, this was a full port from a shell script that I have never used seriously. 
+
+## Build
+It has two flavors, and have slightly different output.
+
+### For [ip-api.com](https://ip-api.com)
+
+```
+go build ./cmd/mizuchi-ipapi
+```
+
+### For [ipinfo.io](https://ipinfo.io)
+
+```
+go build ./cmd/mizuchi-ipinfo
+```
+
+## Usage
+Only required argument is `-i`
diff --git a/trunk/cmd/mizuchi-ipapi/main.go b/trunk/cmd/mizuchi-ipapi/main.go
new file mode 100644 (file)
index 0000000..4e47454
--- /dev/null
@@ -0,0 +1,45 @@
+package main
+
+import (
+       "encoding/json"
+       "flag"
+       "fmt"
+       "net/http"
+)
+type Status struct {
+       Continent string `json:"continent"`
+       Country string `json:"country"`
+       Region string `json:"region"`
+       City string `json:"city"`
+       Zip string `json:"zip"`
+       Latitude string `json:"lat"`
+       Longitude string `json:"lon"`
+       Timezone string `json:"timezone"`
+       Query string `json:"query"`
+}
+const (
+       url = "http://ip-api.com"
+)
+var (
+       ip_addr string
+)
+func init() {
+       flag.StringVar(&ip_addr, "i", "1.1.1.1", "IP address to check")
+}
+func main() {
+       flag.Parse()
+
+       if len(ip_addr) == 0 {
+               fmt.Println("No IP address given, trying default")
+       }
+
+       var status Status
+       query_url := url + "/" + ip_addr
+       resp, err := http.Get(query_url)
+       if err != nil {
+               fmt.Println(err)
+       }
+       defer resp.Body.Close()
+       _ = json.NewDecoder(resp.Body).Decode(&status)
+       fmt.Printf("Continent: %v\nCountry: %v\nRegion: %v\nCity: %v\nZip: %v\nLatitude: %v\nLongitude: %v\nTimezone: %v\nQuery: %v\n", status.Continent, status.Country, status.Region, status.City, status.Zip, status.Latitude, status.Longitude, status.Timezone, status.Query)
+}
diff --git a/trunk/cmd/mizuchi-ipinfo/main.go b/trunk/cmd/mizuchi-ipinfo/main.go
new file mode 100644 (file)
index 0000000..02423c4
--- /dev/null
@@ -0,0 +1,45 @@
+package main
+
+import (
+       "encoding/json"
+       "flag"
+       "fmt"
+       "net/http"
+)
+type Status struct {
+       IP string `json:"ip"`
+       Hostname string `json:"hostname"`
+       City string `json:"city"`
+       Region string `json:"region"`
+       Country string `json:"country"`
+       Location string `json:"loc"`
+       Organization string `json:"org"`
+       Postal string `json:"postal"`
+       Timezone string `json:"timezone"`
+}
+const (
+       url = "https://ipinfo.io"
+)
+var (
+       ip_addr string
+)
+func init() {
+       flag.StringVar(&ip_addr, "i", "1.1.1.1", "IP address to check")
+}
+func main() {
+       flag.Parse()
+
+       if len(ip_addr) == 0 {
+               fmt.Println("No IP address given, trying default")
+       }
+
+       var status Status
+       query_url := url + "/" + ip_addr
+       resp, err := http.Get(query_url)
+       if err != nil {
+               fmt.Println(err)
+       }
+       defer resp.Body.Close()
+       _ = json.NewDecoder(resp.Body).Decode(&status)
+       fmt.Printf("IP: %v\nHostname: %v\nCity: %v\nRegion: %v\nCountry %v\nLocation: %v\nOrganization: %v\nPostal: %v\nTimezone: %v\n", status.IP, status.Hostname, status.City, status.Region, status.Country, status.Location, status.Organization, status.Postal, status.Timezone)
+}
diff --git a/trunk/go.mod b/trunk/go.mod
new file mode 100644 (file)
index 0000000..784d6a1
--- /dev/null
@@ -0,0 +1,3 @@
+module git.chaotic.ninja/yakumo.izuru/mizuchi
+
+go 1.20