|
1 | 1 | // Package ipieces allows users to create IP address-based Geocaching puzzles.
|
2 | 2 | //
|
3 |
| -// To create a puzzle, you need to populate a [Puzzle] struct and call [Run] on it. |
| 3 | +// To create a puzzle, you need to populate a [Puzzle] struct and call [Puzzle.Run] on it. |
4 | 4 | // For example:
|
5 | 5 | //
|
6 |
| -// package main |
| 6 | +// package main |
7 | 7 | //
|
8 |
| -// import ( |
9 |
| -// "github.com/bitlux/caches/ipieces" |
10 |
| -// "github.com/bitlux/vpnapi" |
11 |
| -// ) |
| 8 | +// import ( |
| 9 | +// "github.com/bitlux/caches/ipieces" |
| 10 | +// "github.com/bitlux/vpnapi" |
| 11 | +// ) |
12 | 12 | //
|
13 |
| -// func main() { |
14 |
| -// p := ipieces.Puzzle{ |
15 |
| -// Final: []ipieces.Digit{ |
16 |
| -// ipieces.Digit{Value: "3", Status: ipieces.VISIBLE} |
17 |
| -// ipieces.Digit{Value: "7", Status: ipieces.VISIBLE} |
18 |
| -// ipieces.Digit{Value: "2", Status: ipieces.VISIBLE} |
19 |
| -// ipieces.Digit{Value: "4", Status: ipieces.HIDDEN} |
20 |
| -// ipieces.Digit{Value: "0", Status: ipieces.HIDDEN} |
21 |
| -// ipieces.Digit{Value: "0", Status: ipieces.HIDDEN} |
22 |
| -// ipieces.Digit{Value: "0", Status: ipieces.HIDDEN} |
23 |
| -// ipieces.Digit{Value: "1", Status: ipieces.VISIBLE} |
24 |
| -// ipieces.Digit{Value: "2", Status: ipieces.VISIBLE} |
25 |
| -// ipieces.Digit{Value: "2", Status: ipieces.VISIBLE} |
26 |
| -// ipieces.Digit{Value: "0", Status: ipieces.VISIBLE} |
27 |
| -// ipieces.Digit{Value: "4", Status: ipieces.HIDDEN} |
28 |
| -// ipieces.Digit{Value: "0", Status: ipieces.HIDDEN} |
29 |
| -// ipieces.Digit{Value: "0", Status: ipieces.HIDDEN} |
30 |
| -// ipieces.Digit{Value: "0", Status: ipieces.HIDDEN} |
31 |
| -// }, |
32 |
| -// IndexFunc: func(b [sha256.Size]byte) int { |
33 |
| -// return int(b[sha256.Size-1]) % 8 |
34 |
| -// }, |
35 |
| -// // Setting Client is optional. |
36 |
| -// Client: vpnapi.New("YOUR-API-KEY-HERE"), |
37 |
| -// Backdoor: "topsecret", |
38 |
| -// GCCode: "GCB2PKC", |
39 |
| -// } |
40 |
| -// p.Run() |
41 |
| -// } |
| 13 | +// func main() { |
| 14 | +// p := ipieces.Puzzle{ |
| 15 | +// Final: []ipieces.Digit{ |
| 16 | +// ipieces.Digit{Value: "3", Status: ipieces.VISIBLE} |
| 17 | +// ipieces.Digit{Value: "7", Status: ipieces.VISIBLE} |
| 18 | +// ipieces.Digit{Value: "2", Status: ipieces.VISIBLE} |
| 19 | +// ipieces.Digit{Value: "4", Status: ipieces.HIDDEN} |
| 20 | +// ipieces.Digit{Value: "0", Status: ipieces.HIDDEN} |
| 21 | +// ipieces.Digit{Value: "0", Status: ipieces.HIDDEN} |
| 22 | +// ipieces.Digit{Value: "0", Status: ipieces.HIDDEN} |
| 23 | +// ipieces.Digit{Value: "1", Status: ipieces.VISIBLE} |
| 24 | +// ipieces.Digit{Value: "2", Status: ipieces.VISIBLE} |
| 25 | +// ipieces.Digit{Value: "2", Status: ipieces.VISIBLE} |
| 26 | +// ipieces.Digit{Value: "0", Status: ipieces.VISIBLE} |
| 27 | +// ipieces.Digit{Value: "4", Status: ipieces.HIDDEN} |
| 28 | +// ipieces.Digit{Value: "0", Status: ipieces.HIDDEN} |
| 29 | +// ipieces.Digit{Value: "0", Status: ipieces.HIDDEN} |
| 30 | +// ipieces.Digit{Value: "0", Status: ipieces.HIDDEN} |
| 31 | +// }, |
| 32 | +// IndexFunc: func(b [sha256.Size]byte) int { |
| 33 | +// return int(b[sha256.Size-1]) % 8 |
| 34 | +// }, |
| 35 | +// // Setting Client is optional. |
| 36 | +// Client: vpnapi.New("YOUR-API-KEY-HERE"), |
| 37 | +// Backdoor: "topsecret", |
| 38 | +// GCCode: "GCB2PKC", |
| 39 | +// } |
| 40 | +// p.Run() |
| 41 | +// } |
42 | 42 | //
|
43 |
| -// [Run] creates two handlers: |
| 43 | +// [Puzzle.Run] creates two handlers: |
44 | 44 | // - a text endpoint at `/text` which responds with a short plaintext page with the client's IP,
|
45 | 45 | // the computed index into the final coordinates, and the revealed coordinate, and
|
46 | 46 | // - a default endpoint, which serves any path other than `/text`, and responds with an HTML page.
|
|
0 commit comments