├── .github
└── workflows
│ └── dockerhub.yml
├── .gitignore
├── Dockerfile
├── LICENSE
├── README.md
├── config.json
├── go.mod
├── go.sum
├── main.go
└── pkg
├── auth
├── auth.go
└── middleware.go
├── core
├── config.go
├── email.go
└── utils.go
├── db
├── accounts.go
├── addons.go
├── capes.go
├── db.go
├── global.go
└── joinStats.go
├── discord
└── discord.go
├── web
├── api
│ ├── account.go
│ ├── addons.go
│ ├── capes.go
│ ├── discord.go
│ ├── download.go
│ ├── metrics.go
│ ├── online.go
│ ├── payments.go
│ └── stats.go
└── web.go
└── wormhole
├── core
├── client.go
└── clients.go
├── handler.go
└── packets
├── c2s.go
├── packet.go
└── s2c.go
/.github/workflows/dockerhub.yml:
--------------------------------------------------------------------------------
1 | name: Publish Docker Image
2 |
3 | on:
4 | push:
5 | branches: [ "master" ]
6 | workflow_dispatch:
7 |
8 | jobs:
9 | publish:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - name: Checkout repo
13 | uses: actions/checkout@v3
14 |
15 | - name: Set up Docker Buildx
16 | uses: docker/setup-buildx-action@v2
17 |
18 | - name: Login to Docker Hub
19 | uses: docker/login-action@v2
20 | with:
21 | username: ${{ secrets.DOCKER_USER }}
22 | password: ${{ secrets.DOCKER_PASSWORD }}
23 |
24 | - name: Build and push
25 | uses: docker/build-push-action@v4
26 | with:
27 | push: true
28 | platforms: linux/amd64,linux/arm64
29 | tags: ${{ secrets.DOCKER_USER }}/${{ secrets.DOCKER_REPO }}:latest,${{ secrets.DOCKER_USER }}/${{ secrets.DOCKER_REPO }}:${{ github.sha }}
30 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | out
3 | data
4 | *.exe
5 | .env
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM golang:1.20-alpine AS build
2 |
3 | WORKDIR /app
4 |
5 | COPY . .
6 | RUN go build
7 |
8 | FROM alpine AS release
9 |
10 | WORKDIR /app
11 |
12 | COPY --from=build /app/meteor-server .
13 | COPY config.json .
14 |
15 | ENTRYPOINT [ "/app/meteor-server" ]
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Meteor Server Copyright (c) 2021 Meteor Development.
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Meteor Server
--------------------------------------------------------------------------------
/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "port": 3001,
3 | "debug": false,
4 | "baritone_mc_version": "1.21.5"
5 | }
6 |
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module meteor-server
2 |
3 | go 1.18
4 |
5 | require (
6 | github.com/caarlos0/env v3.5.0+incompatible
7 | github.com/dboslee/lru v0.0.1
8 | github.com/dvsekhvalnov/jose2go v1.5.0
9 | github.com/go-chi/chi/v5 v5.0.5
10 | github.com/go-chi/cors v1.2.1
11 | github.com/google/uuid v1.3.0
12 | github.com/gorilla/websocket v1.4.2
13 | github.com/joho/godotenv v1.4.0
14 | github.com/meyskens/go-turnstile v0.0.0-20230622160222-89160e594ca1
15 | github.com/plutov/paypal/v4 v4.6.1
16 | github.com/prometheus/client_golang v1.14.0
17 | github.com/rs/zerolog v1.30.0
18 | github.com/segmentio/ksuid v1.0.4
19 | go.mongodb.org/mongo-driver v1.5.1
20 | golang.org/x/crypto v0.1.0
21 | golang.org/x/exp v0.0.0-20220713135740-79cabaa25d75
22 | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4
23 | )
24 |
25 | require (
26 | github.com/aws/aws-sdk-go v1.34.28 // indirect
27 | github.com/beorn7/perks v1.0.1 // indirect
28 | github.com/cespare/xxhash/v2 v2.1.2 // indirect
29 | github.com/go-stack/stack v1.8.0 // indirect
30 | github.com/golang/protobuf v1.5.2 // indirect
31 | github.com/golang/snappy v0.0.1 // indirect
32 | github.com/jmespath/go-jmespath v0.4.0 // indirect
33 | github.com/klauspost/compress v1.9.5 // indirect
34 | github.com/mattn/go-colorable v0.1.12 // indirect
35 | github.com/mattn/go-isatty v0.0.14 // indirect
36 | github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
37 | github.com/pkg/errors v0.9.1 // indirect
38 | github.com/prometheus/client_model v0.3.0 // indirect
39 | github.com/prometheus/common v0.37.0 // indirect
40 | github.com/prometheus/procfs v0.8.0 // indirect
41 | github.com/xdg-go/pbkdf2 v1.0.0 // indirect
42 | github.com/xdg-go/scram v1.0.2 // indirect
43 | github.com/xdg-go/stringprep v1.0.2 // indirect
44 | github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
45 | golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect
46 | golang.org/x/sys v0.1.0 // indirect
47 | golang.org/x/text v0.4.0 // indirect
48 | google.golang.org/protobuf v1.28.1 // indirect
49 | )
50 |
--------------------------------------------------------------------------------
/go.sum:
--------------------------------------------------------------------------------
1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
2 | cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
3 | cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
4 | cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
5 | cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
6 | cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
7 | cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
8 | cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
9 | cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
10 | cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
11 | cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
12 | cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
13 | cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
14 | cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
15 | cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
16 | cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
17 | cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
18 | cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
19 | cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
20 | cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
21 | cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
22 | cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
23 | cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
24 | cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
25 | cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
26 | cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
27 | cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
28 | cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
29 | cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
30 | cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
31 | cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
32 | cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
33 | dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
34 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
35 | github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
36 | github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
37 | github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
38 | github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
39 | github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
40 | github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
41 | github.com/aws/aws-sdk-go v1.34.28 h1:sscPpn/Ns3i0F4HPEWAVcwdIRaZZCuL7llJ2/60yPIk=
42 | github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48=
43 | github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
44 | github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
45 | github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
46 | github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
47 | github.com/caarlos0/env v3.5.0+incompatible h1:Yy0UN8o9Wtr/jGHZDpCBLpNrzcFLLM2yixi/rBrKyJs=
48 | github.com/caarlos0/env v3.5.0+incompatible/go.mod h1:tdCsowwCzMLdkqRYDlHpZCp2UooDD3MspDBjZ2AD02Y=
49 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
50 | github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
51 | github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
52 | github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
53 | github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
54 | github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
55 | github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
56 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
57 | github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
58 | github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
59 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
60 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
61 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
62 | github.com/dboslee/lru v0.0.1 h1:PMT+59nkGSkf9Tcb4YMw5B08ilpGgNSmRjEyNK2JVoE=
63 | github.com/dboslee/lru v0.0.1/go.mod h1:vDIFJHUqr1vdYKAdG9x3r+zFWP0i9uJqQWpB6nSuHxM=
64 | github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM=
65 | github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
66 | github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
67 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
68 | github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
69 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
70 | github.com/go-chi/chi/v5 v5.0.5 h1:l3RJ8T8TAqLsXFfah+RA6N4pydMbPwSdvNM+AFWvLUM=
71 | github.com/go-chi/chi/v5 v5.0.5/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
72 | github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
73 | github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
74 | github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
75 | github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
76 | github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
77 | github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
78 | github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
79 | github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
80 | github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
81 | github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
82 | github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
83 | github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
84 | github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
85 | github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
86 | github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
87 | github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
88 | github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0=
89 | github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY=
90 | github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg=
91 | github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
92 | github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
93 | github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs=
94 | github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI=
95 | github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI=
96 | github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk=
97 | github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28=
98 | github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo=
99 | github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk=
100 | github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw=
101 | github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360=
102 | github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg=
103 | github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE=
104 | github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8=
105 | github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc=
106 | github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc=
107 | github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4=
108 | github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4=
109 | github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ=
110 | github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0=
111 | github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw=
112 | github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
113 | github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
114 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
115 | github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
116 | github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
117 | github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
118 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
119 | github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
120 | github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
121 | github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
122 | github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
123 | github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
124 | github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
125 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
126 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
127 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
128 | github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
129 | github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
130 | github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
131 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
132 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
133 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
134 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
135 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
136 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
137 | github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
138 | github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
139 | github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
140 | github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
141 | github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
142 | github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
143 | github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
144 | github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
145 | github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
146 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
147 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
148 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
149 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
150 | github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
151 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
152 | github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
153 | github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
154 | github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
155 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
156 | github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
157 | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
158 | github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
159 | github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
160 | github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
161 | github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
162 | github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
163 | github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
164 | github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
165 | github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
166 | github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
167 | github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
168 | github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
169 | github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
170 | github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
171 | github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
172 | github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
173 | github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
174 | github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
175 | github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
176 | github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
177 | github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
178 | github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
179 | github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
180 | github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
181 | github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
182 | github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
183 | github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
184 | github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
185 | github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
186 | github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
187 | github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
188 | github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
189 | github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
190 | github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
191 | github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
192 | github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
193 | github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
194 | github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4=
195 | github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
196 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
197 | github.com/klauspost/compress v1.9.5 h1:U+CaK85mrNNb4k8BNOfgJtJ/gr6kswUCFj6miSzVC6M=
198 | github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
199 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
200 | github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
201 | github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
202 | github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
203 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
204 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
205 | github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
206 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
207 | github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE=
208 | github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0=
209 | github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
210 | github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
211 | github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
212 | github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
213 | github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
214 | github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
215 | github.com/meyskens/go-turnstile v0.0.0-20230622160222-89160e594ca1 h1:lGjDY7OC1VfMpuVUN+b59vPPepbPx/eJQXGqpM2pCdw=
216 | github.com/meyskens/go-turnstile v0.0.0-20230622160222-89160e594ca1/go.mod h1:YbEb1gFAr7w2NcabqA2aPAeyW4Mhf85fmt+vVrrLo4s=
217 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
218 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
219 | github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
220 | github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
221 | github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
222 | github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
223 | github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
224 | github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
225 | github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
226 | github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
227 | github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
228 | github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
229 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
230 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
231 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
232 | github.com/plutov/paypal/v4 v4.6.1 h1:SypyPgH0PjaP69Sb7IRT3cC1nTEoTAk6j4peWarO78M=
233 | github.com/plutov/paypal/v4 v4.6.1/go.mod h1:D56boafCRGcF/fEM0w282kj0fCDKIyrwOPX/Te1jCmw=
234 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
235 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
236 | github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
237 | github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
238 | github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
239 | github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
240 | github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
241 | github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
242 | github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
243 | github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
244 | github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
245 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
246 | github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
247 | github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
248 | github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
249 | github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
250 | github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
251 | github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
252 | github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
253 | github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE=
254 | github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
255 | github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
256 | github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
257 | github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
258 | github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
259 | github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
260 | github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo=
261 | github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
262 | github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
263 | github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
264 | github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
265 | github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
266 | github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
267 | github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
268 | github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c=
269 | github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE=
270 | github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
271 | github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
272 | github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
273 | github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
274 | github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
275 | github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
276 | github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
277 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
278 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
279 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
280 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
281 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
282 | github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
283 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
284 | github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
285 | github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
286 | github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
287 | github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
288 | github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
289 | github.com/xdg-go/scram v1.0.2 h1:akYIkZ28e6A96dkWNJQu3nmCzH3YfwMPQExUYDaRv7w=
290 | github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
291 | github.com/xdg-go/stringprep v1.0.2 h1:6iq84/ryjjeRmMJwxutI51F2GIPlP5BfTvXHeYjyhBc=
292 | github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM=
293 | github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
294 | github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
295 | github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
296 | github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
297 | github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
298 | go.mongodb.org/mongo-driver v1.5.1 h1:9nOVLGDfOaZ9R0tBumx/BcuqkbFpyTCU2r/Po7A2azI=
299 | go.mongodb.org/mongo-driver v1.5.1/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw=
300 | go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
301 | go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
302 | go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
303 | go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
304 | go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
305 | golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
306 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
307 | golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
308 | golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
309 | golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
310 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
311 | golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
312 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
313 | golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU=
314 | golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
315 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
316 | golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
317 | golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
318 | golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
319 | golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
320 | golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
321 | golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
322 | golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
323 | golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
324 | golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
325 | golang.org/x/exp v0.0.0-20220713135740-79cabaa25d75 h1:x03zeu7B2B11ySp+daztnwM5oBJ/8wGUSqrwcw9L0RA=
326 | golang.org/x/exp v0.0.0-20220713135740-79cabaa25d75/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
327 | golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
328 | golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
329 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
330 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
331 | golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
332 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
333 | golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
334 | golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
335 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
336 | golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
337 | golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
338 | golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
339 | golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
340 | golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
341 | golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
342 | golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
343 | golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
344 | golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
345 | golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
346 | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
347 | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
348 | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
349 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
350 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
351 | golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
352 | golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
353 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
354 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
355 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
356 | golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
357 | golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
358 | golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
359 | golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
360 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
361 | golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
362 | golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
363 | golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
364 | golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
365 | golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
366 | golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
367 | golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
368 | golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
369 | golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
370 | golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
371 | golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
372 | golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
373 | golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
374 | golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
375 | golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
376 | golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
377 | golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
378 | golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
379 | golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
380 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
381 | golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
382 | golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
383 | golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
384 | golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
385 | golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
386 | golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
387 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
388 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
389 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
390 | golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
391 | golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
392 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
393 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
394 | golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
395 | golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
396 | golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
397 | golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f h1:Ax0t5p6N38Ga0dThY21weqDEyz2oklo4IvDkpigvkD8=
398 | golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
399 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
400 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
401 | golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
402 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
403 | golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
404 | golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
405 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
406 | golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
407 | golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
408 | golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
409 | golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
410 | golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
411 | golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
412 | golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
413 | golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
414 | golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
415 | golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
416 | golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
417 | golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
418 | golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
419 | golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
420 | golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
421 | golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
422 | golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
423 | golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
424 | golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
425 | golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
426 | golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
427 | golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
428 | golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
429 | golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
430 | golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
431 | golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
432 | golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
433 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
434 | golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
435 | golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
436 | golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
437 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
438 | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
439 | golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
440 | golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
441 | golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
442 | golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
443 | golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
444 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
445 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
446 | golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
447 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
448 | golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
449 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
450 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
451 | golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
452 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
453 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
454 | golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
455 | golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
456 | golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
457 | golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
458 | golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
459 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
460 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
461 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
462 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
463 | golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
464 | golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
465 | golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
466 | golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
467 | golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
468 | golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
469 | golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
470 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
471 | golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
472 | golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
473 | golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
474 | golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
475 | golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
476 | golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
477 | golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
478 | golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
479 | golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
480 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
481 | golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
482 | golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
483 | golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
484 | golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
485 | golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
486 | golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
487 | golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
488 | golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
489 | golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
490 | golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
491 | golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
492 | golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
493 | golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
494 | golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
495 | golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
496 | golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
497 | golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
498 | golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
499 | golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
500 | golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
501 | golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
502 | golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
503 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
504 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
505 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
506 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
507 | google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
508 | google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
509 | google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
510 | google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
511 | google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
512 | google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
513 | google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
514 | google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
515 | google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
516 | google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
517 | google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
518 | google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
519 | google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
520 | google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
521 | google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
522 | google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
523 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
524 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
525 | google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
526 | google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
527 | google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
528 | google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
529 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
530 | google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
531 | google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
532 | google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
533 | google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
534 | google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
535 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
536 | google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
537 | google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
538 | google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
539 | google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
540 | google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
541 | google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
542 | google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
543 | google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
544 | google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
545 | google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
546 | google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
547 | google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
548 | google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
549 | google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
550 | google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
551 | google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
552 | google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
553 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
554 | google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
555 | google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
556 | google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
557 | google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
558 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
559 | google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
560 | google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
561 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
562 | google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
563 | google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
564 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
565 | google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
566 | google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
567 | google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
568 | google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
569 | google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
570 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
571 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
572 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
573 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
574 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
575 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
576 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
577 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
578 | google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
579 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
580 | google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
581 | google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
582 | google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
583 | google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
584 | gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
585 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
586 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
587 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
588 | gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U=
589 | gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
590 | gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
591 | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
592 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
593 | gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
594 | gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
595 | gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
596 | gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
597 | gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
598 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
599 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
600 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
601 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
602 | honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
603 | honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
604 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
605 | honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
606 | honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
607 | honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
608 | rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
609 | rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
610 | rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
611 |
--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "github.com/rs/zerolog"
5 | "github.com/rs/zerolog/log"
6 | "meteor-server/pkg/auth"
7 | "meteor-server/pkg/core"
8 | "meteor-server/pkg/db"
9 | "meteor-server/pkg/web"
10 | "os"
11 | "time"
12 | )
13 |
14 | func main() {
15 | log.Logger = log.Output(zerolog.ConsoleWriter{
16 | Out: os.Stdout,
17 | TimeFormat: time.TimeOnly,
18 | })
19 |
20 | core.Init()
21 | core.LoadConfig()
22 | core.InitEmail()
23 |
24 | db.Init()
25 | defer db.Close()
26 |
27 | auth.Init()
28 | web.Main()
29 | }
30 |
--------------------------------------------------------------------------------
/pkg/auth/auth.go:
--------------------------------------------------------------------------------
1 | package auth
2 |
3 | import (
4 | "encoding/json"
5 | "errors"
6 | "golang.org/x/exp/slices"
7 | "math/rand"
8 | "strings"
9 | "sync"
10 | "time"
11 |
12 | jose "github.com/dvsekhvalnov/jose2go"
13 | "github.com/segmentio/ksuid"
14 | "meteor-server/pkg/core"
15 | "meteor-server/pkg/db"
16 | )
17 |
18 | type Claims struct {
19 | TokenID int
20 | AccountID ksuid.KSUID
21 | }
22 |
23 | type ConfirmEmailStruct struct {
24 | Token ksuid.KSUID
25 | Username string
26 | Email string
27 | Password string
28 | Time time.Time
29 | }
30 |
31 | var jwtKey []byte
32 |
33 | var tokenCount = 0
34 | var tokens = make(map[ksuid.KSUID][]int)
35 | var mu = sync.RWMutex{}
36 |
37 | var confirmEmails = make(map[ksuid.KSUID]ConfirmEmailStruct)
38 | var cetMu = sync.RWMutex{}
39 |
40 | func Init() {
41 | jwtKey = make([]byte, 36)
42 | rand.Seed(time.Now().UnixNano())
43 | rand.Read(jwtKey)
44 | }
45 |
46 | func Register(username string, email string, password string) error {
47 | if username == "" || strings.ContainsRune(username, ' ') || email == "" || strings.ContainsRune(email, ' ') || password == "" || strings.ContainsRune(password, ' ') {
48 | return errors.New("Invalid username, email or password.")
49 | }
50 |
51 | if !core.IsEmailValid(email) {
52 | return errors.New("Invalid email.")
53 | }
54 |
55 | _, err := db.GetAccountWithUsername(username)
56 | if err == nil {
57 | return errors.New("Account with this username already exists.")
58 | }
59 |
60 | _, err = db.GetAccountWithEmail(email)
61 | if err == nil {
62 | return errors.New("Account with this email already exists.")
63 | }
64 |
65 | token := ksuid.New()
66 |
67 | cetMu.Lock()
68 | clearConfirmEmails()
69 | confirmEmails[token] = ConfirmEmailStruct{Token: token, Username: username, Email: email, Password: password, Time: time.Now()}
70 | cetMu.Unlock()
71 |
72 | core.SendEmail(email, "Confirm email to register", "To complete the registration go to https://meteorclient.com/confirm?token="+token.String()+" . The link is valid for 15 minutes.")
73 | return nil
74 | }
75 |
76 | func ConfirmEmail(token ksuid.KSUID) bool {
77 | cetMu.Lock()
78 | clearConfirmEmails()
79 | confirmEmail, exists := confirmEmails[token]
80 | if !exists {
81 | cetMu.Unlock()
82 | return false
83 | }
84 |
85 | delete(confirmEmails, token)
86 | cetMu.Unlock()
87 |
88 | err := db.NewAccount(confirmEmail.Username, confirmEmail.Email, confirmEmail.Password)
89 | return err == nil
90 | }
91 |
92 | func clearConfirmEmails() {
93 | now := time.Now()
94 |
95 | for token, confirmEmail := range confirmEmails {
96 | if now.Sub(confirmEmail.Time).Minutes() > 15 {
97 | delete(confirmEmails, token)
98 | }
99 | }
100 | }
101 |
102 | func Login(name string, password string) (string, error) {
103 | if name == "" || password == "" {
104 | return "", errors.New("wrong name or password")
105 | }
106 |
107 | account, err := db.GetAccountWithUsernameOrEmail(name)
108 | if err != nil {
109 | return "", errors.New("wrong name or password")
110 | }
111 |
112 | if !account.PasswordMatches(password) {
113 | return "", errors.New("wrong name or password")
114 | }
115 |
116 | mu.Lock()
117 |
118 | bytes, err := json.Marshal(Claims{TokenID: tokenCount, AccountID: account.ID})
119 | if err != nil {
120 | mu.Unlock()
121 | return "", err
122 | }
123 |
124 | token, err := jose.Sign(string(bytes), jose.HS256, jwtKey)
125 | if err != nil {
126 | mu.Unlock()
127 | return "", err
128 | }
129 |
130 | tokens[account.ID] = append(tokens[account.ID], tokenCount)
131 | tokenCount++
132 |
133 | mu.Unlock()
134 | return token, nil
135 | }
136 |
137 | func Logout(token string, id ksuid.KSUID) error {
138 | bytes, _, err := jose.Decode(token, jwtKey)
139 | if err != nil {
140 | return err
141 | }
142 |
143 | var claims Claims
144 | err = json.Unmarshal([]byte(bytes), &claims)
145 | if err != nil {
146 | return err
147 | }
148 |
149 | mu.Lock()
150 | tokenIds, exists := tokens[id]
151 | if exists {
152 | for i := 0; i < len(tokenIds); i++ {
153 | if tokenIds[i] == claims.TokenID {
154 | tokens[id] = append(tokenIds[:i], tokenIds[i+1:]...)
155 | break
156 | }
157 | }
158 | }
159 | mu.Unlock()
160 |
161 | return nil
162 | }
163 |
164 | func IsTokenValid(token string) (ksuid.KSUID, error) {
165 | bytes, _, err := jose.Decode(token, jwtKey)
166 | if err != nil {
167 | return ksuid.Nil, err
168 | }
169 |
170 | var claims Claims
171 | err = json.Unmarshal([]byte(bytes), &claims)
172 | if err != nil {
173 | return ksuid.Nil, err
174 | }
175 |
176 | mu.RLock()
177 | validTokenIds, exists := tokens[claims.AccountID]
178 | mu.RUnlock()
179 |
180 | if exists && slices.Contains(validTokenIds, claims.TokenID) {
181 | return claims.AccountID, nil
182 | }
183 |
184 | return ksuid.Nil, errors.New("invalid token")
185 | }
186 |
187 | func Invalidate(id ksuid.KSUID) {
188 | delete(tokens, id)
189 | }
190 |
--------------------------------------------------------------------------------
/pkg/auth/middleware.go:
--------------------------------------------------------------------------------
1 | package auth
2 |
3 | import (
4 | "context"
5 | "meteor-server/pkg/core"
6 | "net/http"
7 | "strings"
8 | )
9 |
10 | func Auth(next http.HandlerFunc) http.HandlerFunc {
11 | return func(w http.ResponseWriter, r *http.Request) {
12 | token := r.Header.Get("Authorization")
13 |
14 | if strings.HasPrefix(token, "Bearer ") {
15 | token = strings.TrimPrefix(token, "Bearer ")
16 | id, err := IsTokenValid(token)
17 |
18 | if err == nil {
19 | next(w, r.WithContext(context.WithValue(r.Context(), "id", id)))
20 | return
21 | }
22 | }
23 |
24 | core.Unauthorized(w)
25 | }
26 | }
27 |
28 | func TokenAuth(next http.HandlerFunc) http.HandlerFunc {
29 | return func(w http.ResponseWriter, r *http.Request) {
30 | token := r.Header.Get("Authorization")
31 |
32 | if token == core.GetPrivateConfig().Token {
33 | next(w, r)
34 | return
35 | }
36 |
37 | core.Unauthorized(w)
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/pkg/core/config.go:
--------------------------------------------------------------------------------
1 | package core
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/caarlos0/env"
6 | "github.com/joho/godotenv"
7 | "github.com/rs/zerolog/log"
8 | "os"
9 | )
10 |
11 | type Config struct {
12 | Port int `json:"port"`
13 | Debug bool `json:"debug"`
14 | BaritoneMcVersion string `json:"baritone_mc_version"`
15 | }
16 |
17 | type PrivateConfig struct {
18 | MongoDBUrl string `env:"MONGO_URL"`
19 | EmailPassword string `env:"EMAIL_PSW"`
20 | DiscordToken string `env:"DISCORD_TOKEN"`
21 | Token string `env:"BACKEND_TOKEN"`
22 | PayPalClientID string `env:"PAYPAL_CID"`
23 | PayPalSecret string `env:"PAYPAL_SECRET"`
24 | PayPalWebhookId string `env:"PAYPAL_WHID"`
25 | CloudflareSecretKey string `env:"CLOUDFLARE_SECRET_KEY"`
26 | }
27 |
28 | var config Config
29 | var privateConfig PrivateConfig
30 |
31 | func LoadConfig() {
32 | // Config
33 | f, err := os.ReadFile("config.json")
34 | if err != nil {
35 | log.Fatal().Err(err).Send()
36 | }
37 |
38 | err = json.Unmarshal(f, &config)
39 | if err != nil {
40 | log.Fatal().Err(err).Send()
41 | }
42 |
43 | // Private config
44 |
45 | err = godotenv.Load()
46 | if err != nil {
47 | log.Fatal().Err(err).Send()
48 | }
49 |
50 | privateConfig = PrivateConfig{}
51 | err = env.Parse(&privateConfig)
52 | if err != nil {
53 | log.Fatal().Err(err).Send()
54 | }
55 | }
56 |
57 | func GetConfig() Config {
58 | return config
59 | }
60 |
61 | func GetPrivateConfig() PrivateConfig {
62 | return privateConfig
63 | }
64 |
--------------------------------------------------------------------------------
/pkg/core/email.go:
--------------------------------------------------------------------------------
1 | package core
2 |
3 | import (
4 | "fmt"
5 | "github.com/rs/zerolog/log"
6 | "net/smtp"
7 | )
8 |
9 | var emailAuth smtp.Auth
10 |
11 | func InitEmail() {
12 | emailAuth = smtp.PlainAuth("", "noreply@meteorclient.com", GetPrivateConfig().EmailPassword, "smtp.zoho.eu")
13 | }
14 |
15 | func SendEmail(to string, subject string, text string) {
16 | msg := []byte(fmt.Sprintf("From: Meteor \r\nTo: %s\r\nSubject: %s\r\n\r\n%s", to, subject, text))
17 | err := smtp.SendMail("smtp.zoho.eu:587", emailAuth, "noreply@meteorclient.com", []string{to}, msg)
18 |
19 | if err != nil {
20 | log.Err(err).Str("to", to).Msg("Failed to send email")
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/pkg/core/utils.go:
--------------------------------------------------------------------------------
1 | package core
2 |
3 | import (
4 | "encoding/json"
5 | "errors"
6 | "fmt"
7 | "github.com/rs/zerolog/log"
8 | "io"
9 | "mime/multipart"
10 | "net"
11 | "net/http"
12 | "os"
13 | "regexp"
14 | "strings"
15 | "time"
16 |
17 | "github.com/segmentio/ksuid"
18 | )
19 |
20 | type J map[string]interface{}
21 |
22 | var emailRegex = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
23 |
24 | var cidrs []*net.IPNet
25 |
26 | func Init() {
27 | maxCidrBlocks := []string{
28 | "127.0.0.1/8", // localhost
29 | "10.0.0.0/8", // 24-bit block
30 | "172.16.0.0/12", // 20-bit block
31 | "192.168.0.0/16", // 16-bit block
32 | "169.254.0.0/16", // link local address
33 | "::1/128", // localhost IPv6
34 | "fc00::/7", // unique local address IPv6
35 | "fe80::/10", // link local address IPv6
36 | }
37 |
38 | cidrs = make([]*net.IPNet, len(maxCidrBlocks))
39 | for i, maxCidrBlock := range maxCidrBlocks {
40 | _, cidr, _ := net.ParseCIDR(maxCidrBlock)
41 | cidrs[i] = cidr
42 | }
43 | }
44 |
45 | // IP https://github.com/tomasen/realip/blob/master/realip.go
46 | func IP(r *http.Request) string {
47 | // Try Cf-Connecting-Ip
48 | cfConnectingIp := r.Header.Get("Cf-Connecting-Ip")
49 |
50 | if cfConnectingIp != "" {
51 | return cfConnectingIp
52 | }
53 |
54 | // Fetch header value
55 | xRealIP := r.Header.Get("X-Real-Ip")
56 | xForwardedFor := r.Header.Get("X-Forwarded-For")
57 |
58 | // If both empty, return IP from remote address
59 | if xRealIP == "" && xForwardedFor == "" {
60 | var remoteIP string
61 |
62 | // If there are colon in remote address, remove the port number
63 | // otherwise, return remote address as is
64 | if strings.ContainsRune(r.RemoteAddr, ':') {
65 | remoteIP, _, _ = net.SplitHostPort(r.RemoteAddr)
66 | } else {
67 | remoteIP = r.RemoteAddr
68 | }
69 |
70 | return remoteIP
71 | }
72 |
73 | // Check list of IP in X-Forwarded-For and return the first global address
74 | for _, address := range strings.Split(xForwardedFor, ",") {
75 | address = strings.TrimSpace(address)
76 | isPrivate, err := isPrivateAddress(address)
77 | if !isPrivate && err == nil {
78 | return address
79 | }
80 | }
81 |
82 | // If nothing succeed, return X-Real-IP
83 | return xRealIP
84 | }
85 |
86 | func isPrivateAddress(address string) (bool, error) {
87 | ipAddress := net.ParseIP(address)
88 | if ipAddress == nil {
89 | return false, errors.New("address is not valid")
90 | }
91 |
92 | for i := range cidrs {
93 | if cidrs[i].Contains(ipAddress) {
94 | return true, nil
95 | }
96 | }
97 |
98 | return false, nil
99 | }
100 |
101 | func GetDate() string {
102 | dt := time.Now()
103 | return fmt.Sprintf("%02d-%02d-%d", dt.Day(), dt.Month(), dt.Year())
104 | }
105 |
106 | func GetAccountID(r *http.Request) ksuid.KSUID {
107 | id := r.Context().Value("id")
108 | return id.(ksuid.KSUID)
109 | }
110 |
111 | func IsEmailValid(email string) bool {
112 | length := len(email)
113 | if length < 3 && length > 254 {
114 | return false
115 | }
116 |
117 | if !emailRegex.MatchString(email) {
118 | return false
119 | }
120 |
121 | parts := strings.Split(email, "@")
122 | mx, err := net.LookupMX(parts[1])
123 | if err != nil || len(mx) == 0 {
124 | return false
125 | }
126 |
127 | return true
128 | }
129 |
130 | func Json(w http.ResponseWriter, v interface{}) {
131 | w.Header().Set("Content-Type", "application/json")
132 | w.WriteHeader(http.StatusOK)
133 |
134 | err := json.NewEncoder(w).Encode(v)
135 | if err != nil {
136 | log.Err(err).Msg("Failed to encode response")
137 | return
138 | }
139 | }
140 |
141 | func JsonError(w http.ResponseWriter, message interface{}) {
142 | w.Header().Set("Content-Type", "application/json")
143 | w.WriteHeader(http.StatusBadRequest)
144 |
145 | err := json.NewEncoder(w).Encode(J{"error": message})
146 | if err != nil {
147 | log.Err(err).Msg("Failed to encode response")
148 | return
149 | }
150 | }
151 |
152 | func Unauthorized(w http.ResponseWriter) {
153 | w.Header().Set("Content-Type", "application/json")
154 | w.WriteHeader(http.StatusUnauthorized)
155 |
156 | err := json.NewEncoder(w).Encode(J{"error": "Unauthorized."})
157 | if err != nil {
158 | log.Err(err).Msg("Failed to encode response")
159 | return
160 | }
161 | }
162 |
163 | func DownloadFile(formFile multipart.File, file *os.File, w http.ResponseWriter) bool {
164 | //goland:noinspection GoUnhandledErrorResult
165 | defer formFile.Close()
166 | //goland:noinspection GoUnhandledErrorResult
167 | defer file.Close()
168 |
169 | _, err := formFile.Seek(0, io.SeekStart)
170 | if err != nil {
171 | JsonError(w, "Server error. Failed to seek to the start of the file. Please contact developers.")
172 | return false
173 | }
174 |
175 | buf := make([]byte, 1024)
176 | for {
177 | n, err := formFile.Read(buf)
178 | if err != nil && err != io.EOF {
179 | JsonError(w, "Server error. Failed to read from sent cape file. Please contact developers.")
180 | return false
181 | }
182 |
183 | if n == 0 {
184 | break
185 | }
186 |
187 | _, err = file.Write(buf[:n])
188 | if err != nil {
189 | JsonError(w, "Server error. Failed to write to cape file. Please contact developers.")
190 | return false
191 | }
192 | }
193 |
194 | return true
195 | }
196 |
--------------------------------------------------------------------------------
/pkg/db/accounts.go:
--------------------------------------------------------------------------------
1 | package db
2 |
3 | import (
4 | "context"
5 | "errors"
6 | "fmt"
7 | "github.com/dboslee/lru"
8 | "github.com/google/uuid"
9 | "github.com/rs/zerolog/log"
10 | "github.com/segmentio/ksuid"
11 | "go.mongodb.org/mongo-driver/bson"
12 | "golang.org/x/crypto/bcrypt"
13 | "meteor-server/pkg/core"
14 | "meteor-server/pkg/discord"
15 | "net/http"
16 | "time"
17 | )
18 |
19 | type Account struct {
20 | ID ksuid.KSUID `bson:"id" json:"id"`
21 |
22 | Username string `bson:"username" json:"username"`
23 | Email string `bson:"email" json:"email"`
24 | Password []byte `bson:"password" json:"-"`
25 |
26 | Admin bool `bson:"admin" json:"admin"`
27 | Donator bool `bson:"donator" json:"donator"`
28 |
29 | DiscordID string `bson:"discord_id" json:"discord_id"`
30 |
31 | MaxMcAccounts int `bson:"max_mc_accounts" json:"max_mc_accounts"`
32 | McAccounts []uuid.UUID `bson:"mc_accounts" json:"mc_accounts"`
33 |
34 | Cape string `bson:"cape" json:"cape"`
35 | CanHaveCustomCape bool `bson:"can_have_custom_cape" json:"can_have_custom_cape"`
36 | }
37 |
38 | var usernameCache = lru.NewSync[ksuid.KSUID, string](lru.WithCapacity(20))
39 |
40 | var (
41 | AccountCount int64
42 | DonatorCount int64
43 | )
44 |
45 | func initAccounts() {
46 | ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
47 | defer cancel()
48 |
49 | var err error
50 |
51 | AccountCount, err = accounts.CountDocuments(ctx, bson.M{})
52 | if err != nil {
53 | log.Err(err).Msg("Failed to get the number of accounts")
54 | }
55 |
56 | DonatorCount, err = accounts.CountDocuments(ctx, bson.M{"donator": true})
57 | if err != nil {
58 | log.Err(err).Msg("Failed to get the number of donators")
59 | }
60 | }
61 |
62 | func NewAccount(username string, email string, password string) error {
63 | pass, err := bcrypt.GenerateFromPassword([]byte(password), 10)
64 | if err != nil {
65 | return err
66 | }
67 |
68 | _, err = accounts.InsertOne(nil, Account{
69 | ID: ksuid.New(),
70 |
71 | Username: username,
72 | Email: email,
73 | Password: pass,
74 |
75 | Admin: false,
76 | Donator: false,
77 |
78 | DiscordID: "",
79 |
80 | MaxMcAccounts: 1,
81 | McAccounts: []uuid.UUID{},
82 |
83 | Cape: "",
84 | CanHaveCustomCape: false,
85 | })
86 |
87 | return err
88 | }
89 |
90 | func GetAccount(r *http.Request) (Account, error) {
91 | var acc Account
92 | err := accounts.FindOne(nil, bson.M{"id": core.GetAccountID(r)}).Decode(&acc)
93 |
94 | return acc, err
95 | }
96 |
97 | func GetAccountId(id ksuid.KSUID) (Account, error) {
98 | var acc Account
99 | err := accounts.FindOne(nil, bson.M{"id": id}).Decode(&acc)
100 |
101 | return acc, err
102 | }
103 |
104 | func GetAccountDiscordId(id string) (Account, error) {
105 | var acc Account
106 | err := accounts.FindOne(nil, bson.M{"discord_id": id}).Decode(&acc)
107 |
108 | return acc, err
109 | }
110 |
111 | func GetAccountUuid(uuid uuid.UUID) (Account, error) {
112 | var acc Account
113 | err := accounts.FindOne(nil, bson.M{"mc_accounts": uuid}).Decode(&acc)
114 |
115 | return acc, err
116 | }
117 |
118 | func GetAccountsWithCape() []Account {
119 | cursor, err := accounts.Find(nil, bson.M{"cape": bson.M{"$ne": ""}})
120 | if err != nil {
121 | log.Fatal().Err(err).Send()
122 | }
123 |
124 | var acc []Account
125 | err = cursor.All(nil, &acc)
126 | if err != nil {
127 | log.Fatal().Err(err).Send()
128 | }
129 |
130 | return acc
131 | }
132 |
133 | func GetAccountWithUsername(username string) (Account, error) {
134 | var acc Account
135 | err := accounts.FindOne(nil, bson.M{"username": username}).Decode(&acc)
136 |
137 | return acc, err
138 | }
139 |
140 | func GetAccountWithEmail(email string) (Account, error) {
141 | var acc Account
142 | err := accounts.FindOne(nil, bson.M{"email": email}).Decode(&acc)
143 |
144 | return acc, err
145 | }
146 |
147 | func GetAccountWithUsernameOrEmail(name string) (Account, error) {
148 | acc, err := GetAccountWithUsername(name)
149 |
150 | if err != nil {
151 | acc, err = GetAccountWithEmail(name)
152 | }
153 |
154 | return acc, err
155 | }
156 |
157 | func GetAccountUsername(id ksuid.KSUID) (string, error) {
158 | username, ok := usernameCache.Get(id)
159 | if ok {
160 | return username, nil
161 | }
162 |
163 | account, err := GetAccountId(id)
164 | if err != nil {
165 | return "", err
166 | }
167 |
168 | usernameCache.Set(id, account.Username)
169 | return account.Username, nil
170 | }
171 |
172 | func (acc *Account) PasswordMatches(password string) bool {
173 | return bcrypt.CompareHashAndPassword(acc.Password, []byte(password)) == nil
174 | }
175 |
176 | func (acc *Account) LinkDiscord(id string) error {
177 | // Make sure an account with this discord id doesn't exist
178 | _, err := GetAccountDiscordId(id)
179 | if err == nil {
180 | return errors.New("Discord account already linked.")
181 | }
182 |
183 | // Put discord ID in database
184 | _, _ = accounts.UpdateOne(nil, bson.M{"id": acc.ID}, bson.M{"$set": bson.M{"discord_id": id}})
185 |
186 | // If the account has donator but not donator role, give it
187 | if acc.Donator {
188 | discord.AddRole(id, discord.DonorRole)
189 | discord.SendDonorMsg(id)
190 | }
191 |
192 | // Add account role regardless
193 | discord.AddRole(id, discord.AccountRole)
194 | return nil
195 | }
196 |
197 | func (acc *Account) UnlinkDiscord() {
198 | // Remove account related roles
199 | discord.RemoveRole(acc.DiscordID, discord.AccountRole)
200 | discord.RemoveRole(acc.DiscordID, discord.DonorRole)
201 |
202 | // Remove discord ID from database
203 | _, _ = accounts.UpdateOne(nil, bson.M{"id": acc.ID}, bson.M{"$set": bson.M{"discord_id": ""}})
204 | }
205 |
206 | func (acc *Account) AddMcAccount(id uuid.UUID) error {
207 | // Check maximum number of Minecraft accounts
208 | if len(acc.McAccounts) >= acc.MaxMcAccounts {
209 | return errors.New("Exceeded maximum number of Minecraft accounts.")
210 | }
211 |
212 | // Check for duplicate Minecraft accounts
213 | for _, mcAccount := range acc.McAccounts {
214 | if mcAccount == id {
215 | return errors.New("Account already has that Minecraft account linked.")
216 | }
217 | }
218 |
219 | _, _ = accounts.UpdateOne(nil, bson.M{"id": acc.ID}, bson.M{"$push": bson.M{"mc_accounts": id.String()}})
220 | return nil
221 | }
222 |
223 | func (acc *Account) RemoveMcAccount(id uuid.UUID) {
224 | _, _ = accounts.UpdateOne(nil, bson.M{"id": acc.ID}, bson.M{"$pull": bson.M{"mc_accounts": id.String()}})
225 | }
226 |
227 | func (acc *Account) SetUsername(username string) {
228 | _, _ = accounts.UpdateOne(nil, bson.M{"id": acc.ID}, bson.M{"$set": bson.M{"username": username}})
229 |
230 | usernameCache.Delete(acc.ID)
231 | }
232 |
233 | func (acc *Account) SetEmail(email string) {
234 | _, _ = accounts.UpdateOne(nil, bson.M{"id": acc.ID}, bson.M{"$set": bson.M{"email": email}})
235 | }
236 |
237 | func (acc *Account) SetPassword(password string) error {
238 | pass, err := bcrypt.GenerateFromPassword([]byte(password), 10)
239 | if err != nil {
240 | return err
241 | }
242 |
243 | _, _ = accounts.UpdateOne(nil, bson.M{"id": acc.ID}, bson.M{"$set": bson.M{"password": pass}})
244 | return nil
245 | }
246 |
247 | func (acc *Account) SetCape(id string) {
248 | _, _ = accounts.UpdateOne(nil, bson.M{"id": acc.ID}, bson.M{"$set": bson.M{"cape": id}})
249 | }
250 |
251 | func (acc *Account) GiveDonator(amount float64) {
252 | isMember := discord.IsMember(acc.DiscordID)
253 |
254 | username := acc.Username
255 | if isMember {
256 | username = fmt.Sprintf("<@%s>", acc.DiscordID)
257 | }
258 |
259 | discord.SendDonationMessage(username, amount)
260 |
261 | if acc.Donator {
262 | return
263 | }
264 |
265 | DonatorCount++
266 |
267 | _, _ = accounts.UpdateOne(nil, bson.M{"id": acc.ID}, bson.M{"$set": bson.M{"donator": true, "can_have_custom_cape": true, "cape": "donator"}})
268 |
269 | if isMember {
270 | discord.AddRole(acc.DiscordID, discord.AccountRole)
271 | discord.AddRole(acc.DiscordID, discord.DonorRole)
272 | discord.SendDonorMsg(acc.DiscordID)
273 | }
274 | }
275 |
--------------------------------------------------------------------------------
/pkg/db/addons.go:
--------------------------------------------------------------------------------
1 | package db
2 |
3 | import (
4 | "github.com/segmentio/ksuid"
5 | "go.mongodb.org/mongo-driver/bson"
6 | "go.mongodb.org/mongo-driver/mongo"
7 | "math"
8 | "time"
9 | )
10 |
11 | type Addon struct {
12 | ID string `bson:"id" json:"id"`
13 |
14 | Title string `bson:"title" json:"title"`
15 | Icon string `bson:"icon" json:"icon"`
16 | Description string `bson:"description" json:"description"`
17 | Markdown string `bson:"markdown" json:"markdown"`
18 |
19 | Developers []ksuid.KSUID `bson:"developers" json:"developers"`
20 |
21 | Version string `bson:"version" json:"version"`
22 | MeteorVersions []string `bson:"meteor_versions" json:"meteor_versions"`
23 | Download string `bson:"download" json:"download"`
24 |
25 | DownloadCount int `bson:"download_count" json:"download_count"`
26 |
27 | Website string `bson:"website" json:"website"`
28 | Source string `bson:"source" json:"source"`
29 | Support string `bson:"support" json:"support"`
30 |
31 | CreatedAt time.Time `bson:"created_at" json:"created_at"`
32 | UpdatedAt time.Time `bson:"updated_at" json:"updated_at"`
33 | }
34 |
35 | const pageSize = 15
36 |
37 | func GetAddon(id string) (Addon, error) {
38 | var addon Addon
39 | err := addons.FindOne(nil, bson.M{"id": id}).Decode(&addon)
40 |
41 | return addon, err
42 | }
43 |
44 | func SearchAddons(text string, page int) (*mongo.Cursor, int, error) {
45 | if page < 1 {
46 | page = 1
47 | }
48 |
49 | sort := bson.D{{"$sort", bson.D{
50 | {"download_count", -1},
51 | }}}
52 | skip := bson.D{{"$skip", (page - 1) * pageSize}}
53 | limit := bson.D{{"$limit", pageSize}}
54 |
55 | if text == "" {
56 | count, err := addons.EstimatedDocumentCount(nil)
57 | if err != nil {
58 | return nil, 0, err
59 | }
60 |
61 | cursor, err := addons.Aggregate(nil, mongo.Pipeline{
62 | sort,
63 | skip,
64 | limit,
65 | })
66 |
67 | return cursor, int(math.Ceil(float64(count) / pageSize)), err
68 | }
69 |
70 | count, err := addons.CountDocuments(nil, bson.M{"title": bson.M{"$regex": text, "$options": "i"}})
71 | if err != nil {
72 | return nil, 0, err
73 | }
74 |
75 | cursor, err := addons.Aggregate(nil, mongo.Pipeline{
76 | bson.D{{"$match", bson.D{
77 | {"title", bson.M{
78 | "$regex": text,
79 | "$options": "i",
80 | }},
81 | }}},
82 | sort,
83 | skip,
84 | limit,
85 | })
86 |
87 | return cursor, int(math.Ceil(float64(count) / pageSize)), err
88 | }
89 |
--------------------------------------------------------------------------------
/pkg/db/capes.go:
--------------------------------------------------------------------------------
1 | package db
2 |
3 | import (
4 | "github.com/rs/zerolog/log"
5 | "go.mongodb.org/mongo-driver/bson"
6 | )
7 |
8 | type Cape struct {
9 | ID string `bson:"id" json:"id"`
10 | Url string `bson:"url" json:"url"`
11 | }
12 |
13 | func GetAllCapes() []Cape {
14 | cursor, err := capes.Find(nil, bson.M{})
15 | if err != nil {
16 | log.Fatal().Err(err).Send()
17 | }
18 |
19 | var c []Cape
20 | err = cursor.All(nil, &c)
21 | if err != nil {
22 | log.Fatal().Err(err).Send()
23 | }
24 |
25 | return c
26 | }
27 |
28 | func GetCape(id string) (Cape, error) {
29 | var cape Cape
30 | err := capes.FindOne(nil, bson.M{"id": id}).Decode(&cape)
31 |
32 | return cape, err
33 | }
34 |
35 | func InsertCape(cape Cape) {
36 | _, _ = capes.DeleteOne(nil, bson.M{"id": cape.ID})
37 | _, _ = capes.InsertOne(nil, cape)
38 | }
39 |
--------------------------------------------------------------------------------
/pkg/db/db.go:
--------------------------------------------------------------------------------
1 | package db
2 |
3 | import (
4 | "github.com/google/uuid"
5 | "github.com/rs/zerolog/log"
6 | "go.mongodb.org/mongo-driver/bson"
7 | "go.mongodb.org/mongo-driver/bson/bsoncodec"
8 | "go.mongodb.org/mongo-driver/bson/bsonrw"
9 | "go.mongodb.org/mongo-driver/mongo"
10 | "go.mongodb.org/mongo-driver/mongo/options"
11 | "meteor-server/pkg/core"
12 | "reflect"
13 | )
14 |
15 | var client *mongo.Client
16 | var db *mongo.Database
17 |
18 | var global *mongo.Collection
19 | var accounts *mongo.Collection
20 | var capes *mongo.Collection
21 | var joinStats *mongo.Collection
22 | var addons *mongo.Collection
23 |
24 | func encodeUUID(c bsoncodec.EncodeContext, w bsonrw.ValueWriter, v reflect.Value) error {
25 | return w.WriteString(v.Interface().(uuid.UUID).String())
26 | }
27 |
28 | func decodeUUID(c bsoncodec.DecodeContext, r bsonrw.ValueReader, v reflect.Value) error {
29 | str, err := r.ReadString()
30 | if err != nil {
31 | return err
32 | }
33 |
34 | id, err := uuid.Parse(str)
35 | if err != nil {
36 | return err
37 | }
38 |
39 | v.Set(reflect.ValueOf(id))
40 | return nil
41 | }
42 |
43 | func Init() {
44 | tUUID := reflect.TypeOf(uuid.UUID{})
45 |
46 | registry := bson.NewRegistryBuilder().
47 | RegisterTypeEncoder(tUUID, bsoncodec.ValueEncoderFunc(encodeUUID)).
48 | RegisterTypeDecoder(tUUID, bsoncodec.ValueDecoderFunc(decodeUUID)).
49 | Build()
50 |
51 | var err error
52 | client, err = mongo.NewClient(options.Client().SetRegistry(registry).ApplyURI(core.GetPrivateConfig().MongoDBUrl))
53 | if err != nil {
54 | log.Fatal().Err(err).Send()
55 | }
56 |
57 | err = client.Connect(nil)
58 | if err != nil {
59 | log.Fatal().Err(err).Send()
60 | }
61 |
62 | db = client.Database("meteor-bot", options.Database())
63 |
64 | global = db.Collection("global", options.Collection())
65 | accounts = db.Collection("accounts", options.Collection())
66 | capes = db.Collection("capes", options.Collection())
67 | joinStats = db.Collection("join-stats", options.Collection())
68 | addons = db.Collection("addons", options.Collection())
69 |
70 | initAccounts()
71 | }
72 |
73 | func Close() {
74 | _ = client.Disconnect(nil)
75 | }
76 |
77 | func IncrementDownloads() {
78 | _, _ = global.UpdateOne(nil, bson.M{"id": "Stats"}, bson.M{"$inc": bson.M{"downloads": 1}})
79 | _, _ = joinStats.UpdateOne(nil, bson.M{"id": core.GetDate()}, bson.M{"$inc": bson.M{"downloads": 1}}, options.Update().SetUpsert(true))
80 | }
81 |
--------------------------------------------------------------------------------
/pkg/db/global.go:
--------------------------------------------------------------------------------
1 | package db
2 |
3 | import (
4 | "github.com/rs/zerolog/log"
5 | "go.mongodb.org/mongo-driver/bson"
6 | "time"
7 | )
8 |
9 | type Global struct {
10 | Downloads int `bson:"downloads"`
11 | TotalAccounts int `bson:"totalAccounts"`
12 | SupportMessage int64 `bson:"supportMessage"`
13 | }
14 |
15 | var cache Global
16 | var lastTime time.Time
17 |
18 | func GetGlobal() Global {
19 | now := time.Now()
20 |
21 | if now.Sub(lastTime) > time.Second {
22 | err := global.FindOne(nil, bson.M{"id": "Stats"}).Decode(&cache)
23 | lastTime = now
24 |
25 | if err != nil {
26 | log.Err(err).Msg("Failed to query global stats")
27 | }
28 | }
29 |
30 | return cache
31 | }
32 |
--------------------------------------------------------------------------------
/pkg/db/joinStats.go:
--------------------------------------------------------------------------------
1 | package db
2 |
3 | import (
4 | "go.mongodb.org/mongo-driver/bson"
5 | "meteor-server/pkg/core"
6 | )
7 |
8 | type JoinStats struct {
9 | ID string `bson:"id" json:"date"`
10 | Joins int `bson:"joins" json:"joins"`
11 | Leaves int `bson:"leaves" json:"leaves"`
12 | Downloads int `bson:"downloads" json:"downloads"`
13 | }
14 |
15 | func GetJoinStats(date string) (JoinStats, error) {
16 | var stats JoinStats
17 | var err = joinStats.FindOne(nil, bson.M{"id": date}).Decode(&stats)
18 |
19 | return stats, err
20 | }
21 |
22 | func IncrementJoins() {
23 | _, _ = joinStats.UpdateOne(nil, bson.M{"id": core.GetDate()}, bson.M{"$inc": bson.M{"joins": 1}})
24 | }
25 |
26 | func IncrementLeaves() {
27 | _, _ = joinStats.UpdateOne(nil, bson.M{"id": core.GetDate()}, bson.M{"$inc": bson.M{"leaves": 1}})
28 | }
29 |
--------------------------------------------------------------------------------
/pkg/discord/discord.go:
--------------------------------------------------------------------------------
1 | package discord
2 |
3 | import (
4 | "bytes"
5 | "encoding/json"
6 | "fmt"
7 | "meteor-server/pkg/core"
8 | "net/http"
9 | )
10 |
11 | type User struct {
12 | Username string
13 | Discriminator string
14 | Avatar string
15 | }
16 |
17 | type member struct {
18 | Roles []string
19 | }
20 |
21 | const (
22 | Guild = "689197705683140636"
23 | AccountRole = "777248653445300264"
24 | DonorRole = "689205464574984353"
25 | DonorChat = "713429344135020554"
26 | DevRole = "689198253753106480"
27 | )
28 |
29 | var client = http.Client{}
30 |
31 | func send(method string, url string) *http.Response {
32 | req, _ := http.NewRequest(method, "https://discord.com/api/"+url, bytes.NewReader([]byte{}))
33 | req.Header.Set("User-Agent", "Meteor Server")
34 | req.Header.Set("Authorization", "Bot "+core.GetPrivateConfig().DiscordToken)
35 |
36 | res, _ := client.Do(req)
37 | return res
38 | }
39 |
40 | func GetUser(id string) User {
41 | res := send("GET", "users/"+id)
42 |
43 | var user User
44 | _ = json.NewDecoder(res.Body).Decode(&user)
45 |
46 | _ = res.Body.Close()
47 | return user
48 | }
49 |
50 | func IsMember(id string) bool {
51 | return send("GET", "guilds/"+Guild+"/members/"+id).StatusCode == 200
52 | }
53 |
54 | func AddRole(user string, role string) {
55 | if !HasRole(user, role) {
56 | _ = send("PUT", "guilds/"+Guild+"/members/"+user+"/roles/"+role).Body.Close()
57 | }
58 | }
59 |
60 | func RemoveRole(user string, role string) {
61 | if HasRole(user, role) {
62 | _ = send("DELETE", "guilds/"+Guild+"/members/"+user+"/roles/"+role).Body.Close()
63 | }
64 | }
65 |
66 | func HasRole(user string, role string) bool {
67 | res := send("GET", "guilds/"+Guild+"/members/"+user)
68 |
69 | var member member
70 | _ = json.NewDecoder(res.Body).Decode(&member)
71 |
72 | _ = res.Body.Close()
73 |
74 | for _, r := range member.Roles {
75 | if r == role {
76 | return true
77 | }
78 | }
79 |
80 | return false
81 | }
82 |
83 | func SendMessage(channel string, message string) {
84 | body := []byte(fmt.Sprintf(`{ "content": "%s" }`, message))
85 | req, _ := http.NewRequest("POST", "https://discord.com/api/channels/"+channel+"/messages", bytes.NewBuffer(body))
86 | req.Header.Set("User-Agent", "Meteor Server")
87 | req.Header.Set("Authorization", "Bot "+core.GetPrivateConfig().DiscordToken)
88 | req.Header.Set("Content-Type", "application/json")
89 | _, _ = client.Do(req)
90 | }
91 |
92 | func SendDonorMsg(user string) {
93 | SendMessage(DonorChat, fmt.Sprintf("Hi <@%s>, welcome to the exclusive donator chat.\nHead over to to see your new perks!", user))
94 | }
95 |
96 | func SendDonationMessage(user string, amount float64) {
97 | SendMessage(DonorChat, fmt.Sprintf("<@&%s> %s just donated €%.2f!", DevRole, user, amount))
98 | }
99 |
--------------------------------------------------------------------------------
/pkg/web/api/account.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/meyskens/go-turnstile"
6 | "image"
7 | _ "image/png"
8 | "meteor-server/pkg/discord"
9 | "net/http"
10 | "os"
11 | "strings"
12 | "time"
13 |
14 | "github.com/google/uuid"
15 |
16 | "meteor-server/pkg/auth"
17 | "meteor-server/pkg/core"
18 | "meteor-server/pkg/db"
19 |
20 | "github.com/segmentio/ksuid"
21 | )
22 |
23 | type capeInfo struct {
24 | db.Cape
25 | Title string `json:"title"`
26 | Current bool `json:"current"`
27 | }
28 |
29 | type accountInfo struct {
30 | db.Account
31 | DiscordName string `json:"discord_name"`
32 | DiscordAvatar string `json:"discord_avatar"`
33 | Capes []capeInfo `json:"capes"`
34 | }
35 |
36 | type mcUser struct {
37 | Id string
38 | }
39 |
40 | type passwordChangeInfo struct {
41 | accountId ksuid.KSUID
42 | time time.Time
43 | data string
44 | }
45 |
46 | type accountTimeInfo struct {
47 | accountId ksuid.KSUID
48 | time time.Time
49 | }
50 |
51 | var changeEmailTokens = make(map[ksuid.KSUID]passwordChangeInfo)
52 | var discordLinkTokens = make(map[ksuid.KSUID]accountTimeInfo)
53 | var forgotPasswordTokens = make(map[ksuid.KSUID]accountTimeInfo)
54 |
55 | var ts *turnstile.Turnstile
56 |
57 | func SetupTurnstile() {
58 | ts = turnstile.New(core.GetPrivateConfig().CloudflareSecretKey)
59 | }
60 |
61 | func RegisterHandler(w http.ResponseWriter, r *http.Request) {
62 | resp, err := ts.Verify(r.FormValue("cf-token"), core.IP(r))
63 | if err != nil || !resp.Success {
64 | core.JsonError(w, "Failed to verify captcha, please try again.")
65 | return
66 | }
67 |
68 | err = auth.Register(r.FormValue("username"), r.FormValue("email"), r.FormValue("password"))
69 | if err != nil {
70 | core.JsonError(w, err.Error())
71 | return
72 | }
73 |
74 | core.Json(w, core.J{})
75 | }
76 |
77 | func ConfirmEmailHandler(w http.ResponseWriter, r *http.Request) {
78 | token, err := ksuid.Parse(r.URL.Query().Get("token"))
79 | if err != nil {
80 | core.JsonError(w, "Invalid token.")
81 | return
82 | }
83 |
84 | if !auth.ConfirmEmail(token) {
85 | core.JsonError(w, "Failed to confirm email address.")
86 | return
87 | }
88 |
89 | db.AccountCount++
90 |
91 | core.Json(w, core.J{})
92 | }
93 |
94 | func LoginHandler(w http.ResponseWriter, r *http.Request) {
95 | q := r.URL.Query()
96 |
97 | token, err := auth.Login(q.Get("name"), q.Get("password"))
98 | if err != nil {
99 | core.JsonError(w, "Wrong name or password.")
100 | return
101 | }
102 |
103 | core.Json(w, core.J{"token": token})
104 | }
105 |
106 | func LogoutHandler(w http.ResponseWriter, r *http.Request) {
107 | err := auth.Logout(r.Header.Get("Authorization"), core.GetAccountID(r))
108 | if err != nil {
109 | core.JsonError(w, err)
110 | return
111 | }
112 |
113 | core.Json(w, core.J{})
114 | }
115 |
116 | func newCapeInfo(cape db.Cape, account db.Account, title string) capeInfo {
117 | return capeInfo{
118 | cape,
119 | title,
120 | cape.ID == account.Cape,
121 | }
122 | }
123 |
124 | func getAccountInfo(account db.Account) accountInfo {
125 | info := accountInfo{account, "", "", make([]capeInfo, 0)}
126 |
127 | // Discord info
128 | if account.DiscordID != "" {
129 | user := discord.GetUser(account.DiscordID)
130 |
131 | info.DiscordName = user.Username
132 | info.DiscordAvatar = "https://cdn.discordapp.com/avatars/" + account.DiscordID + "/" + user.Avatar + ".jpg"
133 | }
134 |
135 | // Capes
136 | info.Capes = append(info.Capes, newCapeInfo(db.Cape{"", ""}, account, "None"))
137 | if account.Donator {
138 | cape, _ := db.GetCape("donator")
139 | info.Capes = append(info.Capes, newCapeInfo(cape, account, "Donator"))
140 | }
141 | if account.Admin {
142 | cape, _ := db.GetCape("moderator")
143 | info.Capes = append(info.Capes, newCapeInfo(cape, account, "Moderator"))
144 | }
145 | if account.CanHaveCustomCape {
146 | cape, err := db.GetCape("account_" + account.ID.String())
147 | if err == nil {
148 | info.Capes = append(info.Capes, newCapeInfo(cape, account, "Custom"))
149 | }
150 | }
151 |
152 | return info
153 | }
154 |
155 | func AccountInfoHandler(w http.ResponseWriter, r *http.Request) {
156 | account, err := db.GetAccount(r)
157 | if err != nil {
158 | core.JsonError(w, "Could not get account.")
159 | return
160 | }
161 |
162 | core.Json(w, getAccountInfo(account))
163 | }
164 |
165 | func GetAccountByMcUuid(w http.ResponseWriter, r *http.Request) {
166 | id, err := uuid.Parse(r.URL.Query().Get("uuid"))
167 | if err != nil {
168 | core.JsonError(w, "Invalid UUID.")
169 | return
170 | }
171 |
172 | account, err := db.GetAccountUuid(id)
173 | if err != nil {
174 | core.JsonError(w, "No account linked to this UUID.")
175 | return
176 | }
177 |
178 | core.Json(w, getAccountInfo(account))
179 | }
180 |
181 | func GenerateDiscordLinkTokenHandler(w http.ResponseWriter, r *http.Request) {
182 | // Get account
183 | account, err := db.GetAccount(r)
184 | if err != nil {
185 | core.JsonError(w, "Could not get account.")
186 | return
187 | }
188 |
189 | token := ksuid.New()
190 | discordLinkTokens[token] = accountTimeInfo{account.ID, time.Now()}
191 |
192 | core.Json(w, core.J{"token": token})
193 | }
194 |
195 | func LinkDiscordHandler(w http.ResponseWriter, r *http.Request) {
196 | // Validate token
197 | tokenStr := r.URL.Query().Get("token")
198 |
199 | token, err := ksuid.Parse(tokenStr)
200 | if err != nil {
201 | core.JsonError(w, "Invalid token.")
202 | return
203 | }
204 |
205 | info, exists := discordLinkTokens[token]
206 | if !exists {
207 | core.JsonError(w, "Invalid token.")
208 | return
209 | }
210 |
211 | delete(discordLinkTokens, token)
212 |
213 | if time.Now().Sub(info.time).Minutes() > 5 {
214 | core.JsonError(w, "Invalid token.")
215 | return
216 | }
217 |
218 | account, err := db.GetAccountId(info.accountId)
219 | if err != nil {
220 | core.JsonError(w, "Invalid token.")
221 | return
222 | }
223 |
224 | // Link
225 | id := r.URL.Query().Get("id")
226 |
227 | err = account.LinkDiscord(id)
228 | if err != nil {
229 | core.JsonError(w, err.Error())
230 | return
231 | }
232 |
233 | core.Json(w, core.J{})
234 | }
235 |
236 | func UnlinkDiscordHandler(w http.ResponseWriter, r *http.Request) {
237 | // Get account
238 | account, err := db.GetAccount(r)
239 | if err != nil {
240 | core.JsonError(w, "Could not get account.")
241 | return
242 | }
243 |
244 | account.UnlinkDiscord()
245 |
246 | core.Json(w, core.J{})
247 | }
248 |
249 | func McAccountHandler(w http.ResponseWriter, r *http.Request) {
250 | // Get account
251 | account, err := db.GetAccount(r)
252 | if err != nil {
253 | core.JsonError(w, "Could not get account.")
254 | return
255 | }
256 |
257 | if r.Method == "POST" {
258 | code := r.URL.Query().Get("code")
259 | if code == "" {
260 | core.JsonError(w, "Invalid code")
261 | return
262 | }
263 |
264 | res, err := http.Get("http://mcauth:8080/retrieve/" + code)
265 | if err != nil {
266 | core.JsonError(w, "Failed to retrieve code's UUID. "+err.Error())
267 | return
268 | }
269 |
270 | //goland:noinspection GoUnhandledErrorResult
271 | defer res.Body.Close()
272 |
273 | if res.StatusCode != http.StatusOK {
274 | var data struct{ Error string }
275 |
276 | err := json.NewDecoder(res.Body).Decode(&data)
277 | if err != nil {
278 | core.JsonError(w, "Failed to parse code's UUID Error")
279 | return
280 | }
281 |
282 | core.JsonError(w, data.Error)
283 | return
284 | }
285 |
286 | var data struct{ Uuid string }
287 |
288 | err = json.NewDecoder(res.Body).Decode(&data)
289 | if err != nil {
290 | core.JsonError(w, "Failed to parse code's UUID")
291 | return
292 | }
293 |
294 | id, err := uuid.Parse(data.Uuid)
295 | if err != nil {
296 | core.JsonError(w, "Invalid UUID")
297 | return
298 | }
299 |
300 | err = account.AddMcAccount(id)
301 | if err != nil {
302 | core.JsonError(w, err.Error())
303 | return
304 | }
305 |
306 | UpdateCapes()
307 | } else {
308 | // Get Minecraft UUID
309 | id, err := uuid.Parse(r.URL.Query().Get("uuid"))
310 | if err != nil {
311 | core.JsonError(w, "Invalid UUID.")
312 | return
313 | }
314 |
315 | // Remove Minecraft account
316 | account.RemoveMcAccount(id)
317 | UpdateCapes()
318 | }
319 |
320 | core.Json(w, core.J{})
321 | }
322 |
323 | func SelectCapeHandler(w http.ResponseWriter, r *http.Request) {
324 | // Get account
325 | account, err := db.GetAccount(r)
326 | if err != nil {
327 | core.JsonError(w, "Could not get account.")
328 | return
329 | }
330 |
331 | id := r.URL.Query().Get("cape")
332 |
333 | if id == "" || (id == "donator" && account.Donator) || (id == "moderator" && account.Admin) || (id == "account_"+account.ID.String() && account.CanHaveCustomCape) {
334 | account.SetCape(id)
335 | UpdateCapes()
336 |
337 | core.Json(w, core.J{})
338 | } else {
339 | core.JsonError(w, "Cannot select this cape.")
340 | }
341 | }
342 |
343 | func UploadCapeHandler(w http.ResponseWriter, r *http.Request) {
344 | // Get account
345 | account, err := db.GetAccount(r)
346 | if err != nil {
347 | core.JsonError(w, "Could not get account.")
348 | return
349 | }
350 |
351 | // Validate file
352 | formFile, header, err := r.FormFile("file")
353 | if err != nil {
354 | core.JsonError(w, "Invalid file.")
355 | return
356 | }
357 |
358 | if !strings.HasSuffix(header.Filename, ".png") {
359 | core.JsonError(w, "File needs to be a PNG.")
360 | return
361 | }
362 |
363 | config, _, err := image.DecodeConfig(formFile)
364 | if err != nil {
365 | core.JsonError(w, "Failed to read image file.")
366 | return
367 | }
368 |
369 | if config.Height*2 != config.Width {
370 | core.JsonError(w, "Wrong size. Width of the image must be 2 times larger than the height.")
371 | return
372 | }
373 |
374 | if config.Width > 1024 || config.Height > 1024 {
375 | core.JsonError(w, "Wrong size. Maximum image size is 1024 by 512.")
376 | return
377 | }
378 |
379 | // Save file
380 | file, err := os.Create("data/capes/account_" + account.ID.String() + ".png")
381 | if err != nil {
382 | core.JsonError(w, "Server error. Failed to create cape file. Please contact developers.")
383 | return
384 | }
385 |
386 | if !core.DownloadFile(formFile, file, w) {
387 | return
388 | }
389 |
390 | cape := db.Cape{ID: "account_" + account.ID.String(), Url: "https://meteorclient.com/" + strings.TrimPrefix(file.Name(), "data/")}
391 | db.InsertCape(cape)
392 |
393 | UpdateCapes()
394 | core.Json(w, core.J{})
395 | }
396 |
397 | func ChangeUsernameHandler(w http.ResponseWriter, r *http.Request) {
398 | // Get account
399 | account, err := db.GetAccount(r)
400 | if err != nil {
401 | core.JsonError(w, "Could not get account.")
402 | return
403 | }
404 |
405 | // Validate username
406 | username := r.URL.Query().Get("username")
407 | if username == "" || strings.ContainsRune(username, ' ') {
408 | core.JsonError(w, "Invalid username.")
409 | return
410 | }
411 |
412 | _, err = db.GetAccountWithUsername(username)
413 | if err == nil {
414 | core.JsonError(w, "Account with this username already exists.")
415 | return
416 | }
417 |
418 | // Change username
419 | account.SetUsername(username)
420 | core.Json(w, core.J{})
421 | }
422 |
423 | func ChangeEmailHandler(w http.ResponseWriter, r *http.Request) {
424 | // Get account
425 | account, err := db.GetAccount(r)
426 | if err != nil {
427 | core.JsonError(w, "Could not get account.")
428 | return
429 | }
430 |
431 | // Validate email
432 | email := r.URL.Query().Get("email")
433 |
434 | if !core.IsEmailValid(email) {
435 | core.JsonError(w, "Invalid email.")
436 | return
437 | }
438 |
439 | _, err = db.GetAccountWithEmail(email)
440 | if err == nil {
441 | core.JsonError(w, "Email already in use.")
442 | return
443 | }
444 |
445 | // Send email
446 | token := ksuid.New()
447 | changeEmailTokens[token] = passwordChangeInfo{account.ID, time.Now(), email}
448 |
449 | core.SendEmail(account.Email, "Confirm new email", "To change the email to "+email+" go to https://meteorclient.com/confirmChangeEmail?token="+token.String()+" . The link is valid for 15 minutes.")
450 | core.Json(w, core.J{})
451 | }
452 |
453 | func ConfirmChangeEmailHandler(w http.ResponseWriter, r *http.Request) {
454 | // Validate token
455 | tokenStr := r.URL.Query().Get("token")
456 | if tokenStr == "" {
457 | core.JsonError(w, "Invalid token.")
458 | return
459 | }
460 |
461 | token, err := ksuid.Parse(tokenStr)
462 | if err != nil {
463 | core.JsonError(w, "Invalid token.")
464 | return
465 | }
466 |
467 | info, exists := changeEmailTokens[token]
468 | if !exists {
469 | core.JsonError(w, "Invalid token.")
470 | return
471 | }
472 |
473 | delete(changeEmailTokens, token)
474 | if time.Now().Sub(info.time).Minutes() > 15 {
475 | core.JsonError(w, "Outdated token.")
476 | return
477 | }
478 |
479 | // Change email
480 | account, err := db.GetAccountId(info.accountId)
481 | if err != nil {
482 | core.JsonError(w, "Invalid token.")
483 | return
484 | }
485 |
486 | account.SetEmail(info.data)
487 | http.Redirect(w, r, "https://meteorclient.com/account", http.StatusPermanentRedirect)
488 | }
489 |
490 | func ConfirmChangeEmailHandlerApi(w http.ResponseWriter, r *http.Request) {
491 | // Validate token
492 | tokenStr := r.URL.Query().Get("token")
493 | if tokenStr == "" {
494 | core.JsonError(w, "Invalid token.")
495 | return
496 | }
497 |
498 | token, err := ksuid.Parse(tokenStr)
499 | if err != nil {
500 | core.JsonError(w, "Invalid token.")
501 | return
502 | }
503 |
504 | info, exists := changeEmailTokens[token]
505 | if !exists {
506 | core.JsonError(w, "Invalid token.")
507 | return
508 | }
509 |
510 | delete(changeEmailTokens, token)
511 | if time.Now().Sub(info.time).Minutes() > 15 {
512 | core.JsonError(w, "Outdated token.")
513 | return
514 | }
515 |
516 | // Change email
517 | account, err := db.GetAccountId(info.accountId)
518 | if err != nil {
519 | core.JsonError(w, "Invalid token.")
520 | return
521 | }
522 |
523 | account.SetEmail(info.data)
524 |
525 | // Invalidate tokens
526 | auth.Invalidate(account.ID)
527 |
528 | core.Json(w, core.J{})
529 | }
530 |
531 | func ChangePasswordHandler(w http.ResponseWriter, r *http.Request) {
532 | // Get account
533 | account, err := db.GetAccount(r)
534 | if err != nil {
535 | core.JsonError(w, "Could not get account.")
536 | return
537 | }
538 |
539 | // Validate old password
540 | oldPass := r.URL.Query().Get("old")
541 | if !account.PasswordMatches(oldPass) {
542 | core.JsonError(w, "Wrong old password.")
543 | return
544 | }
545 |
546 | // Validate new password
547 | newPass := r.URL.Query().Get("new")
548 | if newPass == "" || strings.ContainsRune(newPass, ' ') {
549 | core.JsonError(w, "Invalid new password.")
550 | return
551 | }
552 |
553 | // Change password
554 | err = account.SetPassword(newPass)
555 | if err != nil {
556 | core.JsonError(w, "Invalid password.")
557 | return
558 | }
559 |
560 | // Invalidate tokens
561 | auth.Invalidate(account.ID)
562 |
563 | core.Json(w, core.J{})
564 | }
565 |
566 | func ChangePasswordTokenHandler(w http.ResponseWriter, r *http.Request) {
567 | // Validate token
568 | tokenRaw := r.URL.Query().Get("token")
569 | token, err := ksuid.Parse(tokenRaw)
570 | if err != nil {
571 | core.JsonError(w, "Invalid token.")
572 | return
573 | }
574 |
575 | info, exists := forgotPasswordTokens[token]
576 | if !exists {
577 | core.JsonError(w, "Invalid token.")
578 | return
579 | }
580 |
581 | delete(forgotPasswordTokens, token)
582 | if time.Now().Sub(info.time).Minutes() > 15 {
583 |
584 | core.JsonError(w, "Outdated token.")
585 | return
586 | }
587 |
588 | // Get account
589 | account, err := db.GetAccountId(info.accountId)
590 | if err != nil {
591 | core.JsonError(w, "Invalid token.")
592 | return
593 | }
594 |
595 | // Validate new password
596 | newPass := r.URL.Query().Get("new")
597 | if newPass == "" || strings.ContainsRune(newPass, ' ') {
598 | core.JsonError(w, "Invalid new password.")
599 | return
600 | }
601 |
602 | // Change password
603 | err = account.SetPassword(newPass)
604 | if err != nil {
605 | core.JsonError(w, "Invalid password.")
606 | return
607 | }
608 |
609 | // Invalidate tokens
610 | auth.Invalidate(account.ID)
611 |
612 | core.Json(w, core.J{})
613 | }
614 |
615 | func ForgotPasswordHandler(w http.ResponseWriter, r *http.Request) {
616 | email := r.URL.Query().Get("email")
617 | if email == "" {
618 | core.JsonError(w, "Invalid email.")
619 | return
620 | }
621 |
622 | account, err := db.GetAccountWithEmail(email)
623 | if err != nil {
624 | core.JsonError(w, "Invalid email.")
625 | return
626 | }
627 |
628 | token := ksuid.New()
629 | forgotPasswordTokens[token] = accountTimeInfo{account.ID, time.Now()}
630 |
631 | core.SendEmail(email, "Forgot password", "To change the password to "+email+" go to https://meteorclient.com/changePassword?token="+token.String()+" . The link is valid for 15 minutes.")
632 | core.Json(w, core.J{})
633 | }
634 |
--------------------------------------------------------------------------------
/pkg/web/api/addons.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/segmentio/ksuid"
5 | "meteor-server/pkg/core"
6 | "meteor-server/pkg/db"
7 | "net/http"
8 | "strconv"
9 | "time"
10 | )
11 |
12 | type apiAddonDeveloper struct {
13 | ID ksuid.KSUID `json:"id"`
14 | Username string `json:"username"`
15 | }
16 |
17 | type apiAddon struct {
18 | ID string `bson:"id" json:"id"`
19 |
20 | Title string `json:"title"`
21 | Icon string `json:"icon"`
22 | Description string `json:"description"`
23 | Markdown string `json:"markdown"`
24 |
25 | Developers []apiAddonDeveloper `json:"developers"`
26 |
27 | Version string `json:"version"`
28 | MeteorVersions []string `json:"meteor_versions"`
29 | Download string `json:"download"`
30 |
31 | DownloadCount int `json:"download_count"`
32 |
33 | Website string `json:"website"`
34 | Source string `json:"source"`
35 | Support string `json:"support"`
36 |
37 | CreatedAt time.Time `json:"created_at"`
38 | UpdatedAt time.Time `json:"updated_at"`
39 | }
40 |
41 | func GetAddonById(w http.ResponseWriter, r *http.Request) {
42 | id := r.URL.Query().Get("id")
43 | if id == "" {
44 | core.JsonError(w, "Invalid ID.")
45 | return
46 | }
47 |
48 | addon, err := db.GetAddon(id)
49 | if err != nil {
50 | core.JsonError(w, "No addon with this ID.")
51 | return
52 | }
53 |
54 | core.Json(w, getApiAddon(addon, true))
55 | }
56 |
57 | func SearchAddons(w http.ResponseWriter, r *http.Request) {
58 | page, err := strconv.Atoi(r.URL.Query().Get("page"))
59 | if err != nil {
60 | page = 1
61 | }
62 |
63 | cursor, pageCount, err := db.SearchAddons(r.URL.Query().Get("text"), page)
64 | //goland:noinspection GoUnhandledErrorResult
65 | defer cursor.Close(r.Context())
66 |
67 | if err != nil {
68 | core.JsonError(w, "Failed to search for addons.")
69 | return
70 | }
71 |
72 | addons := make([]apiAddon, 0)
73 |
74 | for {
75 | has := cursor.TryNext(r.Context())
76 | if !has {
77 | break
78 | }
79 |
80 | var addon db.Addon
81 | err := cursor.Decode(&addon)
82 | if err != nil {
83 | core.JsonError(w, "Failed to retrieve addons.")
84 | return
85 | }
86 |
87 | addons = append(addons, getApiAddon(addon, false))
88 | }
89 |
90 | core.Json(w, core.J{"page_count": pageCount, "addons": addons})
91 | _ = cursor.Close(nil)
92 | }
93 |
94 | func getApiAddon(addon db.Addon, includeMarkdown bool) apiAddon {
95 | markdown := ""
96 | if includeMarkdown {
97 | markdown = addon.Markdown
98 | }
99 |
100 | developers := make([]apiAddonDeveloper, 0, len(addon.Developers))
101 |
102 | for _, developer := range addon.Developers {
103 | username, err := db.GetAccountUsername(developer)
104 |
105 | if err == nil {
106 | developers = append(developers, apiAddonDeveloper{
107 | ID: developer,
108 | Username: username,
109 | })
110 | }
111 | }
112 |
113 | return apiAddon{
114 | ID: addon.ID,
115 | Title: addon.Title,
116 | Icon: addon.Icon,
117 | Description: addon.Description,
118 | Markdown: markdown,
119 | Developers: developers,
120 | Version: addon.Version,
121 | MeteorVersions: addon.MeteorVersions,
122 | Download: addon.Download,
123 | DownloadCount: addon.DownloadCount,
124 | Website: addon.Website,
125 | Source: addon.Source,
126 | Support: addon.Support,
127 | CreatedAt: addon.CreatedAt,
128 | UpdatedAt: addon.UpdatedAt,
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/pkg/web/api/capes.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "meteor-server/pkg/db"
5 | "net/http"
6 | "strings"
7 | )
8 |
9 | var capes []byte
10 | var capeOwners []byte
11 |
12 | func CapesHandler(w http.ResponseWriter, r *http.Request) {
13 | _, _ = w.Write(capes)
14 | }
15 |
16 | func CapeOwnersHandler(w http.ResponseWriter, r *http.Request) {
17 | _, _ = w.Write(capeOwners)
18 | }
19 |
20 | func UpdateCapes() {
21 | // Capes
22 | sb := strings.Builder{}
23 |
24 | for i, cape := range db.GetAllCapes() {
25 | if i > 0 {
26 | sb.WriteRune('\n')
27 | }
28 |
29 | sb.WriteString(cape.ID)
30 | sb.WriteRune(' ')
31 | sb.WriteString(cape.Url)
32 | }
33 |
34 | capes = []byte(sb.String())
35 |
36 | // Cape owners
37 | sb = strings.Builder{}
38 |
39 | i := 0
40 | for _, account := range db.GetAccountsWithCape() {
41 | if len(account.McAccounts) > 0 {
42 | cape := account.Cape
43 | if cape == "custom" {
44 | cape = "account_" + account.ID.String()
45 | }
46 |
47 | for _, uuid := range account.McAccounts {
48 | if i > 0 {
49 | sb.WriteRune('\n')
50 | }
51 |
52 | sb.WriteString(uuid.String())
53 | sb.WriteRune(' ')
54 | sb.WriteString(cape)
55 |
56 | i++
57 | }
58 | }
59 | }
60 |
61 | capeOwners = []byte(sb.String())
62 | }
63 |
--------------------------------------------------------------------------------
/pkg/web/api/discord.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "meteor-server/pkg/db"
5 | "meteor-server/pkg/discord"
6 | "net/http"
7 | )
8 |
9 | func DiscordUserJoinedHandler(_ http.ResponseWriter, r *http.Request) {
10 | db.IncrementJoins()
11 |
12 | id := r.URL.Query().Get("id")
13 | if id == "" {
14 | return
15 | }
16 |
17 | account, err := db.GetAccountDiscordId(id)
18 | if err != nil {
19 | return
20 | }
21 |
22 | discord.AddRole(account.DiscordID, discord.AccountRole)
23 |
24 | if account.Donator {
25 | discord.AddRole(account.DiscordID, discord.DonorRole)
26 | discord.SendDonorMsg(account.DiscordID)
27 | }
28 | }
29 |
30 | func DiscordUserLeftHandler(_ http.ResponseWriter, _ *http.Request) {
31 | db.IncrementLeaves()
32 | }
33 |
--------------------------------------------------------------------------------
/pkg/web/api/download.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "encoding/xml"
5 | "fmt"
6 | "io"
7 | "meteor-server/pkg/core"
8 | "meteor-server/pkg/db"
9 | "net/http"
10 | )
11 |
12 | type mavenMetadata struct {
13 | ArtifactId string `xml:"artifactId"`
14 |
15 | Versioning struct {
16 | SnapshotVersions struct {
17 | List []mavenMetadataSnapshotVersion `xml:"snapshotVersion"`
18 | } `xml:"snapshotVersions"`
19 | } `xml:"versioning"`
20 | }
21 |
22 | type mavenMetadataSnapshotVersion struct {
23 | Extension string `xml:"extension"`
24 | Value string `xml:"value"`
25 | }
26 |
27 | func DownloadHandler(w http.ResponseWriter, r *http.Request) {
28 | version, build := GetLatestVersion()
29 |
30 | if v := r.URL.Query().Get("version"); v != "" {
31 | version = v
32 | build = GetVersionBuild(v)
33 | }
34 |
35 | downloadFromMaven(
36 | w, r,
37 | "https://maven.meteordev.org/snapshots/meteordevelopment/meteor-client/"+version+"-SNAPSHOT",
38 | fmt.Sprintf("meteor-client-%s-%d.jar", version, build),
39 | )
40 |
41 | db.IncrementDownloads()
42 | }
43 |
44 | func DownloadBaritoneHandler(w http.ResponseWriter, r *http.Request) {
45 | version := r.URL.Query().Get("version")
46 |
47 | if version == "" {
48 | version = core.GetConfig().BaritoneMcVersion
49 | }
50 |
51 | downloadFromMaven(
52 | w, r,
53 | "https://maven.meteordev.org/snapshots/meteordevelopment/baritone/"+version+"-SNAPSHOT",
54 | fmt.Sprintf("baritone-meteor-%s.jar", version),
55 | )
56 | }
57 |
58 | func downloadFromMaven(w http.ResponseWriter, r *http.Request, url string, filename string) {
59 | // Get maven version
60 | res, err := http.Get(url + "/maven-metadata.xml")
61 | if err != nil {
62 | core.JsonError(w, "Failed to get maven version.")
63 | return
64 | }
65 |
66 | //goland:noinspection GoUnhandledErrorResult
67 | defer res.Body.Close()
68 |
69 | if res.StatusCode != http.StatusOK {
70 | core.JsonError(w, "Failed to get maven version.")
71 | return
72 | }
73 |
74 | var metadata mavenMetadata
75 | err = xml.NewDecoder(res.Body).Decode(&metadata)
76 | if err != nil {
77 | core.JsonError(w, "Failed to decode maven metadata.")
78 | return
79 | }
80 |
81 | // Get file url
82 | fileUrl := ""
83 |
84 | for _, snapshotVersion := range metadata.Versioning.SnapshotVersions.List {
85 | if snapshotVersion.Extension == "jar" {
86 | fileUrl = fmt.Sprintf("%s/%s-%s.jar", url, metadata.ArtifactId, snapshotVersion.Value)
87 | break
88 | }
89 | }
90 |
91 | if fileUrl == "" {
92 | core.JsonError(w, "Failed to find jar file.")
93 | }
94 |
95 | // Server file
96 | res, err = http.Get(fileUrl)
97 | if err != nil {
98 | core.JsonError(w, "Failed to get file from maven.")
99 | return
100 | }
101 |
102 | //goland:noinspection GoUnhandledErrorResult
103 | defer res.Body.Close()
104 |
105 | w.Header().Set("Content-Disposition", "attachment; filename="+filename)
106 | w.Header().Set("Content-Type", res.Header.Get("Content-Type"))
107 | w.Header().Set("Content-Length", res.Header.Get("Content-Length"))
108 |
109 | _, _ = io.Copy(w, res.Body)
110 | }
111 |
--------------------------------------------------------------------------------
/pkg/web/api/metrics.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "github.com/prometheus/client_golang/prometheus"
5 | "github.com/prometheus/client_golang/prometheus/promauto"
6 | "github.com/prometheus/client_golang/prometheus/promhttp"
7 | "meteor-server/pkg/db"
8 | "net/http"
9 | )
10 |
11 | var handler http.Handler
12 |
13 | func InitMetrics() {
14 | reg := prometheus.NewRegistry()
15 |
16 | reg.MustRegister(
17 | promauto.NewCounterFunc(prometheus.CounterOpts{
18 | Name: "meteor_downloads_total",
19 | Help: "Total number of downloads",
20 | }, func() float64 {
21 | return float64(db.GetGlobal().Downloads)
22 | }),
23 | promauto.NewCounterFunc(prometheus.CounterOpts{
24 | Name: "meteor_online_players_total",
25 | Help: "Total number of online players",
26 | }, func() float64 {
27 | return float64(GetPlayingCount())
28 | }),
29 | promauto.NewCounterFunc(prometheus.CounterOpts{
30 | Name: "meteor_donators_total",
31 | Help: "Total number of accounts with donator status",
32 | }, func() float64 {
33 | return float64(db.DonatorCount)
34 | }),
35 | promauto.NewCounterFunc(prometheus.CounterOpts{
36 | Name: "meteor_accounts_total",
37 | Help: "Total number of accounts",
38 | }, func() float64 {
39 | return float64(db.AccountCount)
40 | }),
41 | )
42 |
43 | handler = promhttp.HandlerFor(reg, promhttp.HandlerOpts{})
44 | }
45 |
46 | func MetricsHandler(w http.ResponseWriter, r *http.Request) {
47 | handler.ServeHTTP(w, r)
48 | }
49 |
--------------------------------------------------------------------------------
/pkg/web/api/online.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "meteor-server/pkg/core"
5 | "net/http"
6 | "sync"
7 | "time"
8 | )
9 |
10 | var mu = sync.RWMutex{}
11 | var playing = make(map[string]time.Time)
12 |
13 | func GetPlayingCount() int {
14 | mu.RLock()
15 | count := len(playing)
16 | mu.RUnlock()
17 |
18 | return count
19 | }
20 |
21 | func PingHandler(w http.ResponseWriter, r *http.Request) {
22 | mu.Lock()
23 |
24 | ip := core.IP(r)
25 | playing[ip] = time.Now()
26 |
27 | mu.Unlock()
28 | }
29 |
30 | func LeaveHandler(w http.ResponseWriter, r *http.Request) {
31 | mu.Lock()
32 |
33 | ip := core.IP(r)
34 | delete(playing, ip)
35 |
36 | mu.Unlock()
37 | }
38 |
39 | func ValidateOnlinePlayers() {
40 | mu.Lock()
41 | now := time.Now()
42 |
43 | for ip, lastTimePlaying := range playing {
44 | if now.Sub(lastTimePlaying).Minutes() > 6 {
45 | delete(playing, ip)
46 | }
47 | }
48 |
49 | mu.Unlock()
50 | }
51 |
--------------------------------------------------------------------------------
/pkg/web/api/payments.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "context"
5 | "encoding/json"
6 | "github.com/plutov/paypal/v4"
7 | "github.com/rs/zerolog/log"
8 | "github.com/segmentio/ksuid"
9 | "meteor-server/pkg/core"
10 | "meteor-server/pkg/db"
11 | "net/http"
12 | "strconv"
13 | )
14 |
15 | type WebhookResponse struct {
16 | Resource struct {
17 | Id string `json:"id"`
18 | } `json:"resource"`
19 | EventType string `json:"event_type"`
20 | }
21 |
22 | var client *paypal.Client
23 | var orders = make(map[string]ksuid.KSUID)
24 | var amounts = make(map[string]float64)
25 |
26 | func InitPayPal() {
27 | var err error
28 | client, err = paypal.NewClient(core.GetPrivateConfig().PayPalClientID, core.GetPrivateConfig().PayPalSecret, paypal.APIBaseLive)
29 | if err != nil {
30 | log.Fatal().Err(err).Msg("Failed to log in to PayPal")
31 | return
32 | }
33 |
34 | _, err = client.GetAccessToken(context.Background())
35 | if err != nil {
36 | log.Fatal().Err(err).Msg("Failed to generate PayPal access token")
37 | }
38 | }
39 |
40 | func CreateOrderHandler(w http.ResponseWriter, r *http.Request) {
41 | amount, err := strconv.ParseFloat(r.URL.Query().Get("amount"), 32)
42 |
43 | if err != nil || amount < 5 {
44 | core.JsonError(w, "Invalid order amount.")
45 | return
46 | }
47 |
48 | user, err := db.GetAccount(r)
49 | if err != nil {
50 | core.JsonError(w, "Could not authorize account.")
51 | return
52 | }
53 |
54 | order, err := client.CreateOrder(
55 | context.Background(),
56 | paypal.OrderIntentCapture,
57 | []paypal.PurchaseUnitRequest{
58 | {
59 | Amount: &paypal.PurchaseUnitAmount{
60 | Value: strconv.FormatFloat(amount, 'f', 2, 32),
61 | Currency: "EUR",
62 | },
63 | },
64 | },
65 | &paypal.CreateOrderPayer{
66 | Name: &paypal.CreateOrderPayerName{
67 | GivenName: user.Username,
68 | },
69 | EmailAddress: user.Email,
70 | },
71 | nil,
72 | )
73 |
74 | if err != nil {
75 | msg := "Failed to create order"
76 | core.JsonError(w, msg)
77 | log.Err(err).Msg(msg)
78 | return
79 | }
80 |
81 | orders[order.ID] = user.ID
82 | amounts[order.ID] = amount
83 |
84 | core.Json(w, order)
85 | }
86 |
87 | func ConfirmOrderHandler(w http.ResponseWriter, r *http.Request) {
88 | valid, err := client.VerifyWebhookSignature(r.Context(), r, core.GetPrivateConfig().PayPalWebhookId)
89 | if err != nil || valid.VerificationStatus == "FAILURE" {
90 | msg := "Could not validate webhook signature"
91 | core.JsonError(w, msg)
92 | log.Err(err).Msg(msg)
93 | return
94 | }
95 |
96 | var res WebhookResponse
97 | err = json.NewDecoder(r.Body).Decode(&res)
98 | if err != nil {
99 | log.Err(err).Msg("Failed to decode request")
100 | return
101 | }
102 |
103 | acc, err := db.GetAccountId(orders[res.Resource.Id])
104 | if err != nil {
105 | log.Err(err).Msg("Failed to get account by ID")
106 | return
107 | }
108 |
109 | acc.GiveDonator(amounts[res.Resource.Id])
110 |
111 | core.Json(w, core.J{})
112 | }
113 |
114 | func CancelOrderHandler(w http.ResponseWriter, r *http.Request) {
115 | id := r.URL.Query().Get("id")
116 |
117 | if id != "" {
118 | delete(orders, id)
119 | delete(amounts, id)
120 | core.Json(w, core.J{})
121 | } else {
122 | core.JsonError(w, "No active orders.")
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/pkg/web/api/stats.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "archive/zip"
5 | "bytes"
6 | "encoding/json"
7 | "encoding/xml"
8 | "errors"
9 | "golang.org/x/mod/semver"
10 | "io"
11 | "meteor-server/pkg/core"
12 | "meteor-server/pkg/db"
13 | "net/http"
14 | "strconv"
15 | "strings"
16 | "sync"
17 | "time"
18 | )
19 |
20 | type Stats struct {
21 | core.Config
22 |
23 | Date string `json:"date"`
24 | Downloads int `json:"downloads"`
25 | OnlinePlayers int `json:"onlinePlayers"`
26 |
27 | Builds map[string]int `json:"builds"`
28 |
29 | // For compatibility with old Meteor versions that check this field without a safety check
30 | Version string `json:"version"`
31 | }
32 |
33 | var builds map[string]int
34 |
35 | func InitStats() {
36 | t := time.NewTicker(10 * time.Minute)
37 |
38 | go func() {
39 | for {
40 | builds = getBuildNumbers()
41 |
42 | <-t.C
43 | }
44 | }()
45 | }
46 |
47 | func StatsHandler(w http.ResponseWriter, r *http.Request) {
48 | date := r.URL.Query().Get("date")
49 |
50 | if date == "" {
51 | g := db.GetGlobal()
52 |
53 | core.Json(w, Stats{
54 | Config: core.GetConfig(),
55 | Date: core.GetDate(),
56 | Downloads: g.Downloads,
57 | OnlinePlayers: GetPlayingCount(),
58 | Builds: builds,
59 | Version: "0.0.0",
60 | })
61 | } else {
62 | stats, err := db.GetJoinStats(date)
63 |
64 | if err != nil {
65 | core.JsonError(w, "Invalid date.")
66 | return
67 | }
68 |
69 | core.Json(w, stats)
70 | }
71 | }
72 |
73 | func RecheckMavenHandler(w http.ResponseWriter, _ *http.Request) {
74 | builds = getBuildNumbers()
75 |
76 | core.Json(w, struct{}{})
77 | }
78 |
79 | func GetLatestVersion() (string, int) {
80 | latest := "0.0.0"
81 | build := 0
82 |
83 | for version, number := range builds {
84 | if semver.Compare("v"+version, "v"+latest) == 1 {
85 | latest = version
86 | build = number
87 | }
88 | }
89 |
90 | return latest, build
91 | }
92 |
93 | func GetVersionBuild(version string) int {
94 | if build, ok := builds[version]; ok {
95 | return build
96 | }
97 |
98 | return 0
99 | }
100 |
101 | // Maven
102 |
103 | type MavenSnapshotVersion struct {
104 | Extension string `xml:"extension"`
105 | Classifier string `xml:"classifier"`
106 | Value string `xml:"value"`
107 | }
108 |
109 | type MavenVersioning struct {
110 | Versions []string `xml:"versions>version"`
111 | SnapshotVersions []MavenSnapshotVersion `xml:"snapshotVersions>snapshotVersion"`
112 | }
113 |
114 | type MavenMetadata struct {
115 | Versioning MavenVersioning `xml:"versioning"`
116 | }
117 |
118 | type FabricMod struct {
119 | Version string `json:"version"`
120 | }
121 |
122 | func getBuildNumbers() map[string]int {
123 | builds := make(map[string]int)
124 |
125 | res, err := http.Get("https://maven.meteordev.org/snapshots/meteordevelopment/meteor-client/maven-metadata.xml")
126 | if err != nil {
127 | return builds
128 | }
129 |
130 | var metadata MavenMetadata
131 | err = xml.NewDecoder(res.Body).Decode(&metadata)
132 | if err != nil {
133 | return builds
134 | }
135 |
136 | mutex := sync.Mutex{}
137 | group := sync.WaitGroup{}
138 |
139 | for _, version := range metadata.Versioning.Versions {
140 | version := version
141 | group.Add(1)
142 |
143 | go func() {
144 | i := strings.IndexRune(version, '-')
145 | mcVersion := version[:i]
146 |
147 | if !strings.HasPrefix(mcVersion, "0") {
148 | build, err := getBuildNumber(version)
149 |
150 | if err == nil {
151 | mutex.Lock()
152 | builds[mcVersion] = build
153 | mutex.Unlock()
154 | }
155 | }
156 |
157 | group.Done()
158 | }()
159 | }
160 |
161 | group.Wait()
162 |
163 | return builds
164 | }
165 |
166 | func getBuildNumber(version string) (int, error) {
167 | res, err := http.Get("https://maven.meteordev.org/snapshots/meteordevelopment/meteor-client/" + version + "/maven-metadata.xml")
168 | if err != nil {
169 | return -1, err
170 | }
171 |
172 | //goland:noinspection GoUnhandledErrorResult
173 | defer res.Body.Close()
174 |
175 | var metadata MavenMetadata
176 | err = xml.NewDecoder(res.Body).Decode(&metadata)
177 | if err != nil {
178 | return -1, err
179 | }
180 |
181 | var filename = ""
182 |
183 | for _, version := range metadata.Versioning.SnapshotVersions {
184 | if version.Classifier == "" && version.Extension == "jar" {
185 | filename = "meteor-client-" + version.Value + ".jar"
186 | break
187 | }
188 | }
189 |
190 | res, err = http.Get("https://maven.meteordev.org/snapshots/meteordevelopment/meteor-client/" + version + "/" + filename)
191 | if err != nil {
192 | return -1, err
193 | }
194 |
195 | //goland:noinspection GoUnhandledErrorResult
196 | defer res.Body.Close()
197 |
198 | body, err := io.ReadAll(res.Body)
199 | if err != nil {
200 | return -1, err
201 | }
202 |
203 | jar, err := zip.NewReader(bytes.NewReader(body), int64(len(body)))
204 | if err != nil {
205 | return -1, err
206 | }
207 |
208 | var mod FabricMod
209 |
210 | for _, file := range jar.File {
211 | if file.Name == "fabric.mod.json" {
212 | reader, err := file.Open()
213 | if err != nil {
214 | continue
215 | }
216 |
217 | _ = json.NewDecoder(reader).Decode(&mod)
218 |
219 | _ = reader.Close()
220 |
221 | break
222 | }
223 | }
224 |
225 | if mod.Version != "" {
226 | i := strings.IndexRune(mod.Version, '-')
227 |
228 | build, err := strconv.ParseInt(mod.Version[i+1:], 10, 32)
229 | if err != nil {
230 | return -1, err
231 | }
232 |
233 | return int(build), nil
234 | }
235 |
236 | return -1, errors.New("unknown build")
237 | }
238 |
--------------------------------------------------------------------------------
/pkg/web/web.go:
--------------------------------------------------------------------------------
1 | package web
2 |
3 | import (
4 | "fmt"
5 | "github.com/rs/zerolog/log"
6 | "io/fs"
7 | "meteor-server/pkg/auth"
8 | "meteor-server/pkg/web/api"
9 | "meteor-server/pkg/wormhole"
10 | "mime"
11 | "net/http"
12 | "os"
13 | "time"
14 |
15 | "github.com/go-chi/chi/v5"
16 | "github.com/go-chi/chi/v5/middleware"
17 | "github.com/go-chi/cors"
18 |
19 | "meteor-server/pkg/core"
20 | )
21 |
22 | func Main() {
23 | err := mime.AddExtensionType(".jar", "application/java-archive")
24 | if err != nil {
25 | log.Err(err).Msg("Failed to add a MIME type for .jar files")
26 | }
27 |
28 | err = os.Mkdir("data/capes", fs.ModeDir)
29 | if err != nil && !os.IsExist(err) {
30 | panic(err)
31 | }
32 |
33 | api.UpdateCapes()
34 | api.InitPayPal()
35 | api.InitMetrics()
36 | api.SetupTurnstile()
37 |
38 | r := chi.NewRouter()
39 |
40 | // Setup periodic timers
41 | t := time.NewTicker(10 * time.Minute)
42 | go func() {
43 | for {
44 | api.ValidateOnlinePlayers()
45 | <-t.C
46 | }
47 | }()
48 |
49 | api.InitStats()
50 |
51 | // Middlewares
52 | r.Use(middleware.RealIP)
53 |
54 | if core.GetConfig().Debug {
55 | r.Use(middleware.Logger)
56 | }
57 |
58 | r.Use(middleware.GetHead)
59 | r.Use(cors.AllowAll().Handler)
60 | r.Use(middleware.SetHeader("Connection", "close"))
61 | r.Use(middleware.Recoverer)
62 |
63 | // Static
64 | r.Handle("/capes/*", http.StripPrefix("/capes", http.FileServer(http.Dir("data/capes"))))
65 |
66 | // Other
67 | if core.GetConfig().Debug {
68 | r.Get("/handler.go", wormhole.Handle)
69 | }
70 |
71 | // /api
72 | r.Route("/api", func(r chi.Router) {
73 | r.Get("/download", api.DownloadHandler)
74 | r.Get("/downloadBaritone", api.DownloadBaritoneHandler)
75 |
76 | r.Get("/capes", api.CapesHandler)
77 | r.Get("/stats", api.StatsHandler)
78 | r.Get("/metrics", api.MetricsHandler)
79 | r.Get("/capeowners", api.CapeOwnersHandler)
80 |
81 | r.Post("/recheckMaven", auth.TokenAuth(api.RecheckMavenHandler))
82 |
83 | // /api/account
84 | r.Route("/account", func(r chi.Router) {
85 | r.Post("/register", api.RegisterHandler)
86 | r.Post("/confirm", api.ConfirmEmailHandler)
87 | r.Get("/login", api.LoginHandler)
88 | r.Post("/forgotPassword", api.ForgotPasswordHandler)
89 | r.Post("/logout", auth.Auth(api.LogoutHandler))
90 |
91 | r.Get("/info", auth.Auth(api.AccountInfoHandler))
92 | r.Get("/getByUuid", auth.TokenAuth(api.GetAccountByMcUuid))
93 |
94 | r.Get("/generateDiscordLinkToken", auth.Auth(api.GenerateDiscordLinkTokenHandler))
95 | r.Post("/linkDiscord", auth.TokenAuth(api.LinkDiscordHandler))
96 | r.Post("/unlinkDiscord", auth.Auth(api.UnlinkDiscordHandler))
97 | r.Post("/mcAccount", auth.Auth(api.McAccountHandler))
98 | r.Delete("/mcAccount", auth.Auth(api.McAccountHandler))
99 | r.Post("/selectCape", auth.Auth(api.SelectCapeHandler))
100 | r.Post("/uploadCape", auth.Auth(api.UploadCapeHandler))
101 | r.Post("/changeUsername", auth.Auth(api.ChangeUsernameHandler))
102 | r.Post("/changeEmail", auth.Auth(api.ChangeEmailHandler))
103 | r.Get("/confirmChangeEmail", api.ConfirmChangeEmailHandlerApi)
104 | r.Post("/changePassword", auth.Auth(api.ChangePasswordHandler))
105 | r.Post("/changePasswordToken", api.ChangePasswordTokenHandler)
106 | })
107 |
108 | // /api/online
109 | r.Route("/online", func(r chi.Router) {
110 | r.Get("/ping", api.PingHandler)
111 | r.Post("/ping", api.PingHandler)
112 | r.Post("/leave", api.LeaveHandler)
113 | })
114 |
115 | // /api/discord
116 | r.Route("/discord", func(r chi.Router) {
117 | r.Post("/userJoined", auth.TokenAuth(api.DiscordUserJoinedHandler))
118 | r.Post("/userLeft", auth.TokenAuth(api.DiscordUserLeftHandler))
119 | })
120 |
121 | // /api/payments
122 | r.Route("/payments", func(r chi.Router) {
123 | r.Get("/create", auth.Auth(api.CreateOrderHandler))
124 | r.Get("/cancel", api.CancelOrderHandler)
125 | r.Post("/confirm", api.ConfirmOrderHandler)
126 | })
127 |
128 | // /api/addons
129 | r.Route("/addons", func(r chi.Router) {
130 | r.Get("/getById", api.GetAddonById)
131 | r.Get("/search", api.SearchAddons)
132 | })
133 | })
134 |
135 | // Run server
136 | s := &http.Server{
137 | Addr: fmt.Sprintf(":%d", core.GetConfig().Port),
138 | Handler: r,
139 | WriteTimeout: 6 * time.Second,
140 | ReadTimeout: 6 * time.Second,
141 | IdleTimeout: 6 * time.Second,
142 | }
143 |
144 | log.Info().Msg("Listening on " + s.Addr)
145 | log.Fatal().Err(s.ListenAndServe()).Send()
146 | }
147 |
--------------------------------------------------------------------------------
/pkg/wormhole/core/client.go:
--------------------------------------------------------------------------------
1 | package core
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/gorilla/websocket"
6 | "github.com/rs/zerolog/log"
7 | "github.com/segmentio/ksuid"
8 | "meteor-server/pkg/auth"
9 | "meteor-server/pkg/db"
10 | "meteor-server/pkg/wormhole/packets"
11 | )
12 |
13 | type Client struct {
14 | conn *websocket.Conn
15 | error bool
16 |
17 | Name string
18 | ID ksuid.KSUID
19 | }
20 |
21 | func NewClient(conn *websocket.Conn) *Client {
22 | return &Client{conn: conn}
23 | }
24 |
25 | func (c *Client) IsAuthenticated() bool {
26 | return !c.ID.IsNil()
27 | }
28 |
29 | func (c *Client) Send(packet packets.PacketS2C) {
30 | err := c.conn.WriteJSON(packet)
31 | if err != nil {
32 | c.error = true
33 | }
34 | }
35 |
36 | func (c *Client) Start() {
37 | for {
38 | // Return from the loop if an error occurred
39 | if c.error {
40 | break
41 | }
42 |
43 | // Read packet
44 | var packet packets.PacketC2S
45 | err := c.conn.ReadJSON(&packet)
46 | if err != nil {
47 | break
48 | }
49 |
50 | if c.IsAuthenticated() {
51 | switch packet.Type {
52 | case packets.Message:
53 | var data packets.MessageC2S
54 | err = json.Unmarshal(packet.Data, &data)
55 | if err != nil {
56 | break
57 | }
58 |
59 | c.onMessage(data)
60 | }
61 | } else {
62 | // Authenticate
63 | if packet.Type == packets.Authenticate {
64 | var data packets.AuthenticateC2S
65 | err = json.Unmarshal(packet.Data, &data)
66 | if err != nil {
67 | break
68 | }
69 |
70 | c.onAuthenticate(data)
71 | }
72 | }
73 | }
74 | }
75 |
76 | func (c *Client) onAuthenticate(data packets.AuthenticateC2S) {
77 | // Validate token
78 | id, err := auth.IsTokenValid(data.Token)
79 | if err == nil {
80 | c.ID = id
81 |
82 | // Fetch name
83 | acc, err := db.GetAccountId(id)
84 | if err != nil {
85 | c.error = true
86 | return
87 | }
88 |
89 | c.Name = acc.Username
90 |
91 | // Send packet that confirms authentication
92 | c.Send(packets.NewAuthenticateS2C())
93 |
94 | // Send join message to current clients
95 | log.Info().Msgf("%s joined", c.Name)
96 | Broadcast(packets.NewJoinMessageS2C(c.Name))
97 |
98 | AddClient(c)
99 | }
100 | }
101 |
102 | func (c *Client) onMessage(data packets.MessageC2S) {
103 | Broadcast(packets.NewMessageS2C(c.Name, data.Text))
104 | }
105 |
106 | func (c *Client) Close() {
107 | _ = c.conn.Close()
108 |
109 | if c.IsAuthenticated() {
110 | RemoveClient(c)
111 |
112 | log.Info().Msgf("%s left", c.Name)
113 | Broadcast(packets.NewLeaveMessageS2C(c.Name))
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/pkg/wormhole/core/clients.go:
--------------------------------------------------------------------------------
1 | package core
2 |
3 | import (
4 | "github.com/segmentio/ksuid"
5 | "meteor-server/pkg/wormhole/packets"
6 | )
7 |
8 | var clients map[ksuid.KSUID]*Client
9 |
10 | func Broadcast(packet packets.PacketS2C) {
11 | for _, client := range clients {
12 | client.Send(packet)
13 | }
14 | }
15 |
16 | func AddClient(client *Client) {
17 | clients[client.ID] = client
18 | }
19 |
20 | func RemoveClient(client *Client) {
21 | delete(clients, client.ID)
22 | }
23 |
--------------------------------------------------------------------------------
/pkg/wormhole/handler.go:
--------------------------------------------------------------------------------
1 | package wormhole
2 |
3 | import (
4 | "github.com/gorilla/websocket"
5 | "meteor-server/pkg/wormhole/core"
6 | "net/http"
7 | )
8 |
9 | var upgrader = websocket.Upgrader{}
10 |
11 | func Handle(w http.ResponseWriter, r *http.Request) {
12 | conn, err := upgrader.Upgrade(w, r, nil)
13 | if err != nil {
14 | return
15 | }
16 |
17 | c := core.NewClient(conn)
18 | c.Start()
19 |
20 | c.Close()
21 | }
22 |
--------------------------------------------------------------------------------
/pkg/wormhole/packets/c2s.go:
--------------------------------------------------------------------------------
1 | package packets
2 |
3 | type AuthenticateC2S struct {
4 | Token string `json:"token"`
5 | }
6 |
7 | type MessageC2S struct {
8 | Text string `json:"text"`
9 | }
10 |
--------------------------------------------------------------------------------
/pkg/wormhole/packets/packet.go:
--------------------------------------------------------------------------------
1 | package packets
2 |
3 | import "encoding/json"
4 |
5 | type PacketC2S struct {
6 | Type int `json:"type"`
7 | Data json.RawMessage `json:"data"`
8 | }
9 |
10 | type PacketS2C struct {
11 | Type int `json:"type"`
12 | Data interface{} `json:"data,omitempty"`
13 | }
14 |
15 | const (
16 | Authenticate = iota
17 | JoinMessage = iota
18 | LeaveMessage = iota
19 | Message = iota
20 | )
21 |
--------------------------------------------------------------------------------
/pkg/wormhole/packets/s2c.go:
--------------------------------------------------------------------------------
1 | package packets
2 |
3 | // Authenticate
4 |
5 | func NewAuthenticateS2C() PacketS2C {
6 | return PacketS2C{Type: Authenticate}
7 | }
8 |
9 | // Message
10 |
11 | type MessageS2C struct {
12 | User string `json:"user"`
13 | Text string `json:"text"`
14 | }
15 |
16 | func NewMessageS2C(user string, text string) PacketS2C {
17 | return PacketS2C{Type: Message, Data: MessageS2C{User: user, Text: text}}
18 | }
19 |
20 | // Join / Leave messages
21 |
22 | type JoinLeaveS2C struct {
23 | User string `json:"user"`
24 | }
25 |
26 | func NewJoinMessageS2C(user string) PacketS2C {
27 | return PacketS2C{Type: JoinMessage, Data: JoinLeaveS2C{User: user}}
28 | }
29 |
30 | func NewLeaveMessageS2C(user string) PacketS2C {
31 | return PacketS2C{Type: LeaveMessage, Data: JoinLeaveS2C{User: user}}
32 | }
33 |
--------------------------------------------------------------------------------