Skip to content

Commit 5cf5ebb

Browse files
authored
Merge pull request #45 from bitlux/dev
Update ipieces README
2 parents 097d690 + febd0b4 commit 5cf5ebb

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/bitlux/caches
33
go 1.23.4
44

55
require (
6-
github.com/bitlux/vpnapi v0.0.0-20250207215125-f066bb2314a4
6+
github.com/bitlux/vpnapi v0.0.0-20250217222132-63c262807319
77
github.com/d4l3k/go-bfloat16 v0.0.0-20211005043715-690c3bdd05f1
88
github.com/keep94/sqroot/v3 v3.7.2
99
)

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
github.com/bitlux/vpnapi v0.0.0-20250207215125-f066bb2314a4 h1:zYVWlKFsyl3tMu3Ak9es+EMW2DUe9nqPQaOQNBtu2XQ=
22
github.com/bitlux/vpnapi v0.0.0-20250207215125-f066bb2314a4/go.mod h1:ou6ccQPRIv8uzPNeLaRLxnwd2felkT30fwGnJtbVYCg=
3+
github.com/bitlux/vpnapi v0.0.0-20250217222132-63c262807319 h1:wfPTZ1VuQP/IecBGOW+2sNAzqd5hdRdU5+Wh14jiho4=
4+
github.com/bitlux/vpnapi v0.0.0-20250217222132-63c262807319/go.mod h1:ou6ccQPRIv8uzPNeLaRLxnwd2felkT30fwGnJtbVYCg=
35
github.com/d4l3k/go-bfloat16 v0.0.0-20211005043715-690c3bdd05f1 h1:cBzrdJPAFBsgCrDPnZxlp1dF2+k4r1kVpD7+1S1PVjY=
46
github.com/d4l3k/go-bfloat16 v0.0.0-20211005043715-690c3bdd05f1/go.mod h1:uw2gLcxEuYUlAd/EXyjc/v55nd3+47YAgWbSXVxPrNI=
57
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=

ipieces/README.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
# ipieces
22

3-
ipieces is a Go package used to create Geocaching puzzles such as [GCB1ZXB](https://coord.info/GCB1ZXB).
3+
ipieces is a Go package used to create Geocaching puzzles such as
4+
[GCB1ZXB](https://coord.info/GCB1ZXB).
45

56
## Documentation
67

78
Available at https://pkg.go.dev/github.com/bitlux/caches/ipieces.
89

910
## Deployment instructions
1011

11-
I deploy on [Google Cloud Run](https://cloud.google.com/run). To do that, you must first sign
12-
into the [Google Cloud console](https://console.cloud.google.com/),
13-
[create a project](https://cloud.google.com/resource-manager/docs/creating-managing-projects), and have
14-
[`gcloud`](https://cloud.google.com/sdk) installed.
12+
I deploy on [Google Cloud Run](https://cloud.google.com/run).
13+
https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-go-service is a good
14+
reference on how to us Google Cloud Run.
15+
16+
Create a directory for your project and put your code in a file named `main.go`. Run
17+
`go mod init <module name>` to create a module (because your `main.go` imports packages outside the
18+
standard library, Google Cloud Run requires it to be in its own module).
1519

1620
To deploy, `cd` to the directory with your `main.go` file and run:
1721
```
18-
gcloud run deploy --source . <project> [--allow-unauthenticated]
22+
gcloud run deploy --source . <service> [--allow-unauthenticated]
1923
```
24+
where `<service>` is any name you want.
2025

2126
## Testing
2227

@@ -29,4 +34,4 @@ where `<backdoor>` is the `Puzzle.Backdoor` string you set.
2934
## Contact / Support
3035

3136
I welcome issues and pull requests on GitHub and messages and email on
32-
[geocaching.com](https://www.geocaching.com/profile/?u=bitlux).
37+
[geocaching.com](https://www.geocaching.com/profile/?u=bitlux).

ipieces/ipieces.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ func (p Puzzle) handle(w http.ResponseWriter, req *http.Request, tmpl *template.
211211

212212
if p.Client != nil {
213213
resp, err := p.Client.Query(d.IP)
214+
if resp.Message != "" {
215+
fmt.Println("Response message:", resp.Message)
216+
}
214217
if err != nil {
215218
if err == vpnapi.ErrRateLimited {
216219
writeResponse(w, http.StatusTooManyRequests, rateLimitPage, "rate limited: %v\n", err)
@@ -222,7 +225,7 @@ func (p Puzzle) handle(w http.ResponseWriter, req *http.Request, tmpl *template.
222225
}
223226

224227
if resp.Security.VPN || resp.Security.Proxy || resp.Security.Tor || resp.Security.Relay {
225-
writeResponse(w, http.StatusForbidden, vpnPage, "%t %t %t %t\n", resp.Security.VPN, resp.Security.Proxy, resp.Security.Tor, resp.Security.Relay)
228+
writeResponse(w, http.StatusForbidden, vpnPage, "VPN: %t Proxy: %t Tor: %t Relay: %t\n", resp.Security.VPN, resp.Security.Proxy, resp.Security.Tor, resp.Security.Relay)
226229
return
227230
}
228231
}

0 commit comments

Comments
 (0)