Compare commits

...

118 Commits

Author SHA1 Message Date
Daan Sprenkels
fbab9028f4 Bump all dependencies 2021-10-03 10:43:56 +02:00
29ee3dc6fd Merge pull request 'Add request_duration_seconds metric' (#72) from metrics into master
Reviewed-on: dsprenkels/rushlink#72
2021-05-16 21:10:48 +02:00
Daan Sprenkels
306705cb28 Optimize query for updating metricURLsTotalGauge 2021-05-16 20:45:48 +02:00
Daan Sprenkels
c4ff0ab1b7 Add request_duration_seconds metric 2021-05-16 20:24:00 +02:00
Daan Sprenkels
a26894dac8 Refactor metric collection 2021-05-16 20:21:44 +02:00
Daan Sprenkels
4f07bc4c2a Update bindata.go 2021-05-13 10:46:06 +02:00
Daan Sprenkels
9ff11cc14c Remove boltdb leftovers 2021-05-13 10:44:32 +02:00
Daan Sprenkels
38b27b4d11 mod: Remove explicit go-bindata dep; NFC 2021-05-13 10:43:23 +02:00
Daan Sprenkels
590003aa36 Update dependencies 2021-05-08 22:45:04 +02:00
Daan Sprenkels
30ab6f9228 Fix gopls issues 2021-05-08 22:42:13 +02:00
Daan Sprenkels
6603ad886f Merge branch 'master' of gitea.hashru.nl:dsprenkels/rushlink 2021-05-07 10:17:35 +02:00
Daan Sprenkels
b8d1ca459c Fix gopls issues 2021-05-07 10:17:17 +02:00
5cb0a59f00 README: indicate change to ENV for configuration, refresh systemd unit file, introduce Gorm and db migration tool 2021-05-05 22:29:08 +02:00
1fe9553cc9 Merge pull request 'Use SQL database instead of bolt' (#71) from sql into master
Reviewed-on: dsprenkels/rushlink#71
2021-05-05 21:34:26 +02:00
Daan Sprenkels
3f09c1517d migrate: Fix 'no such table: migrations' err
Apparently, if you CREATE TABLE inside of a transaction, and then
(in the same transaction) do a SELECT on the same table before
committing, the table will not exist yet.

Now we do the migration in two steps: first initialize the schema;
then migrate the data.
2020-12-31 14:34:33 +01:00
Daan Sprenkels
f530a543f9 db: Test truncated keys are invalid; NFC 2020-12-17 15:15:04 +01:00
Daan Sprenkels
f527f2fb38 Automigrate when opening db 2020-12-17 15:14:45 +01:00
Daan Sprenkels
1ecb11c65f db: Do not warn during paste key generation 2020-12-17 14:49:52 +01:00
Daan Sprenkels
0048004252 Use sql database instead of bolt 2020-10-25 17:33:51 +01:00
Daan Sprenkels
f36fa30eff Rename current db to boltdb 2020-10-23 16:14:57 +02:00
Daan Sprenkels
104dbab335 db: Refactor switch; NFC 2020-07-27 18:49:26 +02:00
Daan Sprenkels
a8eba1b0df db: Add a test for key validation; NFC 2020-07-27 18:48:24 +02:00
Daan Sprenkels
9d952edc67 Add a functional test for /nr
Fixes #68
2020-07-27 17:08:10 +02:00
Daan Sprenkels
50baaeadf1 Fix /nr
Related issue: #68
2020-07-27 16:58:46 +02:00
Daan Sprenkels
26be9b5104 Validate key format before retrieving from database
Fixes #67
2020-07-27 16:58:27 +02:00
Daan Sprenkels
6d3e8028cb Use high-entropy URLs for file uploads
Fixes issue #59
2020-07-27 14:53:19 +02:00
Daan Sprenkels
1c09bb0a71 Fix incorrect router setup 2020-07-27 14:22:43 +02:00
Daan Sprenkels
03a04389ae Add a test for issue #66
Together with af6d7623, this commit solves issue #66.

Fixes #66.
2020-07-06 18:02:57 +02:00
Daan Sprenkels
af6d762378 Stop rendering after an invalid Accept value 2020-07-06 18:01:50 +02:00
Daan Sprenkels
7a369a1dae Merge pull request 'Error with 400 Bad Request when both 'file' and 'shorten' set' (#65) from issue-56 into master 2020-07-06 17:14:38 +02:00
Daan Sprenkels
8904b648b7 Error w/ 400 when both 'file' and 'shorten' set
Fixes #56
2020-07-06 17:17:07 +02:00
Daan Sprenkels
70538f170f Add a test for issue #56 2020-07-06 17:17:07 +02:00
Daan Sprenkels
bbfe64a3a2 Merge pull request 'Add request logging to panic recovery' (#63) from issue-61 into master 2020-07-06 17:12:59 +02:00
Daan Sprenkels
5a39d6a37c Add request logging to panic recovery
Fixes #61
2020-07-06 17:15:56 +02:00
Daan Sprenkels
2883af7d31 Merge pull request 'Fix error handling in renderStatic' (#64) from issue-60 into master 2020-07-06 17:04:58 +02:00
Daan Sprenkels
d37222f82a Fix error handling in renderStatic
Fixes #60
2020-07-06 17:07:14 +02:00
badc22b8d0 Merge pull request 'db: Change db file mode to 660' (#62) from issue-58 into master 2020-06-28 12:15:57 +02:00
Daan Sprenkels
a58b9815bc Remove unused newPasteHandlerURLEncoded func; NFC 2020-05-30 19:29:27 +02:00
Daan Sprenkels
0b2297a2e8 Add a test for issue #60 2020-05-30 17:49:44 +02:00
Daan Sprenkels
77e89251e7 db: Change db file mode to 660
Fixes #58
2020-05-30 17:07:35 +02:00
Daan Sprenkels
847fd8072b Bump dependencies 2020-05-30 17:05:33 +02:00
Daan Sprenkels
5a5a0dc5ec Merge pull request 'Don't capture cursor in screenshot.' (#55) from mara/rushlink:master into master 2020-05-21 20:02:41 +02:00
dbb6a954e1 Don't capture cursor in screenshot.
Adds `-u` to maim to not capture the cursor.

However, maim still captures the cursor sometimes even with -u,
so this also switches the order to prefer `import` over `maim`,
which does not do this.
2020-05-15 13:08:18 +02:00
Daan Sprenkels
2c889e0808 Prevent directory traversal in file upload
Fixes #53
2020-05-12 20:01:03 +02:00
Daan Sprenkels
737a26fee3 test: Look for StatusFound instead of StatusOk; NFC 2020-05-12 19:09:43 +02:00
Daan Sprenkels
016ffa8949 meta: Do 410 Gone if paste deleted 2020-05-11 22:45:56 +02:00
Daan Sprenkels
b9119a0df5 meta: Fix CanDelete string 2020-05-11 22:32:35 +02:00
Daan Sprenkels
a4cec1e4b0 meta: Add a delete button 2020-05-11 22:26:45 +02:00
Daan Sprenkels
b7ea5dfa4f Redirect to /xd42/meta after upload
Fixes #51
2020-05-11 22:22:23 +02:00
Daan Sprenkels
a0c8383555 template: Fix <pre> nesting 2020-05-11 20:58:50 +02:00
bbe787da5d Merge pull request 'Make rushlink script more portable.' (#48) from mara/rushlink:master into master 2020-05-04 12:12:46 +02:00
28ddaee9d9 Make rushlink script more portable.
It didn't work on mac (and bsd, probably). Now it does.
2020-05-04 12:06:06 +02:00
Daan Sprenkels
01adfa8f2f Merge pull request 'Add a test for issue #45; NFC' (#46) from test-issue-45 into master 2020-04-27 13:00:31 +02:00
Daan Sprenkels
c57e719e15 Add a test for issue #45; NFC
Fixes #45
2020-04-27 13:00:46 +02:00
Daan Sprenkels
c0e4ac2c40 mod: Bump dependencies 2020-04-22 19:30:20 +02:00
Daan Sprenkels
b73317c249 Add generated bindata.go file to repo 2020-04-22 19:05:56 +02:00
Daan Sprenkels
8e89955ce9 Remove debug logging statement; NFC 2020-04-22 18:25:55 +02:00
Daan Sprenkels
e476797da0 db: Prevent infinite recursion when closing 2020-04-22 18:25:27 +02:00
Daan Sprenkels
728d3833c3 Change redirect status code to Temporary Redirect 2020-04-22 18:24:46 +02:00
Daan Sprenkels
42ccc18002 User url.Parse instead of url.ParseRequestURI
url.ParseRequestURI assumes the URL does not contain a fragment
identifier.  However, this is not disallowed. So we should use
url.Parse instead.

Related issue: #45
2020-04-22 16:11:32 +02:00
Daan Sprenkels
63a588ba59 db: Add docstrings to FileUpload; NFC 2020-04-22 16:00:36 +02:00
Daan Sprenkels
3da165a57b Merge pull request 'Add copy-to-clipboard button to meta page' (#44) from issue-42 into master 2020-04-14 16:08:07 +02:00
Daan Sprenkels
09481f47e6 Do not show button if clipboard not available 2020-04-05 18:46:40 +02:00
Daan Sprenkels
1dd0d17ba5 Add copy-to-clipboard button to meta page
Fixes #42.
2020-04-05 18:16:41 +02:00
Daan Sprenkels
7c0bfaee76 .gitignore: Ignore .vscode dir; NFC 2020-04-05 18:15:41 +02:00
Daan Sprenkels
a766d5d596 Update .gitignore; NFC 2020-04-05 18:12:16 +02:00
Daan Sprenkels
c28dfd0cb4 Merge pull request 'Add rushlink --screenshot.' (#41) from mara/rushlink:master into master 2020-03-26 09:37:25 +01:00
732b1fc2a6 Add rushlink --screenshot. 2020-03-24 17:25:51 +01:00
8403ad2258 Make rushlink --delete work with urls that have a file extension. 2020-03-24 14:42:54 +01:00
Daan Sprenkels
ad1ce67495 Merge pull request 'Add command line tool to submit and delete files and links.' (#39) from mara/rushlink:master into master 2020-03-23 17:00:45 +01:00
11ea63e1fc Add command line tool to submit and delete files and links.
Fixes #11.
2020-03-23 17:00:24 +01:00
Daan Sprenkels
0a35cb2508 Merge branch 'master' of gitea.hashru.nl:dsprenkels/rushlink 2020-01-05 00:15:23 +01:00
Daan Sprenkels
de19234108 return after serving meta page 2020-01-05 00:14:53 +01:00
9a690e2b8b README: restructure to accentuate building/deploying 2019-12-28 19:24:59 +01:00
ac2c62f9e6 README updated with -root_url and sample systemd unit file 2019-12-28 18:47:20 +01:00
Daan Sprenkels
095348d614 web: Add an example w/ upload from process output
Fixes #35
2019-12-19 23:29:09 +01:00
Daan Sprenkels
245dd64f82 Directly serve files instead of redirect
Fixes #28
2019-12-19 23:17:37 +01:00
Daan Sprenkels
5e6ce9c2be Replace io.Copy w/ http.ServeContent for download 2019-12-19 20:09:55 +04:00
Daan Sprenkels
8dce4e8483 web: Indent <pre> with padding-left (no spaces)
Fixes #34
2019-12-17 23:11:43 +05:30
Daan Sprenkels
ffeb9a3362 Rename --host => --root-url 2019-12-17 15:43:32 +05:30
Daan Sprenkels
3d07acb222 Show meta page immediately after create 2019-12-17 15:33:29 +05:30
Daan Sprenkels
c46a26f8a2 web: Implement drag-and-drop upload 2019-12-16 16:21:41 +05:30
Daan Sprenkels
087b9920e6 [refactor] Add !=nil check in renderCreateSuccess 2019-12-16 11:27:09 +05:30
Daan Sprenkels
ca859adab1 Redirect to /meta after upload/shorten 2019-12-16 10:51:21 +05:30
Daan Sprenkels
d34ac11d5e Update metadata info view 2019-12-16 10:19:17 +05:30
Daan Sprenkels
824c6f41e2 Enable submit using web interface 2019-12-16 09:53:36 +05:30
Daan Sprenkels
f32e47b4c8 Add deprecation warning for omitting --host 2019-12-15 17:08:32 +05:30
Daan Sprenkels
8cbe984ba4 Default {{.Host}} to https:// 2019-12-15 17:06:48 +05:30
Daan Sprenkels
0bffde1dc1 Implement --host flag to override {{.Host}}
Fixes #15
2019-12-15 16:48:50 +05:30
Daan Sprenkels
41f4de43ac Return both URLs after upload
Fixes #25
2019-12-15 12:42:10 +05:30
Daan Sprenkels
728b5d9d4b Add extension to FileUpload request url
Fixes #27
2019-12-15 12:21:54 +05:30
Daan Sprenkels
40a32fa535 Respond to HEAD requests
Fixes #21
2019-12-15 11:44:27 +05:30
Daan Sprenkels
ba08aca622 db: Refactor paste decoding into new func 2019-12-10 12:24:58 +01:00
Daan Sprenkels
76cf92e22d db: Add missing docs to public symbols 2019-12-10 12:08:27 +01:00
Daan Sprenkels
62e82d831e db: Migrate FileUpload.ContentTypes to auto-detect 2019-12-10 11:59:02 +01:00
Daan Sprenkels
eec5e4def4 Detect file types instead of trusting clients 2019-12-10 11:16:18 +01:00
Daan Sprenkels
f9c74a83f0 Add test for #17
Closes #17.
2019-12-08 22:49:42 +01:00
Daan Sprenkels
da5806a6f7 metrict: Commit change that was forgotten in cf95650 2019-12-08 22:02:30 +01:00
Daan Sprenkels
f1fe160655 go mod tidy 2019-12-08 21:56:30 +01:00
Daan Sprenkels
cf956501ac metrics: Add http_requests metric 2019-12-08 21:56:02 +01:00
Daan Sprenkels
0cfad96b68 Refactor database login into a separate module 2019-12-06 18:03:56 +01:00
8b87cd0f8a AcceptParams contains at least one character as argument. Fixes #17 2019-11-29 20:50:07 +01:00
0e7b2bc83c Merge branch 'dsprenkels/upload' of dsprenkels/rushlink into master 2019-11-29 18:36:34 +01:00
b3357185f4 Use https links. Use iota for pasteType and pasteState to preserve type 2019-11-29 18:36:27 +01:00
Daan Sprenkels
df86d5836a Implement file deletion 2019-11-22 18:41:54 +01:00
Daan Sprenkels
c82a71f7d0 Revert "Remove file storage possibility for now (awaits #12)"
This reverts commit 801ac8adbb.
2019-11-10 19:08:05 +01:00
Daan Sprenkels
66eb0bf97a Add support for file uploads 2019-11-10 19:03:57 +01:00
d0b8a9ab9e Always show the shortened URL; optionally print the deleteToken URL 2019-11-09 22:44:02 +01:00
01580bfe2a Return complete URL after shortening, fixes #13 2019-11-09 22:33:16 +01:00
e7b71eca69 index templates: assume we run on https. README: example nginx config
Fixes #10
2019-11-09 22:29:01 +01:00
801ac8adbb Remove file storage possibility for now (awaits #12) 2019-11-09 21:46:40 +01:00
b738116f8a Flags for listen and metrics address; fix in newRedirectPasteSuccess.txt.tmpl
Fixes #9
2019-11-09 21:43:58 +01:00
Daan Sprenkels
e26e37c97d Merge branch 'structure_rework' of dsprenkels/rushlink into master 2019-11-09 17:44:53 +01:00
1b3ba9443a Move several packages to root package 2019-11-09 15:50:12 +01:00
Daan Sprenkels
ab0cf15c7b Move flag handling into cmd/ 2019-11-08 22:17:05 +01:00
853945a138 Merge branch 'go-generate' of minnozz/rushlink into master
Thanks!
2019-11-08 11:45:48 +01:00
3e5eca40e3 Don't install/update go-bindata from //go:generate
Instead, add build instructions to the README.
2019-11-08 10:40:53 +01:00
2d2df99f75 Run go mod tidy 2019-11-08 10:40:31 +01:00
35 changed files with 3680 additions and 746 deletions

10
.gitignore vendored
View File

@ -14,8 +14,12 @@
# Dependency directories (remove the comment below to include it)
# vendor/
# Generated code from assets using bindata
bindata.go
# Output binary
/rushlink
# Any kind of backup files
*~
*.bak
# Visual Code local config directory
.vscode

View File

@ -2,6 +2,57 @@
A URL shortener and (maybe) a pastebin server for our #ru community.
## Building
- `go get -u github.com/go-bindata/go-bindata/...`
- `go generate ./...`
- `go build ./cmd/rushlink`
## Deploying
We recommend running `rushlink` behind a reverse proxy suitable for processing
HTTP requests, such as `nginx`, or `haproxy`.
## Sample `nginx` config
```
server {
location / {
root /var/www/rushlink;
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host rushlink.local;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
}
}
```
`rushlink` automatically detects whether `http` or `https` is used when
`X-Forwarded-Proto` is correctly set. Otherwise, pass `-root_url
https://rushlink.local` to the binary (e.g. in the `systemd` unit file).
## Sample `systemd` unit file
As of 1fe9553cc9, `rushlink` expects its database and file store configuration
in environment variables.
```
[Install]
WantedBy=nginx.service
[Service]
Type=simple
User=rushlink
Group=nogroup
Environment=RUSHLINK_DATABASE_DRIVER=sqlite RUSHLINK_DATABASE_PATH=/var/lib/rushlink/rushlink.sqlite3 RUSHLINK_FILE_STORE_PATH=/var/lib/rushlink/filestore/
ExecStart=/var/lib/rushlink/rushlink -root_url https://rushlink.local
```
---
# Background
## Libraries
Use standard-Go-libraries if the job can be done with those. As of now, these
@ -18,10 +69,16 @@ are the exceptions:
## Database
We will be using [`go.etcd.io/bbolt`]. This file should be the *only* file
Before 1fe9553cc9 we used [`go.etcd.io/bbolt`]. This file should be the *only* file
apart from our monolithic binary. All settings and keys should go in here.
Any read-only data resides in the binary file (possibly compressed).
Now, we use Gorm and support SQLite and PostgreSQL as backends.
We provide a migration binary in `cmd/rushlink-migrate-db/`. In environment
variables, the destination database is configured, and the binary itself
expects a few flags. Refer to the source for the exact flags.
[`go.etcd.io/bbolt`]: `go.etcd.io/bbolt`
## Namespacing

34
assets/css/main.css Normal file
View File

@ -0,0 +1,34 @@
body {
font-family: monospace;
}
#dropZone {
background-color: rgba(0, 0, 0.2, 0.75);
color: white;
font-size: 60px;
font-weight: bold;
height: 100%;
left: 0;
padding: 1em;
position: fixed;
top: 0;
transition: visibility 175ms, opacity 175ms;
width: 100%;
z-index: 999;
}
pre {
padding-left: 4ex; /* approx 4 monospaced spaces */
}
.success {
color: #008000;
}
.fail {
color: #800000;
}
.hidden {
display: none;
}

View File

@ -0,0 +1,51 @@
"use strict";
const COPY_TO_CLIPBOARD_CONTAINER_ID = "copyToClipboardContainer";
const COPY_TO_CLIPBOARD_STATUS_ID = "copyToClipboardStatus";
let copyToClipboardCtr = 0;
function copyToClipboardSuccess() {
let statusElem = document.getElementById(COPY_TO_CLIPBOARD_STATUS_ID);
statusElem.innerText = "URL copied!";
statusElem.classList.remove("fail");
statusElem.classList.add("success");
}
function copyToClipboardFail(cause) {
let statusElem = document.getElementById(COPY_TO_CLIPBOARD_STATUS_ID);
if (!cause) cause = "unknown error";
let msg = "copy failed: " + cause;
console.log(msg);
statusElem.innerText = msg;
statusElem.classList.remove("success");
statusElem.classList.add("fail");
}
function copyToClipboard(url) {
let copyEventIdx = ++copyToClipboardCtr;
if (!window.navigator.clipboard) {
copyToClipboardFail("could not access clipboard");
return;
}
window.navigator.clipboard.writeText(url).then(() => {
if (copyToClipboardCtr !== copyEventIdx) return;
copyToClipboardSuccess();
}, () => {
if (copyToClipboardCtr !== copyEventIdx) return;
copyToClipboardFail();
});
}
(function () {
if (!window.navigator.clipboard) {
let msg = "cannot access clipboard";
if (window.location.protocol !== "https:") {
msg += ": website not using https"
}
console.error(msg);
} else {
let container = document.getElementById(COPY_TO_CLIPBOARD_CONTAINER_ID);
container.classList.remove("hidden");
}
})();

48
assets/js/dragdrop.js vendored Normal file
View File

@ -0,0 +1,48 @@
"use strict";
window.addEventListener('DOMContentLoaded', (event) => {
// The implementation of this drag-drop logic is largely based on the
// answer described in <https://stackoverflow.com/a/28226022/5207081>.
//
// The gist is this: every time the drag enters a new DOM object, it will
// fire a new 'dragenter' event on that element. That is a pain, because
// we do not know which element will be the last to receive a dragleave
// event, in case the user aborts the process.
//
// Therefore, we use an Ugly Hack™. There will be an element with id
// 'dropZone', which blocks the complete page. When a 'dragenter' event
// is received on any DOM element, we will unhide this modal page-blocker.
// This will guarantee us that the next 'enter' event will be received on
// this page-block element. This event we shall ignore.
//
// Then, whenever the user stop their drag action, we will receive the
// 'dragleave' on the '#dropZone' element. Now we know when exactly
// a drag action is cancelled (and we will hide the modal element
// accordingly).
let dropZone = document.getElementById("dropZone");
window.addEventListener("dragenter", (event) => {
// User starts a drag action
dropZone.style.visibility = "";
dropZone.style.opacity = 1;
});
dropZone.addEventListener("drop", (event) => {
// User drops a file
event.preventDefault();
document.getElementById("fileUploadField").files = event.dataTransfer.files;
document.getElementById("fileUploadForm").submit();
});
dropZone.addEventListener("dragleave", (event) => {
// User cancels drag action
dropZone.style.visibility = "hidden";
dropZone.style.opacity = 0;
});
window.addEventListener("dragover", (event) => {
// Prevent the browser from opening the file, because of a drop event
// on the window. (<https://stackoverflow.com/a/6756680/5207081>)
event.preventDefault();
});
});

View File

@ -2,7 +2,9 @@
<html>
<head>
<meta charset="utf-8">
<title>{{block "title" .}}rushlink{{end}}</title>{{block "head-append" .}}{{end}}
<title>{{block "title" .}}rushlink{{end}}</title>
<link rel="stylesheet" type="text/css" href="/css/main.css" />
{{block "head-append" .}}{{end -}}
</head>
<body>
{{block "body" .}}

View File

@ -1,20 +1,47 @@
{{define "body"}}
<pre>
#RU URL SHORTENER
=================
{{define "head-append"}}
<script type="text/javascript" src="/js/dragdrop.js" defer></script>
{{end}}
Based on https://0x0.st/, this site allows you to easily shorten URLs using
{{define "body"}}
<div style="visibility:hidden; opacity:0" id="dropZone">File incoming! :D</div>
<h1>#RU paste-dump</h1>
Based on https://0x0.st/, this site allows you to easily upload files and shorten URLs using
the command line.
## USAGE
<h2>Web-API</h2>
<section>
<form id="fileUploadForm" action="/" method="post" enctype="multipart/form-data">
<label class="formLabel" for="fileUploadField">Upload a file:</label>
<input id="fileUploadField" class="formMain" name="file" type="file" />
<input id="fileUploadField" class="formSubmit" type="submit" value="upload!" />
</form>
</section>
<section>
<form id="shortenURLForm" action="/" method="post" enctype="multipart/form-data">
<label class="formLabel" for="shortenURLField">Upload a URL:</label>
<input id="shortenURLField" class="formMain" name="shorten" type="url" />
<input id="shortenURLSubmit" class="formSubmit" type="submit" value="shorten!" />
</form>
</section>
# Upload a file
curl -F'file=@yourfile.png' <a href="{{.Request.Host}}">{{.Request.Host}}</a>
<h2>Command line API</h2>
<pre>
# Upload a file
curl -F'file=@yourfile.png' <a href="{{.RootURL}}">{{.RootURL}}</a>
# Shorten a URL
curl -F'shorten=http://example.com/some/long/url' <a href="{{.Request.Host}}">{{.Request.Host}}</a>
# Shorten a URL
curl -F'shorten=http://example.com/some/long/url' <a href="{{.RootURL}}">{{.RootURL}}</a>
# Shorten a URL with a token to delete it later
curl -F'shorten=http://example.com/some/long/url' -F'deleteToken=' <a href="{{.Request.Host}}">{{.Request.Host}}</a>
# The first line of the result will contain the shortened URL.
#
# In the other lines, you will find other information, including
# information on how to delete the shortened object.
# Upload output from another process
figlet Rushlink | curl -F'file=@-' <a href="{{.RootURL}}">{{.RootURL}}</a>
# To upload a file and only extract the shortened URL (i.e. throw away the rest)
curl -F'file=@yourfile.png' <a href="{{.RootURL}}">{{.RootURL}}</a> | head -n 1
</pre>
{{end}}
{{end}}

View File

@ -1,3 +0,0 @@
{{define "title"}}
Success - rushlink
{{end}}

View File

@ -1,3 +1,45 @@
{{define "title"}}
'{{.Paste.Key}}' meta info - rushlink
{{end}}
'{{.Paste.Key}}{{.FileExt}}' metadata - rushlink
{{end}}
{{define "head-append"}}
<script type="text/javascript" src="/js/copyclipboard.js" defer></script>
{{end}}
{{define "body"}}
<pre id="copyToClipboardContainer" class="hidden">
<button onclick="copyToClipboard('{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}')">Copy URL to clipboard</button> <span id="copyToClipboardStatus"></span>
</pre>
<pre>
<a href="{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}">{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}</a>
---
{{if and (ne .Paste.State.String "deleted") .CanDeleteBool}}
with delete token: <a href="{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}">{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}</a>
{{else -}}
with delete token: &lt;unknown&gt;
{{end -}}
type: {{.Paste.Type}}
state: {{.Paste.State}}
{{if .Paste.CreatedAt.IsZero -}}
created: unknown
{{else -}}
created: {{.Paste.CreatedAt}}
{{end -}}
{{if .Paste.UpdatedAt.IsZero -}}
last updated: unknown
{{else -}}
last updated: {{.Paste.UpdatedAt}}
{{end -}}
{{if .Paste.DeletedAt.Valid -}}
deleted at: {{.Paste.DeletedAt.Time}}
{{end -}}
delete token: {{.CanDeleteString}}
<form action="delete?deleteToken={{.Paste.DeleteToken}}" method="post">
<input type="submit" name="delete" value="Delete paste"
{{- if or (eq .Paste.State.String "deleted") (not .CanDeleteBool) -}}
disabled
{{- end -}}
>
</form>
</pre>
{{end}}

View File

@ -6,11 +6,19 @@ the command line.
## USAGE
# Upload a file
curl -F'file=@yourfile.png' {{.Request.Host}}
# Upload a file
curl -F'file=@yourfile.png' {{.RootURL}}
# Shorten a URL
curl -F'shorten=http://example.com/some/long/url' {{.Request.Host}}
# Shorten a URL
curl -F'shorten=http://example.com/some/long/url' {{.RootURL}}
# Shorten a URL with a token to delete it later
curl -F'shorten=http://example.com/some/long/url' -F'deleteToken=' {{.Request.Host}}
# The first line of the result will contain the shortened URL.
#
# In the other lines, you will find other information, including
# information on how to delete the shortened object.
# Upload output from another process
figlet Rushlink | curl -F'file=@-' {{.RootURL}}
# To upload a file and only extract the shortened URL (i.e. throw away the rest)
curl -F'file=@yourfile.png' {{.RootURL}} | head -n 1

View File

@ -1,5 +0,0 @@
{{- if .Request.PostForm.deleteToken -}}
{{.Request.Host}}/{{.Paste.Key}}?deleteToken={{.Paste.DeleteToken | urlquery}}
{{else -}}
{{.Request.Host}}/{{.Paste.Key}}
{{end -}}

View File

@ -1,17 +1,21 @@
METADATA on <{{.Request.Host}}/{{.Paste.Key}}>:
TYPE: {{.Paste.Type}}
STATE: {{.Paste.State}}
{{if .Paste.TimeCreated.IsZero -}}
CREATED: undefined
{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}
---
{{if and (ne .Paste.State.String "deleted") .CanDeleteBool}}
with delete token: {{.RootURL}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}
{{else -}}
CREATED: {{.Paste.TimeCreated}}
with delete token: <unknown>
{{end -}}type: {{.Paste.Type}}
state: {{.Paste.State}}
{{if .Paste.CreatedAt.IsZero -}}
created: unknown
{{else -}}
created: {{.Paste.CreatedAt}}
{{end -}}
DELETE TOKEN: {{.CanDelete.String}}
delete token: {{.CanDeleteString}}
{{if and (ne .Paste.State.String "deleted") .CanDelete.Bool}}
{{if and (ne .Paste.State.String "deleted") .CanDeleteBool}}
```
# To delete this {{.Paste.Type}}, execute:
curl --request "DELETE" "{{.Request.Host}}/{{.Paste.Key}}?deleteToken={{.Request.URL.Query.Get "deleteToken"}}"
curl --request "DELETE" "{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}"
```
{{end}}

484
bindata.go Normal file
View File

@ -0,0 +1,484 @@
// Code generated for package rushlink by go-bindata DO NOT EDIT. (@generated)
// sources:
// assets/css/main.css
// assets/js/copyclipboard.js
// assets/js/dragdrop.js
// assets/templates/html/base.html.tmpl
// assets/templates/html/error.html.tmpl
// assets/templates/html/index.html.tmpl
// assets/templates/html/pasteMeta.html.tmpl
// assets/templates/txt/base.txt.tmpl
// assets/templates/txt/error.txt.tmpl
// assets/templates/txt/index.txt.tmpl
// assets/templates/txt/pasteMeta.txt.tmpl
package rushlink
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
)
func bindataRead(data []byte, name string) ([]byte, error) {
gz, err := gzip.NewReader(bytes.NewBuffer(data))
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
var buf bytes.Buffer
_, err = io.Copy(&buf, gz)
clErr := gz.Close()
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
if clErr != nil {
return nil, err
}
return buf.Bytes(), nil
}
type asset struct {
bytes []byte
info os.FileInfo
}
type bindataFileInfo struct {
name string
size int64
mode os.FileMode
modTime time.Time
}
// Name return file name
func (fi bindataFileInfo) Name() string {
return fi.name
}
// Size return file size
func (fi bindataFileInfo) Size() int64 {
return fi.size
}
// Mode return file mode
func (fi bindataFileInfo) Mode() os.FileMode {
return fi.mode
}
// Mode return file modify time
func (fi bindataFileInfo) ModTime() time.Time {
return fi.modTime
}
// IsDir return file whether a directory
func (fi bindataFileInfo) IsDir() bool {
return fi.mode&os.ModeDir != 0
}
// Sys return file is sys mode
func (fi bindataFileInfo) Sys() interface{} {
return nil
}
var _cssMainCss = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x51\xd1\x6e\xc3\x20\x0c\x7c\xcf\x57\x58\xaa\x26\x6d\x55\xd3\xd2\xa9\x5d\x57\xf2\x27\x7b\x23\xc1\x49\xac\x11\x8c\x80\xae\x49\xa7\xfe\xfb\x94\x84\xac\xd3\x10\x02\x7c\x77\x36\x27\xbb\x64\x3d\xc0\x77\x06\x00\x50\xb3\x8d\x79\xad\x3a\x32\x83\x84\x8e\x2d\x07\xa7\x2a\x2c\xb2\x7b\x96\xad\xb4\x67\xf7\xc1\x16\x93\xb4\x54\xd5\x67\xe3\xf9\x62\x75\x5e\xb1\x61\x2f\xc1\x37\xa5\x7a\x16\x1b\x18\xf7\xf6\x75\x3c\x4e\xc7\x97\x62\x12\x27\xc5\xb5\xa5\x88\xc5\xe3\xa7\x40\x37\x94\xf0\x26\x5c\xff\x07\xbc\x22\x35\x6d\x94\x50\xb2\xd1\x33\xdc\x26\x64\x2f\xc4\x53\x01\xcb\x9a\x28\x83\x75\x94\x20\x8a\x39\x72\x4a\x6b\xb2\x8d\x84\x3d\x76\x73\xaa\xe3\x40\x91\xd8\x4a\xa8\xa9\xc7\x54\x2f\xb2\x1b\x73\xe6\xb7\x57\x76\x91\x7c\x51\xa0\x92\x0c\xc5\x01\xf6\xa7\x63\x17\x36\xc0\x4e\x55\xbf\xe1\x9c\x70\x25\x1d\xdb\xe4\x65\x02\x6e\x39\x59\x8d\xbd\x84\xf3\xf9\xfc\x70\x97\x3c\xde\xb3\xcc\xf9\xa5\x65\xc9\x5e\x3e\x9b\x3e\x60\x5f\xc0\x6e\x0d\xca\x39\xcf\x3d\x1c\x1e\xfd\xd6\x30\x5d\x01\xd6\xbb\xb1\xc0\x36\x5c\xaa\x0a\x43\x48\x55\x52\x2f\x57\x42\xbc\x0b\x21\xa6\xd9\x6c\x6b\x45\xe6\x1f\x3d\x92\x0b\xdd\x92\xd6\x68\x93\x40\x53\x70\x46\x0d\x12\x2c\xdb\x69\xb4\x3f\x01\x00\x00\xff\xff\x22\xc0\x9d\x3a\x00\x02\x00\x00")
func cssMainCssBytes() ([]byte, error) {
return bindataRead(
_cssMainCss,
"css/main.css",
)
}
func cssMainCss() (*asset, error) {
bytes, err := cssMainCssBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "css/main.css", size: 512, mode: os.FileMode(420), modTime: time.Unix(1590859748, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _jsCopyclipboardJs = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x54\x4f\x6b\xe3\x3e\x10\xbd\xfb\x53\x4c\x75\xb2\xc9\x0f\xf3\x3b\xd7\x78\xa1\x4d\xbb\x10\x28\x4d\x69\xdc\xc3\x9e\x82\x2a\x4d\x1c\xb1\xb2\x14\xa4\x71\xd2\xb2\xf8\xbb\x2f\xb2\xe3\xc4\xf9\xcb\xf6\x50\x1f\x12\x12\x8f\xde\xcc\x7b\x6f\x9e\x58\xed\x11\x3c\x39\x25\x88\x65\x51\x24\xac\xf1\x04\xe3\xe9\xcb\xaf\x79\x31\x9d\x8f\x9f\x26\x2f\xf7\xd3\xbb\xd7\x87\xf9\x78\xfa\x5c\xdc\x4d\x9e\x1f\x5f\xe7\x93\x07\xc8\x81\x09\xbb\xfa\x2c\xec\x58\xab\xd5\xbb\xe5\x4e\x8e\xad\x21\xae\x0c\x3a\x96\x5d\x84\x98\x15\x77\xc5\xdb\xec\xfc\xf9\x19\x71\xaa\x3d\xcb\x22\x8d\x04\xc7\xd8\xe4\x20\x87\xff\xb3\x28\x5a\xd4\x46\x90\xb2\xe6\xb8\x62\x56\x0b\x81\xde\xc7\x09\xfc\x89\x00\x00\x02\x88\x6f\x11\x1f\x35\x56\x90\x83\xb4\xa2\xae\xd0\x50\x5a\x22\x85\xbf\xd0\xd0\xfd\xe7\x44\xc6\x57\x86\x4c\xb2\x16\x6a\x0f\x93\x2a\x63\xd0\x15\xf8\x41\x61\xfe\xb7\xd7\xa7\x30\x85\x42\x79\xc3\x4e\x2a\x85\xe6\xde\x3f\x29\x4f\xa9\xc3\xca\xae\x31\x66\x0b\xae\x34\x3b\x85\xdc\x17\x72\x29\x63\xe6\x3b\x1e\xa1\xb0\xb9\xcc\xf6\x27\x57\x3a\x16\xbc\xf6\xf8\x0d\x7c\xd5\x02\xe2\x9b\x2d\x78\xfb\x15\xc8\xd6\xe6\xb7\xb1\x1b\x03\xe8\x9c\x75\x5b\xba\xa1\x67\xe5\xcb\xde\x4b\x08\x0c\x51\xde\x02\x83\x51\x77\xb0\x2b\x0b\xcb\x60\x35\xa6\xda\x96\x71\xe5\xcb\xeb\xaa\x56\xbe\xfc\x07\x2d\x07\x2a\x5d\x97\xb3\x17\xfd\x8a\x96\x71\xed\xf4\x50\xc5\xf0\xfa\x71\x8d\x86\x26\xf2\x03\x72\x18\x8d\x4e\x77\x31\x8b\xf6\x42\x6d\x94\x91\x76\x93\x1a\xbe\x56\x25\x27\xeb\x52\xd1\x17\xf6\xa0\x9d\x06\xa7\xfe\x31\x61\x6b\x2d\xc1\x58\x02\xde\xd2\x81\xdd\xd1\x9e\x58\x78\x1c\x52\xed\x4c\xf7\xbb\x69\x3f\x2f\xb7\x4c\x37\x4e\x11\x06\x29\x5b\x56\x29\x2d\xd1\xc4\x71\x02\xf9\x8f\xc1\x2c\x61\xec\x33\xf9\xba\xc9\xf3\x03\xee\xc9\x41\xe7\x33\x24\x76\x91\xdb\xce\xf6\x1f\x7c\x57\xa7\x56\xae\xbe\x4d\xe7\x66\xbc\xb3\x73\x17\xf9\x2f\xd8\x31\xdc\x5c\x6e\xce\x3a\x90\x1d\xb0\xd8\xc2\x6a\x2b\x78\x68\x9a\xae\x9c\x25\x2b\xac\x6e\xb9\xb0\x25\xd1\xca\xdf\xb2\x61\x87\xf0\x84\x0e\xa3\x1c\xd8\x2d\x6c\xf0\xdd\x2b\xc2\xd6\xeb\xda\x2b\x53\x42\x7b\x84\xed\xca\x9b\x01\xf5\x2e\x2d\x6d\xd0\x06\x79\x69\x00\xb5\xc7\x23\x0e\xa2\xbf\x73\xbf\x14\xf8\xe1\x45\x9e\x0c\x45\xdf\x82\x9d\x09\xdc\x52\x49\x89\xa6\x5f\xcb\x26\x6a\x92\xe0\xc7\xdf\x00\x00\x00\xff\xff\x70\xbd\x7a\x61\x39\x06\x00\x00")
func jsCopyclipboardJsBytes() ([]byte, error) {
return bindataRead(
_jsCopyclipboardJs,
"js/copyclipboard.js",
)
}
func jsCopyclipboardJs() (*asset, error) {
bytes, err := jsCopyclipboardJsBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "js/copyclipboard.js", size: 1593, mode: os.FileMode(420), modTime: time.Unix(1590859748, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _jsDragdropJs = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x95\xcd\x6e\xdb\x46\x10\xc7\xef\x7e\x8a\x01\x7b\xa0\x08\x28\x94\x22\x20\x8e\x11\xd5\x39\xb4\x4e\xd1\x02\x4d\xd3\x83\x8d\x02\xbd\x0d\x77\x47\xe4\xd4\xab\x5d\x62\x77\x24\x86\x28\x72\xeb\x93\xf4\xd1\xfa\x24\xc5\x2e\x3f\x2c\xb7\xb6\x63\x9f\x04\x91\xf3\xf1\x9b\xff\xfc\x97\x9b\x1d\x02\x41\x10\xcf\x4a\xb2\xed\xd9\x59\xc7\x56\xbb\xae\x44\xad\x3f\x1c\xc9\xca\xcf\x1c\x84\x2c\xf9\x45\x7e\xf5\xe9\xe3\xf7\xce\x4a\x7c\xe6\x50\x93\xce\x97\xb0\xa0\x18\x52\xc0\xe5\x7b\xf8\xf3\x0c\x00\x60\xb5\x82\xeb\x86\x80\xf7\xad\xa1\x3d\x59\x41\x61\x67\xc1\xed\x40\x1a\x0e\xa0\x3d\xd6\xaf\xb4\x77\x2d\x18\x57\xb3\x02\x0e\x60\xd0\xd7\x64\x7a\xa8\x30\x90\x06\x67\x41\x1a\x9a\x2a\xa1\x0d\x1d\x79\xd0\x14\x94\xe7\x8a\x34\xb0\x85\x6f\x1b\x91\x36\xbc\x5b\xad\x82\xa0\xba\x75\x47\xf2\x3b\xe3\xba\x52\xb9\xfd\x0a\x57\x9b\x8b\xcd\xe6\x7c\xbd\xd9\xac\xde\x6c\xd6\x6f\xd7\x17\xaf\xdf\x97\x63\xa9\x53\xb6\x9a\x83\xc4\xce\x91\xe8\x1d\xd0\x91\x7c\x0f\xc2\x7b\x8a\x9d\x13\x21\x90\x15\xf2\x01\x10\x2c\x75\x70\xf5\xe9\x23\xb8\xea\x0f\x52\xb2\x04\x16\xe8\xd8\x98\xa9\xda\x8e\x3d\x8d\x51\x79\x4c\x4c\x79\x39\x24\x4d\x86\x51\x50\x80\x06\x21\x4a\x80\xeb\xf8\x97\x63\xdd\x16\xd9\x2e\xa1\x22\x85\x87\x30\x4f\xdb\x11\x68\x07\xd6\x09\xdc\x5a\xd7\x41\xd7\xb0\x6a\xa6\xec\xd4\x16\xaa\x81\xd1\x60\x10\x10\x07\x9e\x14\xf1\x31\x12\xc4\xe6\x86\xf0\x38\xd7\x4a\x08\xcb\xa8\x97\xc2\x30\x64\x1d\x02\x79\xc0\xca\x79\x09\xe9\x7f\xeb\x9d\xa2\x10\x1e\x50\xc8\xd3\xce\x79\x5a\x46\xa0\xe8\x0c\xb4\x70\x53\x9b\x1e\x7e\x44\x75\xfb\xcf\x5f\x7f\xa7\x41\xc8\xd3\x8c\x84\xf6\x84\x52\x1a\x60\x3d\xd5\xca\xe3\xaa\x7f\x77\x96\xf2\xe5\x38\x4e\x65\x9c\xba\x1d\xfa\x2b\x17\x3d\x22\x04\x2d\xd6\x54\x02\xfc\xd6\x90\x05\xfc\xbf\x90\x53\x31\x0e\xd3\xc0\xc9\x26\x68\xfb\xb4\x9a\xb1\x75\xa2\x4d\x44\x07\xdb\xb0\xa6\xc1\x6f\x7b\xa7\xd1\xa4\x06\xaf\x52\x67\xf2\xe5\xdd\x9c\x1c\x86\x84\xfa\x80\x1e\xad\x50\x9c\x76\x58\x59\xc4\xb3\xf4\x59\x20\xbf\xb7\xd1\x69\xe0\x13\x8c\xa9\x5a\xea\x76\xd7\xe7\xde\xd2\x39\x4c\xf9\x04\xa1\x41\x63\x80\x6b\xeb\x3c\x3d\xa0\xbc\x8d\x3a\x91\x8d\x9e\xbc\xdb\x59\x10\xd7\xc6\x7f\xec\x07\x77\xa2\x8a\x67\xea\x6e\xe0\xc9\x06\x27\x07\x27\x9f\x0d\x91\x8f\x47\x0a\xf2\x6f\xe6\x65\x9c\xd0\xfd\x12\x8d\x46\x93\xe1\xc8\x02\x7d\x46\x25\xa6\x9f\x4f\xe0\x69\xcb\xb8\x02\x85\x56\x91\x31\xa4\x61\x81\x56\xcf\x0c\xa3\xe4\x34\x2a\x3e\x36\x98\xab\x28\xe5\xbc\x66\x5b\x9b\xbe\x28\xcf\xd2\x53\x43\x02\x13\x10\x5c\x82\x76\xea\x90\x90\x6a\x92\x0f\x43\xf2\x77\xfd\x4f\x7a\x91\x4d\x31\x59\xb1\x4d\x79\x8f\x7d\x9c\xb2\xd9\x36\xd9\x03\x5f\xa5\x91\xe3\x66\x90\x13\xe3\x11\xb8\x37\xd9\x1c\x34\xb5\x2b\x83\xf4\x86\xca\x23\x07\xae\xd8\xb0\xf4\x70\x09\x59\xb6\x7d\x2c\xce\xb5\xa8\x86\xa0\xd7\x43\xcc\x97\x62\x3b\xcc\x39\x07\x3e\x44\xec\xda\xaf\xc1\xc6\x98\xc8\xba\x63\x43\xf3\xcb\x94\x50\xb6\x3e\xfd\x5e\xd1\x0e\x0f\x46\x16\xc5\x09\xdc\x63\x62\xc6\x2a\x37\xad\x71\xa8\x7f\x60\x32\x3a\x2b\xca\xf8\x24\xc0\xe5\x58\x52\xa3\xe0\xb5\x47\x1b\x76\xe4\x87\x57\x2f\x2b\xea\xfc\x3e\x2b\xca\x70\xa8\xf6\x3c\x03\x3d\x4f\x89\xd1\xad\x5f\x93\x63\x70\x5f\x78\xf9\xea\x1a\xd6\x9a\xec\x73\x16\xb8\xfe\x0f\xf6\x93\x86\x8b\xd7\xcf\x13\xcc\xbf\x0e\x2b\x4a\x07\xa3\xf2\xae\x8b\x23\xec\xbc\xdb\x83\x6b\xc9\xb2\xad\xd3\x8b\xa8\xdf\x7c\x17\xc4\x9b\x12\x13\xdc\xc9\xc7\x6f\xac\x36\x1e\xe4\x11\x08\x60\xf1\xe4\x55\x78\xfe\xf6\xcd\xf9\xf9\xc5\x7a\xbe\x09\x8b\x67\xd9\x27\x8e\xfd\xa5\xd8\xfe\x1b\x00\x00\xff\xff\xdf\xfa\x50\xb3\x12\x08\x00\x00")
func jsDragdropJsBytes() ([]byte, error) {
return bindataRead(
_jsDragdropJs,
"js/dragdrop.js",
)
}
func jsDragdropJs() (*asset, error) {
bytes, err := jsDragdropJsBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "js/dragdrop.js", size: 2066, mode: os.FileMode(420), modTime: time.Unix(1609421047, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templatesHtmlBaseHtmlTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\x31\x6f\x84\x30\x0c\x85\xf7\xfb\x15\xae\x77\xc8\xda\x21\xb0\xb4\x9d\x7b\x43\x97\x8e\x39\xf0\x29\xe8\x0c\x87\x12\x9f\x54\x14\xe5\xbf\x57\x38\x55\xc3\x70\x13\xb6\x1f\x7e\x9f\x5f\xec\xcb\xfb\xe7\xdb\xd7\xf7\xf9\x03\xbc\xcc\xdc\x9f\x6c\xf9\x00\x00\x58\x4f\x6e\x2c\xa5\xb6\x33\x89\x83\xc1\xbb\x10\x49\x3a\x7c\xc8\xb5\x79\xc5\x83\x2c\x93\x30\xf5\x29\x5d\xf8\x3e\xdc\x00\xb5\x45\x68\x73\x0e\x8f\xe8\x79\x5a\x6e\x29\xd1\x32\xe6\x6c\x4d\xf9\xb3\x6e\xee\x22\x04\xe2\x0e\xa3\x6c\x4c\xd1\x13\x09\x82\x6c\x2b\x75\x28\xf4\x23\x66\x88\x11\xc1\x07\xba\x76\xb8\xd7\x66\x76\xd3\xd2\xea\xd0\x54\x9b\x7f\xf2\x7e\x76\xe3\xd6\x95\x96\x51\xf9\xca\x85\x26\xe7\x92\xca\xd4\x58\xf6\x72\x1f\xb7\x27\x0e\xfb\x58\x57\xeb\x8d\x6b\xa0\xfe\x94\xd2\xe0\x98\xa1\x3d\x07\x3a\x6a\x46\xc5\xea\xa2\x31\xff\x60\x85\x60\x8d\x3e\xeb\x6f\x00\x00\x00\xff\xff\x1e\x3c\x4d\x87\x6d\x01\x00\x00")
func templatesHtmlBaseHtmlTmplBytes() ([]byte, error) {
return bindataRead(
_templatesHtmlBaseHtmlTmpl,
"templates/html/base.html.tmpl",
)
}
func templatesHtmlBaseHtmlTmpl() (*asset, error) {
bytes, err := templatesHtmlBaseHtmlTmplBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "templates/html/base.html.tmpl", size: 365, mode: os.FileMode(420), modTime: time.Unix(1590859748, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templatesHtmlErrorHtmlTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xaa\xae\x4e\x49\x4d\xcb\xcc\x4b\x55\x50\x2a\xc9\x2c\xc9\x49\x55\xaa\xad\xe5\x72\x2d\x2a\xca\x2f\x52\xd0\x55\x28\x2a\x2d\xce\xc8\xc9\xcc\xcb\xe6\xaa\xae\x4e\xcd\x4b\xa9\xad\x05\x04\x00\x00\xff\xff\x73\xdb\x0d\xaf\x2b\x00\x00\x00")
func templatesHtmlErrorHtmlTmplBytes() ([]byte, error) {
return bindataRead(
_templatesHtmlErrorHtmlTmpl,
"templates/html/error.html.tmpl",
)
}
func templatesHtmlErrorHtmlTmpl() (*asset, error) {
bytes, err := templatesHtmlErrorHtmlTmplBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "templates/html/error.html.tmpl", size: 43, mode: os.FileMode(420), modTime: time.Unix(1568580372, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templatesHtmlIndexHtmlTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x95\x4d\x6f\xe3\x36\x13\xc7\xef\xfc\x14\xb3\xf4\x61\x9f\x07\x88\xc5\x64\x8f\xae\x24\xf4\x0d\x01\x16\x70\x81\xc2\x5b\xa3\x40\x6f\xb4\x38\xb2\x98\x52\x1c\x81\x1c\xd9\x31\xbc\xfe\xee\x05\x29\x3b\x71\x52\x64\xd1\x00\x45\x6f\x1a\x72\xe6\x3f\xe4\x6f\x86\xa3\xe3\xd1\x60\x6b\x3d\x82\xec\x50\x9b\xb9\x1e\x06\xf4\x46\x9e\x4e\xa2\x8c\x4d\xb0\x03\x03\x1f\x06\xac\x24\xe3\x23\xab\x07\xbd\xd3\xd3\xaa\x84\x18\x9a\x4a\xaa\x87\xa8\x4c\xd0\x5b\x13\x68\x28\x1e\xa2\x04\x83\x2d\x86\xba\x54\x93\x57\x2d\x8e\x47\xf4\xe6\x74\x12\xe2\x39\xcd\x86\xcc\x21\xeb\x1b\xbb\x83\xc8\x07\x87\x95\xdc\xd9\x68\x37\xd6\x59\x3e\x2c\x3a\x6b\x0c\xfa\xef\x80\x06\xdd\x24\xfb\x56\x82\x35\x95\x4c\x19\xfe\x20\x8f\xb2\xbe\xb7\x0e\xc1\xfa\x86\x7a\xeb\xb7\x1f\x60\xf1\x73\xa9\x8c\xdd\xd5\xa2\xec\xee\xea\xd9\x6a\x0d\x83\x8e\x8c\x73\x33\xf6\x43\xa9\xba\xbb\x5a\x88\x1f\x75\x44\x03\xe4\xa1\x63\x1e\xe2\x42\xa9\xdb\xc7\xdb\x22\xb2\xba\x01\xee\x6c\x84\x68\x19\x41\x3b\x47\xfb\x08\x07\x1a\x81\x09\x50\x47\xeb\x0e\x30\x0e\x8e\xb4\x81\xd6\x3a\x8c\xa0\xbd\x81\xd8\x51\x60\xf4\xb0\x5e\x2d\x23\x8c\xd1\xfa\xad\xe0\x0e\xa1\xa1\xbe\x4f\xdb\xce\x7a\x2c\x84\x28\xbb\x4f\xf5\xef\xb8\x99\xff\xf0\xeb\xe7\x52\x75\x9f\x6a\x51\x46\x6c\xd8\x92\xaf\x05\x00\x40\xd9\x52\xe8\xf3\x9d\x92\xf0\x3a\xe7\xb8\xa7\xd0\x4b\xd0\xd9\xab\x92\x4a\x42\x8f\xdc\x91\xa9\xe4\x40\x91\x25\xa0\x6f\xa6\x2a\xf4\xa3\x63\x3b\xe8\xc0\x2a\x89\xcc\x8d\x66\x2d\x27\xd5\xac\xec\xf4\x06\x1d\x34\x4e\xc7\x58\xc9\xe4\xb1\x4c\x0b\x12\x5a\x0a\x2f\xb2\x59\x74\x46\xd6\x93\x01\x3a\x5f\x70\x51\xaa\x1c\x7d\xa5\x66\xfd\x30\xf2\xeb\x83\xe6\xd0\xeb\x14\xbf\x68\xeb\x25\x78\xdd\xe3\xe4\x27\xcf\x0d\x33\x7d\xab\x77\xeb\x7d\x19\x37\xbd\xe5\x8b\x4a\x3c\x5b\x3b\xed\x46\xac\xe4\x54\x91\x0f\x4f\xba\x65\xe6\x50\x8b\x52\x3d\x21\x7e\x0b\xf6\xb9\x76\xeb\xd5\xf2\xbf\x80\x7d\x95\xed\x15\xec\xf5\x6a\xf9\x4d\xd6\xaf\x23\xdf\x62\x7d\xf6\xbb\x80\x1a\x83\x7b\x8b\xf6\xb3\xe2\x85\xed\x3f\xc5\x7d\x8e\xfc\x26\xef\xdc\xee\x3f\x5d\xbd\x00\x78\xee\xfb\x21\x60\x2d\x66\xf0\xa2\xd1\x44\x33\x06\x07\xf3\xfb\x8f\xc9\xa8\xbe\x3f\xd0\x18\xd2\x57\x31\xf8\xed\x47\x28\x35\x74\x01\xdb\x4a\x1e\x8f\xc5\x8a\x88\xd7\xab\xe5\xe9\x24\xeb\x6b\xab\x54\xba\x16\x62\x06\x5f\xce\x6f\x31\x13\x7d\x12\x3d\x9f\xb8\x4a\x4f\x7d\xa1\x14\x3e\xea\x7e\x70\x58\x34\xd4\xab\x48\x3d\x2a\x47\x7e\xab\xc6\xe0\xde\x95\xea\xb7\x0e\xa1\xb5\x21\xf2\x74\x3f\x6a\x21\xbd\xfa\x80\x71\x74\x0c\x7b\xeb\x1c\x34\xe4\x59\x5b\x9f\xd7\xcf\x47\x40\x93\x0e\x56\x88\x99\x98\xc1\xe7\x69\x87\xb8\xc3\x90\x35\xe2\x4d\x1e\x35\x39\xb6\xb5\xde\x9c\xb7\xac\x4f\x78\x75\x02\x7b\x93\x46\x9c\x1b\x4d\x9a\x31\xb3\xeb\x8d\x3c\xc8\x68\x9f\xc6\x94\x41\x87\x8c\xaf\x92\xd2\xe6\x01\x1b\x2e\xc4\x33\x77\x1a\x39\xb5\x42\x1b\xa8\x07\xed\xa7\x4c\x43\xa0\x06\x63\x14\xad\xdd\x3a\x64\x58\x8d\xb1\x73\xd6\xff\x09\x5f\xe1\x65\x79\xe6\xef\x03\x45\x97\x99\x39\xd5\x3a\x0f\x4d\xf2\xee\x00\xf8\xc8\x41\x37\xfc\x77\x40\xf0\x3f\x5b\x60\x01\xdc\x05\xda\x83\xde\xeb\xc3\x85\x2d\xff\xff\xdf\xe8\x14\xf8\x0a\xe9\xb7\x06\x73\x0f\x77\xa2\x54\xb9\x21\x2f\xff\xa4\xbf\x02\x00\x00\xff\xff\x55\x95\x0e\x65\xfa\x06\x00\x00")
func templatesHtmlIndexHtmlTmplBytes() ([]byte, error) {
return bindataRead(
_templatesHtmlIndexHtmlTmpl,
"templates/html/index.html.tmpl",
)
}
func templatesHtmlIndexHtmlTmpl() (*asset, error) {
bytes, err := templatesHtmlIndexHtmlTmplBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "templates/html/index.html.tmpl", size: 1786, mode: os.FileMode(420), modTime: time.Unix(1609421047, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templatesHtmlPastemetaHtmlTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x94\xc1\x6e\xdb\x38\x10\x86\xef\x7a\x8a\x01\x0f\x89\x73\x90\x75\x4f\x24\x2d\x76\x9d\x5d\x60\xd1\x1c\x8a\xd4\xe9\xa1\x37\x5a\x1c\xc7\x8c\x69\x92\x25\x47\x49\x0c\x82\xef\x5e\x50\xb4\x65\xa7\x71\x5b\xe7\x22\x40\xc3\xe1\xf7\xcf\x3f\x98\x61\x08\x02\x97\x52\x23\x30\x92\xa4\x90\xc5\x58\x5c\x86\x30\xfd\xcc\x3d\xe1\xf4\x13\x6e\x63\x0c\x61\xfa\x9f\x54\xf8\xef\x2b\xc5\x78\x09\x1b\x24\x2e\x38\x71\x28\xc1\xf5\x7e\xa5\xa4\x5e\x17\x21\xa0\x16\x31\x16\xc5\x01\xb6\x42\x2e\x4a\x6e\x2d\x6a\x91\x90\xb5\xef\x9c\xb4\x04\xb4\xb5\xd8\x30\xc2\x57\xaa\x9e\xf8\x33\xcf\x51\x06\xde\x75\x0d\xab\x9e\x7c\xd5\x19\xbb\xed\x94\xb4\x0b\xc3\x9d\x98\x3e\x79\x06\x02\x97\xe8\xda\xba\xca\xa9\xed\x29\xad\x85\x11\xdb\x41\xc4\x3a\x04\x29\x1a\x96\x28\x73\x33\xdb\x73\x66\x46\x13\x97\x1a\x1d\x83\x4e\x71\xef\x1b\xb6\x92\x42\xa0\x66\x6d\x51\x2f\x7a\x22\xa3\xc1\xe8\x4e\xc9\x6e\xfd\xee\xea\x24\xf5\xe2\xde\x18\x7a\xb8\xbf\x8b\xb1\xfa\x4d\x63\xae\x58\x3b\x33\x76\x0b\x0f\xf7\x77\x40\x06\x46\x13\x75\x95\x25\x5a\xa8\xbd\xe5\xfa\x54\x7d\x5f\x88\x53\xef\x59\x32\x69\xb9\x6e\x8b\xba\xb2\x0e\xdb\xc1\x4e\x5b\xd4\x1c\x56\x0e\x97\x0d\x3b\xb3\x10\xd6\x9e\x99\x58\x57\xbc\x2d\xca\xb2\x2c\x42\x90\x4b\xe0\x5a\xc0\x44\x23\xec\xb2\x53\x49\xe9\xeb\xa4\x7e\x04\x26\x50\x21\xa1\x60\x57\x30\x9d\x71\x7d\x3b\xfc\xfd\x63\x8c\x8a\xb1\x78\x91\xb4\x82\x7c\x0e\x64\xd6\xa8\xaf\xe1\xa3\x15\xff\x95\xaf\xcf\xd3\xed\x66\x4c\xbb\x3d\x04\x3f\x60\xea\x0c\xd6\xe0\x3b\x04\x54\x1e\xa1\x3c\xed\xe0\x42\xd1\x4d\xaf\xd7\xda\xbc\xe8\x8b\x47\xba\xc9\x33\x37\x24\xa7\xf9\xbd\x86\x11\x3c\xdf\x5a\x8c\xb1\xf0\xa9\x5b\x47\xe1\xa1\x7b\x31\xe6\xce\xee\x62\x33\x87\x9c\x50\xfc\x4d\xd3\xff\xfd\x37\x74\x66\xc0\x75\x39\x78\x0d\x3b\xb5\xe3\xba\xc6\xb3\x11\x3b\x22\x06\xf4\xbe\xa4\x63\x91\x07\x2b\xde\x8b\x28\xee\x09\xfa\x7c\x72\x52\xe9\x6d\xc2\x28\x37\xc2\x7e\x29\x97\xfb\x9a\xe4\xbe\x72\x25\xf3\xf9\x6e\x56\x80\xd3\x11\xea\x90\x38\x97\x1b\x7c\xc3\x7b\xdb\xf9\x10\x0e\x13\x96\xa7\x2f\xed\xf5\xd2\xb8\x0d\xf0\x8e\xa4\xd1\xcd\x6e\x18\xcf\x19\x9a\xf4\x56\xad\x8c\x68\x98\x35\x9e\xd2\xb2\x4b\x6d\xfb\xfd\x1b\xe4\xfb\xc5\x46\x12\x03\xcd\x37\xb8\x87\x32\x78\xe6\xaa\xc7\x86\x65\x0e\xd8\x04\x65\x45\x08\x25\xc8\x25\x18\x07\x13\xfc\xfe\xa7\x0d\x99\x68\x43\x3f\xad\xc9\x55\x36\x2a\x3d\x5f\x28\x14\x03\x6e\xef\x3e\x2d\x7b\x72\x37\x2e\xfd\xfe\x79\xfb\x11\x00\x00\xff\xff\x3a\xc6\xf5\xbb\x97\x05\x00\x00")
func templatesHtmlPastemetaHtmlTmplBytes() ([]byte, error) {
return bindataRead(
_templatesHtmlPastemetaHtmlTmpl,
"templates/html/pasteMeta.html.tmpl",
)
}
func templatesHtmlPastemetaHtmlTmpl() (*asset, error) {
bytes, err := templatesHtmlPastemetaHtmlTmplBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "templates/html/pasteMeta.html.tmpl", size: 1431, mode: os.FileMode(420), modTime: time.Unix(1620245565, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templatesTxtBaseTxtTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00")
func templatesTxtBaseTxtTmplBytes() ([]byte, error) {
return bindataRead(
_templatesTxtBaseTxtTmpl,
"templates/txt/base.txt.tmpl",
)
}
func templatesTxtBaseTxtTmpl() (*asset, error) {
bytes, err := templatesTxtBaseTxtTmplBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "templates/txt/base.txt.tmpl", size: 0, mode: os.FileMode(420), modTime: time.Unix(1568569370, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templatesTxtErrorTxtTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xaa\xae\xd6\xf3\x4d\x2d\x2e\x4e\x4c\x4f\xad\xad\x05\x04\x00\x00\xff\xff\xa1\x68\xe0\xbd\x0c\x00\x00\x00")
func templatesTxtErrorTxtTmplBytes() ([]byte, error) {
return bindataRead(
_templatesTxtErrorTxtTmpl,
"templates/txt/error.txt.tmpl",
)
}
func templatesTxtErrorTxtTmpl() (*asset, error) {
bytes, err := templatesTxtErrorTxtTmplBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "templates/txt/error.txt.tmpl", size: 12, mode: os.FileMode(420), modTime: time.Unix(1568575116, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templatesTxtIndexTxtTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x91\xcf\x6a\xdc\x30\x10\xc6\xef\x7a\x8a\x0f\x7c\x48\x0b\xbb\x76\x7a\x0d\x2c\xb4\x85\xed\x1f\x08\x2d\x78\xe3\x07\x50\xed\xf1\x5a\xed\x58\x63\xa4\x11\x5e\x93\xe4\xdd\x8b\x9c\x6d\xd9\x26\x3d\x44\x27\x49\xc3\xcc\xef\xe3\x37\x45\xdd\xa0\xa9\x6f\x71\xf8\xf2\xbd\xbe\xdb\x7f\xdb\xd7\x66\xf7\xfc\x18\xf3\xd1\x46\xea\x20\x1e\x83\xea\x14\x6f\xaa\xea\xfa\x74\x5d\x46\xad\x36\xd0\xc1\x45\x44\xa7\x04\xcb\x2c\x73\xc4\x22\x09\x2a\x20\x1b\x1d\x2f\x88\x83\x04\x25\x9f\x09\x11\x29\x3a\x7f\x34\x3a\x10\x5a\x19\x47\xeb\x3b\xb0\xf3\x54\x1a\x53\x14\x68\x0e\x1f\x3e\xef\x8d\x29\xd0\x4c\x2c\xb6\x83\x45\xef\x98\x4c\x9b\x02\x63\xfb\xe9\x2a\x3f\x76\xef\x17\x49\x21\xdf\xca\xc9\x1f\xaf\x70\x7f\x5f\xd6\x22\xda\xd4\xb7\x8f\x8f\xb9\xf3\x70\x66\xd9\x4c\xfb\xdb\x79\x4e\xb0\xcb\xc9\x6f\xaa\x8a\x4e\x76\x9c\x98\xca\x56\xc6\x2a\xca\x48\x15\x8b\x3f\x56\x29\xf0\xcb\x79\x77\x03\xa1\x77\x21\xea\x1a\x13\xd2\x23\x47\x0f\x14\x13\x2b\x66\xc7\x8c\x56\xbc\x5a\xe7\xd7\xff\x33\x87\xba\x4c\x2f\x4d\x61\x0a\x7c\x7d\xaa\x88\x0e\x14\xd6\x19\x71\xb3\xea\x59\x7b\x7b\xe7\xbb\x73\xc9\xf9\x5e\xc2\x68\xd5\x89\xdf\xc0\xf9\x96\x53\x97\x45\x15\x97\x85\x55\xbe\xcc\x59\x6d\x47\x4c\x4a\xcf\xa0\xf2\xe3\x27\xb5\x5a\x5e\x18\x94\xa4\x53\x52\xf4\x41\x46\x58\xff\x44\x9a\x82\xb4\x14\xa3\xe9\xdd\x91\x49\x51\xa7\x38\xb0\xf3\xbf\xf0\x80\x7f\x45\x6f\xff\x63\x43\x90\x2e\x57\x83\xbc\x3f\xf1\xbc\x80\x4e\x1a\x6c\xab\x2f\x2d\xe0\x8d\x2b\xa9\x84\x0e\x41\x66\xd8\xd9\x2e\x7f\x04\xea\xdb\x57\x2f\x16\x0f\x18\xc8\x76\xd8\x7a\xbc\x33\xbf\x03\x00\x00\xff\xff\x54\x6e\xbb\xfa\xac\x02\x00\x00")
func templatesTxtIndexTxtTmplBytes() ([]byte, error) {
return bindataRead(
_templatesTxtIndexTxtTmpl,
"templates/txt/index.txt.tmpl",
)
}
func templatesTxtIndexTxtTmpl() (*asset, error) {
bytes, err := templatesTxtIndexTxtTmplBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "templates/txt/index.txt.tmpl", size: 684, mode: os.FileMode(420), modTime: time.Unix(1590859748, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templatesTxtPastemetaTxtTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x51\x4f\x4b\x3b\x31\x10\xbd\xe7\x53\x0c\xf9\x5d\x7e\x82\x89\xf7\xe2\x1f\xb4\x5d\x41\xec\x41\xea\x7a\xf1\xd4\x65\x77\x6a\x43\x97\xa4\x6e\x66\x69\x97\x30\xdf\x5d\x36\xa9\xb1\xa8\x07\x41\x2f\x81\xcc\xbc\x79\xef\xcd\x9b\x10\xf4\xc2\x39\x7a\x5a\xcc\x99\xcf\x42\xd0\x0f\x95\x27\xd4\xf7\x38\x30\x87\xa0\x6f\x4d\x8b\xc5\x9e\x98\x85\x52\x4a\x84\x60\x56\x50\xd9\x06\xfe\x5b\x84\x03\xf2\x91\xaa\xf8\x76\xc6\xbe\x80\x6c\xb0\x45\xc2\x46\x9e\x80\x9e\x56\x76\x16\x7f\x37\xce\xb5\xcc\x62\x67\x68\x0d\xa9\x0f\xe4\x36\x68\x27\xf0\x43\xed\xab\x34\x55\x8e\x43\x17\x19\x36\xfb\x28\x32\x8b\x10\xb0\xf5\x08\xea\x7b\xa1\xf3\xde\x6e\xac\xdb\xd9\xcb\x11\x67\x9b\x11\x46\xc3\x16\xa3\x83\xc4\x56\x0e\x5b\x64\x16\x7e\xdc\xe6\xa8\x1c\xb7\x8b\xf4\x66\xf5\xbe\xf1\xb4\xc3\x8a\xb0\xb9\x26\x7d\xe7\x9f\xb1\x73\x51\xb4\x4e\xc5\x09\x1c\x94\x8e\x0d\xe5\x5e\xa6\xcd\x14\xc9\x79\x72\x24\xbe\x84\x93\x23\x4c\xf1\x32\x8b\xdf\x9d\x60\xb9\x5c\x8a\x7f\x50\xba\x9c\xce\xda\xf8\xcf\x11\x9c\x02\xee\xb1\xee\x09\x27\xa2\xee\xbb\x16\x94\xea\xf0\xb5\x47\x4f\x20\x67\xc5\xbc\x28\x0b\x09\xf2\xef\xee\x26\xa3\xa7\x18\x01\xb3\x78\x0b\x00\x00\xff\xff\x81\xcd\x43\x9e\x8c\x02\x00\x00")
func templatesTxtPastemetaTxtTmplBytes() ([]byte, error) {
return bindataRead(
_templatesTxtPastemetaTxtTmpl,
"templates/txt/pasteMeta.txt.tmpl",
)
}
func templatesTxtPastemetaTxtTmpl() (*asset, error) {
bytes, err := templatesTxtPastemetaTxtTmplBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "templates/txt/pasteMeta.txt.tmpl", size: 652, mode: os.FileMode(420), modTime: time.Unix(1620245565, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not found", name)
}
// MustAsset is like Asset but panics when Asset would return an error.
// It simplifies safe initialization of global variables.
func MustAsset(name string) []byte {
a, err := Asset(name)
if err != nil {
panic("asset: Asset(" + name + "): " + err.Error())
}
return a
}
// AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("AssetInfo %s not found", name)
}
// AssetNames returns the names of the assets.
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
}
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
"css/main.css": cssMainCss,
"js/copyclipboard.js": jsCopyclipboardJs,
"js/dragdrop.js": jsDragdropJs,
"templates/html/base.html.tmpl": templatesHtmlBaseHtmlTmpl,
"templates/html/error.html.tmpl": templatesHtmlErrorHtmlTmpl,
"templates/html/index.html.tmpl": templatesHtmlIndexHtmlTmpl,
"templates/html/pasteMeta.html.tmpl": templatesHtmlPastemetaHtmlTmpl,
"templates/txt/base.txt.tmpl": templatesTxtBaseTxtTmpl,
"templates/txt/error.txt.tmpl": templatesTxtErrorTxtTmpl,
"templates/txt/index.txt.tmpl": templatesTxtIndexTxtTmpl,
"templates/txt/pasteMeta.txt.tmpl": templatesTxtPastemetaTxtTmpl,
}
// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
// data/
// foo.txt
// img/
// a.png
// b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
node := _bintree
if len(name) != 0 {
cannonicalName := strings.Replace(name, "\\", "/", -1)
pathList := strings.Split(cannonicalName, "/")
for _, p := range pathList {
node = node.Children[p]
if node == nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
}
}
if node.Func != nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
rv := make([]string, 0, len(node.Children))
for childName := range node.Children {
rv = append(rv, childName)
}
return rv, nil
}
type bintree struct {
Func func() (*asset, error)
Children map[string]*bintree
}
var _bintree = &bintree{nil, map[string]*bintree{
"css": &bintree{nil, map[string]*bintree{
"main.css": &bintree{cssMainCss, map[string]*bintree{}},
}},
"js": &bintree{nil, map[string]*bintree{
"copyclipboard.js": &bintree{jsCopyclipboardJs, map[string]*bintree{}},
"dragdrop.js": &bintree{jsDragdropJs, map[string]*bintree{}},
}},
"templates": &bintree{nil, map[string]*bintree{
"html": &bintree{nil, map[string]*bintree{
"base.html.tmpl": &bintree{templatesHtmlBaseHtmlTmpl, map[string]*bintree{}},
"error.html.tmpl": &bintree{templatesHtmlErrorHtmlTmpl, map[string]*bintree{}},
"index.html.tmpl": &bintree{templatesHtmlIndexHtmlTmpl, map[string]*bintree{}},
"pasteMeta.html.tmpl": &bintree{templatesHtmlPastemetaHtmlTmpl, map[string]*bintree{}},
}},
"txt": &bintree{nil, map[string]*bintree{
"base.txt.tmpl": &bintree{templatesTxtBaseTxtTmpl, map[string]*bintree{}},
"error.txt.tmpl": &bintree{templatesTxtErrorTxtTmpl, map[string]*bintree{}},
"index.txt.tmpl": &bintree{templatesTxtIndexTxtTmpl, map[string]*bintree{}},
"pasteMeta.txt.tmpl": &bintree{templatesTxtPastemetaTxtTmpl, map[string]*bintree{}},
}},
}},
}}
// RestoreAsset restores an asset under the given directory
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
info, err := AssetInfo(name)
if err != nil {
return err
}
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
if err != nil {
return err
}
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
if err != nil {
return err
}
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
if err != nil {
return err
}
return nil
}
// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
// File
if err != nil {
return RestoreAsset(dir, name)
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, filepath.Join(name, child))
if err != nil {
return err
}
}
return nil
}
func _filePath(dir, name string) string {
cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}

View File

@ -4,19 +4,34 @@ import (
"flag"
"log"
"gitea.hashru.nl/dsprenkels/rushlink/db"
"gitea.hashru.nl/dsprenkels/rushlink/handlers"
"gitea.hashru.nl/dsprenkels/rushlink/metrics"
"gitea.hashru.nl/dsprenkels/rushlink"
"gitea.hashru.nl/dsprenkels/rushlink/internal/db"
"github.com/pkg/errors"
)
var (
httpListen = flag.String("listen", "127.0.0.1:8000", "listen address (host:port)")
metricsListen = flag.String("metrics_listen", "127.0.0.1:58614", "listen address for metrics (host:port)")
rootURL = flag.String("root_url", "", "host root (example: 'https://example.com', uses an educated guess if omitted)")
)
func main() {
flag.Parse()
if err := db.Open(); err != nil {
filestore, err := db.OpenFileStoreFromEnvironment()
if err != nil {
log.Fatalln(err)
}
database, err := db.OpenDBFromEnvironment()
if err != nil {
log.Fatalln(err)
}
defer db.Close()
go metrics.StartMetricsServer()
handlers.StartMainServer()
migrate := db.Gormigrate(database)
if err := migrate.Migrate(); err != nil {
log.Fatal(errors.Wrap(err, "migrating database"))
}
go rushlink.StartMetricsServer(*metricsListen, database, filestore)
rushlink.StartMainServer(*httpListen, database, filestore, *rootURL)
}

122
contrib/rushlink Executable file
View File

@ -0,0 +1,122 @@
#!/usr/bin/env sh
set -e
LINK=https://hashru.link/
DELFILE="${XDG_DATA_HOME:-$HOME/.local/share}/rushlink/delete"
link() {
case "$1" in
https://*|http://*)
printf '%s' "$1" | curl -sS -F'shorten=<-' "$LINK"
;;
*)
curl -sS -Ffile=@- "$LINK" < "$1"
;;
esac | awk 'NR == 1 { print } $NF ~ /deleteToken=/ { print $NF; exit }' | (
IFS= read -r link
IFS= read -r deletelink
echo "$link"
mkdir -p "$(dirname "$DELFILE")"
echo "$deletelink" >> "$DELFILE"
)
}
del() {
case "$1" in
https://*|http://*)
URL="$1"
;;
*)
URL="$LINK$1"
;;
esac
# Remove file extension, if any.
NAME="${URL##*/}"
URL="${URL%/*}/${NAME%%.*}"
if DELURL=$(grep -s -m1 "$URL?deleteToken=" "$DELFILE"); then
echo "Deleting $URL..." >&2
curl -sS -X DELETE "$DELURL" | grep deleted
else
echo "Delete token for $URL is not known." >&2
exit 1
fi
}
screenshot() {
if command -v import >/dev/null 2>&1; then
CMD="import png:-"
elif command -v maim >/dev/null 2>&1; then
CMD="maim -uks"
else
echo "Neither import (imagemagick) nor maim were found. One of these is needed to make screenshots." >&2
exit 1
fi
FILE=$(mktemp)
if $CMD > "$FILE"; then
LINK=$(link "$FILE")
rm -f "$FILE"
echo "$LINK.png"
if command -v xdg-open >/dev/null 2>&1; then
xdg-open "$LINK.png"
fi
else
rm -f "$FILE"
exit $?
fi
}
if [ $# -gt 0 ]; then
case "$1" in
--help|-h)
CMD=$(basename "$0")
echo "$CMD - Command line tool for $LINK"
echo
echo "Usage:"
echo " $CMD https://example.com/"
echo " Shorten link."
echo " $CMD file.txt"
echo " $CMD < file.txt"
echo " Upload file."
echo " $CMD"
echo " echo hi | $CMD"
echo " Upload file from standard input."
echo " $CMD (--screenshot|-s)"
echo " Select a window or an area of your screen, and upload it as png."
echo " $CMD (--delete|-d) ${LINK}xd42"
echo " $CMD (--delete|-d) xd42"
echo " Delete file or shortened link."
echo
echo "Delete tokens are stored in $DELFILE"
exit 0
;;
--delete|-d)
shift
for url in "$@"; do
del "$url"
done
exit 0
;;
--screenshot|-s)
shift
if [ $# -gt 0 ]; then
echo "No arguments expected to --screenshot" >&2
exit 1
fi
screenshot
exit 0
;;
*)
for url in "$@"; do
link "$url"
done
exit 0
esac
fi
if [ -t 0 ]; then
echo "Sending standard input to $LINK" >&2
echo "^C to cancel, ^D to send." >&2
fi
link /dev/stdin

134
db/db.go
View File

@ -1,134 +0,0 @@
package db
import (
"flag"
"fmt"
"log"
"time"
"github.com/pkg/errors"
bolt "go.etcd.io/bbolt"
"gitea.hashru.nl/dsprenkels/rushlink/gobmarsh"
)
var path = flag.String("database", "", "Location of the database file")
var DB *bolt.DB
// The current database version
//
// If we alter the database format, we bump this number and write a new
// database migration in migrateDatabase().
const CURRENT_MIGRATE_VERSION = 1
// Bucket storing everything that is not a bulk value. This includes stuff like
// the database version, secret site-wide keys.
const BUCKET_CONF = "conf"
// The main bucket for paste values and URL redirects
const BUCKET_PASTES = "pastes"
// This value stores the current migration version. If this value is less than
// CURRENT_MIGRATE_VERSION, the database has to be migrated.
const KEY_MIGRATE_VERSION = "migrate_version"
// Open the bolt database
func Open() error {
if *path == "" {
return errors.New("database not set")
}
var err error
DB, err = bolt.Open(*path, 0666, &bolt.Options{Timeout: 1 * time.Second})
if err != nil {
return errors.Wrapf(err, "failed to open database at '%v'", *path)
}
return DB.Update(migrateDatabase)
}
// Close the bolt database
func Close() error {
if DB == nil {
panic("no open database")
}
return DB.Close()
}
// Get the database path (as was set by flags)
func Path() string {
if path == nil {
return ""
}
return *path
}
// Initialize and migrate the database to the current version
func migrateDatabase(tx *bolt.Tx) error {
dbVersion, err := dbVersion(tx)
if err != nil {
return err
}
// Migrate the database to version 1
if dbVersion < 1 {
log.Println("migrating database to version 1")
// Create conf bucket
_, err := tx.CreateBucket([]byte(BUCKET_CONF))
if err != nil {
return err
}
// Create paste bucket
_, err = tx.CreateBucket([]byte(BUCKET_PASTES))
if err != nil {
return err
}
// Update the version number
if err := setDBVersion(tx, 1); err != nil {
return err
}
}
return nil
}
// Get the current migrate version from the database
func dbVersion(tx *bolt.Tx) (int, error) {
conf := tx.Bucket([]byte(BUCKET_CONF))
if conf == nil {
return 0, nil
}
dbVersionBytes := conf.Get([]byte(KEY_MIGRATE_VERSION))
if dbVersionBytes == nil {
return 0, nil
}
// Version was already stored
var dbVersion int
if err := gobmarsh.Unmarshal(dbVersionBytes, &dbVersion); err != nil {
return 0, err
}
if dbVersion == 0 {
return 0, fmt.Errorf("database version is invalid (%v)", dbVersion)
}
if dbVersion > CURRENT_MIGRATE_VERSION {
return 0, fmt.Errorf("database version is too recent (%v > %v)", dbVersion, CURRENT_MIGRATE_VERSION)
}
return dbVersion, nil
}
// Update the current migrate version in the database
func setDBVersion(tx *bolt.Tx, version int) error {
conf, err := tx.CreateBucketIfNotExists([]byte(BUCKET_CONF))
if err != nil {
return err
}
versionBytes, err := gobmarsh.Marshal(version)
if err != nil {
return err
}
return conf.Put([]byte(KEY_MIGRATE_VERSION), versionBytes)
}

30
fileupload.go Normal file
View File

@ -0,0 +1,30 @@
package rushlink
import (
"log"
"net/http"
"github.com/pkg/errors"
)
// FileUploadFileSystem is a HTTP filesystem handler
type FileUploadFileSystem struct {
fs http.FileSystem
}
// Open opens a file
func (fs FileUploadFileSystem) Open(path string) (http.File, error) {
log.Println(path)
file, err := fs.fs.Open(path)
if err != nil {
return nil, errors.Wrap(err, "opening file")
}
stat, err := file.Stat()
if err != nil {
return nil, errors.Wrap(err, "file.Stat()")
}
if stat.IsDir() {
return nil, errors.New("directory index not allowed")
}
return file, nil
}

60
go.mod
View File

@ -3,10 +3,58 @@ module gitea.hashru.nl/dsprenkels/rushlink
go 1.12
require (
github.com/go-bindata/go-bindata v3.1.2+incompatible // indirect
github.com/gorilla/handlers v1.4.2
github.com/gorilla/mux v1.7.3
github.com/pkg/errors v0.8.1
github.com/prometheus/client_golang v1.1.0
go.etcd.io/bbolt v1.3.3
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cockroachdb/apd v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/denisenkom/go-mssqldb v0.11.0 // indirect
github.com/go-gormigrate/gormigrate/v2 v2.0.0
github.com/go-kit/kit v0.10.0 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/gofrs/uuid v4.0.0+incompatible // indirect
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.10.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.1.1 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.8.1 // indirect
github.com/jackc/pgx/v4 v4.13.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.2 // indirect
github.com/joho/godotenv v1.4.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.3 // indirect
github.com/mattn/go-sqlite3 v1.14.8 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.31.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/stretchr/testify v1.7.0 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/sys v0.0.0-20211002104244-808efd93c36d // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gorm.io/driver/mysql v1.1.2 // indirect
gorm.io/driver/postgres v1.1.2
gorm.io/driver/sqlite v1.1.5
gorm.io/driver/sqlserver v1.0.9 // indirect
gorm.io/gorm v1.21.15
)

872
go.sum
View File

@ -1,76 +1,916 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg=
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/denisenkom/go-mssqldb v0.10.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/denisenkom/go-mssqldb v0.11.0 h1:9rHa233rhdOyrz2GcP9NM+gi2psgJZ4GWDpL/7ND8HI=
github.com/denisenkom/go-mssqldb v0.11.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gormigrate/gormigrate/v2 v2.0.0 h1:e2A3Uznk4viUC4UuemuVgsNnvYZyOA8B3awlYk3UioU=
github.com/go-gormigrate/gormigrate/v2 v2.0.0/go.mod h1:YuVJ+D/dNt4HWrThTBnjgZuRbt7AuwINeg4q52ZE3Jw=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg=
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA=
github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE=
github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s=
github.com/jackc/pgconn v1.4.0/go.mod h1:Y2O3ZDF0q4mMacyWV3AstPJpeHXWGEetiFttmq5lahk=
github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI=
github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI=
github.com/jackc/pgconn v1.6.4/go.mod h1:w2pne1C2tZgP+TvjqLpOigGzNqjBgQW9dUw/4Chex78=
github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o=
github.com/jackc/pgconn v1.8.1 h1:ySBX7Q87vOMqKU2bbmKbUvtYhauDFclYbNDYIE1/h6s=
github.com/jackc/pgconn v1.8.1/go.mod h1:JV6m6b6jhjdmzchES0drzCcYcAHS1OPD5xu3OZ/lE2g=
github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY=
github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI=
github.com/jackc/pgconn v1.10.0 h1:4EYhlDVEMsJ30nNj0mmgwIUXoq7e9sMJrVC2ED6QlCU=
github.com/jackc/pgconn v1.10.0/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI=
github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE=
github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA=
github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE=
github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c=
github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc=
github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A=
github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78=
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA=
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg=
github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
github.com/jackc/pgproto3/v2 v2.0.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
github.com/jackc/pgproto3/v2 v2.0.6 h1:b1105ZGEMFe7aCvrT1Cca3VoVb4ZFMaFJLJcg/3zD+8=
github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
github.com/jackc/pgproto3/v2 v2.1.1 h1:7PQ/4gLoqnl87ZxL7xjO0DR5gYuviDCZxQJsUlFW1eI=
github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg=
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg=
github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc=
github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw=
github.com/jackc/pgtype v1.2.0/go.mod h1:5m2OfMh1wTK7x+Fk952IDmI4nw3nPrvtQdM0ZT4WpC0=
github.com/jackc/pgtype v1.3.1-0.20200510190516-8cd94a14c75a/go.mod h1:vaogEUkALtxZMCH411K+tKzNpwzCKU+AnPzBKZ+I+Po=
github.com/jackc/pgtype v1.3.1-0.20200606141011-f6355165a91c/go.mod h1:cvk9Bgu/VzJ9/lxTO5R5sf80p0DiucVtN7ZxvaC4GmQ=
github.com/jackc/pgtype v1.4.2/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig=
github.com/jackc/pgtype v1.7.0 h1:6f4kVsW01QftE38ufBYxKciO6gyioXSC0ABIRLcZrGs=
github.com/jackc/pgtype v1.7.0/go.mod h1:ZnHF+rMePVqDKaOfJVI4Q8IVvAQMryDlDkZnKOI75BE=
github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM=
github.com/jackc/pgtype v1.8.1 h1:9k0IXtdJXHJbyAWQgbWr1lU+MEhPXZz6RIXxfR5oxXs=
github.com/jackc/pgtype v1.8.1/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4=
github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y=
github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM=
github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc=
github.com/jackc/pgx/v4 v4.5.0/go.mod h1:EpAKPLdnTorwmPUUsqrPxy5fphV18j9q3wrfRXgo+kA=
github.com/jackc/pgx/v4 v4.6.1-0.20200510190926-94ba730bb1e9/go.mod h1:t3/cdRQl6fOLDxqtlyhe9UWgfIi9R8+8v8GKV5TRA/o=
github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg=
github.com/jackc/pgx/v4 v4.8.1/go.mod h1:4HOLxrl8wToZJReD04/yB20GDwf4KBYETvlHciCnwW0=
github.com/jackc/pgx/v4 v4.11.0 h1:J86tSWd3Y7nKjwT/43xZBvpi04keQWx8gNC2YkdJhZI=
github.com/jackc/pgx/v4 v4.11.0/go.mod h1:i62xJgdrtVDsnL3U8ekyrQXEwGNTRoG7/8r+CIdYfcc=
github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs=
github.com/jackc/pgx/v4 v4.13.0 h1:JCjhT5vmhMAf/YwBHLvrBn4OGdIQBiFG6ym8Zmdx570=
github.com/jackc/pgx/v4 v4.13.0/go.mod h1:9P4X524sErlaxj0XSGZk7s+LD0eOyu1ZDUrrpznYDF0=
github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jinzhu/now v1.1.2 h1:eVKgfIdy9b6zbWBMgFpfDPoAMifwSZagU9HmEU6zgiI=
github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU=
github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg=
github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
github.com/mattn/go-sqlite3 v1.14.5 h1:1IdxlwTNazvbKJQSxoJ5/9ECbEeaTTyeU7sEAZ5KKTQ=
github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxzIU=
github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=
github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA=
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.1.0 h1:BQ53HtBmfOitExawJ6LokA4x8ov/z0SYYb0+HxJfRI8=
github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.10.0 h1:/o0BDeWzLWXNZ+4q5gXltUvaMpJqckTa+jTNoB+z4cg=
github.com/prometheus/client_golang v1.10.0/go.mod h1:WJM3cc3yu7XKBKa/I8WeZm+V3eltZnBwfENSU7mdogU=
github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ=
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.6.0 h1:kRhiuYSXR3+uv2IbVbZhUxK5zVD/2pp3Gd2PpvPkpEo=
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.18.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
github.com/prometheus/common v0.23.0 h1:GXWvPYuTUenIa+BhOq/x+L/QZzCqASkVRny5KTlPDGM=
github.com/prometheus/common v0.23.0/go.mod h1:H6QK/N6XVT42whUeIdI3dp36w49c+/iMDk7UAI2qm7Q=
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
github.com/prometheus/common v0.31.1 h1:d18hG4PkHnNAKNMOmFuXFaiY8Us0nird/2m60uS1AMs=
github.com/prometheus/common v0.31.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE=
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4=
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY=
github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0=
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210507161434-a76c4d0a0096 h1:5PbJGn5Sp3GEUjJ61aYbUP6RIo3Z3r2E4Tv9y2z8UHo=
golang.org/x/sys v0.0.0-20210507161434-a76c4d0a0096/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211002104244-808efd93c36d h1:SABT8Vei3iTiu+Gy8KOzpSNz+W1EQ5YBCRtiEETxF+0=
golang.org/x/sys v0.0.0-20211002104244-808efd93c36d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s=
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/mysql v1.0.1 h1:omJoilUzyrAp0xNoio88lGJCroGdIOen9hq2A/+3ifw=
gorm.io/driver/mysql v1.0.1/go.mod h1:KtqSthtg55lFp3S5kUXqlGaelnWpKitn4k1xZTnoiPw=
gorm.io/driver/mysql v1.1.2 h1:OofcyE2lga734MxwcCW9uB4mWNXMr50uaGRVwQL2B0M=
gorm.io/driver/mysql v1.1.2/go.mod h1:4P/X9vSc3WTrhTLZ259cpFd6xKNYiSSdSZngkSBGIMM=
gorm.io/driver/postgres v1.0.0/go.mod h1:wtMFcOzmuA5QigNsgEIb7O5lhvH1tHAF1RbWmLWV4to=
gorm.io/driver/postgres v1.1.0 h1:afBljg7PtJ5lA6YUWluV2+xovIPhS+YiInuL3kUjrbk=
gorm.io/driver/postgres v1.1.0/go.mod h1:hXQIwafeRjJvUm+OMxcFWyswJ/vevcpPLlGocwAwuqw=
gorm.io/driver/postgres v1.1.2 h1:Amy3hCvLqM+/ICzjCnQr8wKFLVJTeOTdlMT7kCP+J1Q=
gorm.io/driver/postgres v1.1.2/go.mod h1:/AGV0zvqF3mt9ZtzLzQmXWQ/5vr+1V1TyHZGZVjzmwI=
gorm.io/driver/sqlite v1.1.1/go.mod h1:hm2olEcl8Tmsc6eZyxYSeznnsDaMqamBvEXLNtBg4cI=
gorm.io/driver/sqlite v1.1.4 h1:PDzwYE+sI6De2+mxAneV9Xs11+ZyKV6oxD3wDGkaNvM=
gorm.io/driver/sqlite v1.1.4/go.mod h1:mJCeTFr7+crvS+TRnWc5Z3UvwxUN1BGBLMrf5LA9DYw=
gorm.io/driver/sqlite v1.1.5 h1:JU8G59VyKu1x1RMQgjefQnkZjDe9wHc1kARDZPu5dZs=
gorm.io/driver/sqlite v1.1.5/go.mod h1:NpaYMcVKEh6vLJ47VP6T7Weieu4H1Drs3dGD/K6GrGc=
gorm.io/driver/sqlserver v1.0.2 h1:FzxAlw0/7hntMzSiNfotpYCo9Lz8dqWQGdmCGqIiFGo=
gorm.io/driver/sqlserver v1.0.2/go.mod h1:gb0Y9QePGgqjzrVyTQUZeh9zkd5v0iz71cM1B4ZycEY=
gorm.io/driver/sqlserver v1.0.9 h1:P7Dm/BKqsrOjyhRSnLXvG2g1W/eJUgxdrdBwgJw3tEg=
gorm.io/driver/sqlserver v1.0.9/go.mod h1:iBdxY2CepkTt9Q1r84RbZA1qCai300Qlp8kQf9qE9II=
gorm.io/gorm v1.9.19/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
gorm.io/gorm v1.20.0/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
gorm.io/gorm v1.20.7/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
gorm.io/gorm v1.21.9 h1:INieZtn4P2Pw6xPJ8MzT0G4WUOsHq3RhfuDF1M6GW0E=
gorm.io/gorm v1.21.9/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0=
gorm.io/gorm v1.21.12/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0=
gorm.io/gorm v1.21.14/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0=
gorm.io/gorm v1.21.15 h1:gAyaDoPw0lCyrSFWhBlahbUA1U4P5RViC1uIqoB+1Rk=
gorm.io/gorm v1.21.15/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=

418
handlers.go Normal file
View File

@ -0,0 +1,418 @@
package rushlink
import (
"crypto/subtle"
"fmt"
"log"
"mime/multipart"
"net/http"
"net/url"
"os"
"strings"
"time"
"gitea.hashru.nl/dsprenkels/rushlink/internal/db"
"github.com/google/uuid"
"github.com/gorilla/mux"
"github.com/pkg/errors"
)
const (
// formParseMaxMemory value is based on the default value that is used in
// Request.ParseMultipartForm.
formParseMaxMemory = 32 << 20 // 32 MB
// highOnlineEntropy is the desired entropy of an "unguessable" paste URL
// (in bits). It should be chosen such that it should be hard for an
// attacker to find *any* key that should not be found.
// It is desired that the probability to guess a good key is small.
//
// [ amount of pastes ]
// Pr[ good key ] = ---------------------------
// [ amount of possible keys ]
//
// So with a conservative [ amount of pastes ] = 2^32 (= 4 billion), and
// an [ amount of possible keys ] = 2^80 then the probability of a correct
// guess is 2^-48.
highOnlineEntropy = 80
)
type viewPaste uint
const (
_ viewPaste = 1 << iota
viewNoRedirect
viewShowMeta
)
type canDelete uint
const (
canDeleteUndef canDelete = iota
canDeleteYes
canDeleteNo
)
func (cd *canDelete) Bool() bool {
return *cd == canDeleteYes
}
func (cd *canDelete) String() string {
switch *cd {
case canDeleteUndef:
return "undefined"
case canDeleteYes:
return "correct"
case canDeleteNo:
return "invalid"
default:
panic("unreachable")
}
}
func (rl *rushlink) staticGetHandler(w http.ResponseWriter, r *http.Request) {
rl.renderStatic(w, r, mux.Vars(r)["path"])
}
func (rl *rushlink) indexGetHandler(w http.ResponseWriter, r *http.Request) {
rl.render(w, r, http.StatusOK, "index", map[string]interface{}{})
}
func (rl *rushlink) viewPasteHandler(w http.ResponseWriter, r *http.Request) {
rl.viewPasteHandlerFlags(w, r, 0)
}
func (rl *rushlink) viewPasteHandlerNoRedirect(w http.ResponseWriter, r *http.Request) {
rl.viewPasteHandlerFlags(w, r, viewNoRedirect)
}
func (rl *rushlink) viewPasteHandlerMeta(w http.ResponseWriter, r *http.Request) {
rl.viewPasteHandlerFlags(w, r, viewShowMeta)
}
func (rl *rushlink) viewPasteHandlerFlags(w http.ResponseWriter, r *http.Request, flags viewPaste) {
vars := mux.Vars(r)
key := vars["key"]
var p *db.Paste
var fu *db.FileUpload
var notFound bool
err := rl.db.Transaction(func(tx *db.Database) error {
var err error
p, err = db.GetPaste(tx, key)
if err != nil {
return err
}
if p != nil && p.Type == db.PasteTypeFileUpload {
var id uuid.UUID
copy(id[:], p.Content)
fu, err = db.GetFileUpload(tx, id)
if err != nil {
return err
}
}
return nil
})
if notFound {
err = db.ErrPasteDoesNotExist
}
if err != nil {
status := db.ErrHTTPStatusCode(err)
if status == http.StatusInternalServerError {
panic(err)
}
rl.renderError(w, r, status, err.Error())
return
}
rl.viewPasteHandlerInner(w, r, flags, p, fu)
}
func (rl *rushlink) viewPasteHandlerInner(w http.ResponseWriter, r *http.Request, flags viewPaste, p *db.Paste, fu *db.FileUpload) {
if flags&viewShowMeta != 0 {
rl.viewPasteHandlerInnerMeta(w, r, p, fu)
return
}
switch p.State {
case db.PasteStatePresent:
switch p.Type {
case db.PasteTypeFileUpload:
if fu == nil {
panic(fmt.Sprintf("file for id %v does not exist in database\n", string(p.Content)))
}
rl.viewFileUploadHandler(w, r, fu)
return
case db.PasteTypeRedirect:
if flags&viewNoRedirect != 0 {
w.Write([]byte(p.RedirectURL().String()))
return
}
http.Redirect(w, r, p.RedirectURL().String(), http.StatusTemporaryRedirect)
return
default:
panic("paste type unsupported")
}
case db.PasteStateDeleted:
rl.renderError(w, r, http.StatusGone, "paste has been deleted\n")
return
default:
panic(errors.Errorf("invalid paste.State (%v) for key '%v'", p.State, p.Key))
}
}
func (rl *rushlink) viewFileUploadHandler(w http.ResponseWriter, r *http.Request, fu *db.FileUpload) {
filePath := fu.Path(rl.fs)
file, err := os.Open(filePath)
if err != nil {
if os.IsNotExist(err) {
log.Printf("error: '%v' should exist according to the database, but it doesn't", filePath)
rl.renderError(w, r, http.StatusNotFound, "file not found")
return
}
// unexpected error
panic(err)
}
var modtime time.Time
info, err := file.Stat()
if err != nil {
log.Printf("error: %v", errors.Wrapf(err, "could not stat file '%v'", filePath))
} else {
modtime = info.ModTime()
}
// Provide the real filename to the client (to be used in Ctrl+S etc.)
quotedName := strings.ReplaceAll(fu.FileName, "\"", "\\\"")
w.Header().Set("Content-Disposition", fmt.Sprintf("inline; filename=\"%s\"", quotedName))
// We use http.ServeContent (instead of http.ServeFile) because we cannot
// use http.ServeFile together with the assertion that the file exists,
// without introducing a TOCTOU flaw.
http.ServeContent(w, r, fu.FileName, modtime, file)
}
func (rl *rushlink) viewPasteHandlerInnerMeta(w http.ResponseWriter, r *http.Request, p *db.Paste, fu *db.FileUpload) {
var cd canDelete
deleteToken := getDeleteTokenFromRequest(r)
if deleteToken != "" {
if subtle.ConstantTimeCompare([]byte(deleteToken), []byte(p.DeleteToken)) == 1 {
cd = canDeleteYes
} else {
cd = canDeleteNo
}
}
var fileExt string
if fu != nil {
fileExt = fu.Ext()
}
data := map[string]interface{}{
"Paste": p,
"FileExt": fileExt,
"CanDeleteString": cd.String(),
"CanDeleteBool": cd.Bool(),
}
var status int
if p.State == db.PasteStateDeleted {
status = http.StatusGone
} else {
status = http.StatusOK
}
rl.render(w, r, status, "pasteMeta", data)
}
func (rl *rushlink) viewActionSuccess(w http.ResponseWriter, r *http.Request, p *db.Paste, fu *db.FileUpload) {
var fileExt string
if fu != nil {
fileExt = fu.Ext()
}
// Redirect to the new paste.
pasteURL := url.URL{
Path: fmt.Sprintf("/%s%s/meta", p.Key, fileExt),
RawQuery: fmt.Sprintf("deleteToken=%s", url.QueryEscape(p.DeleteToken)),
}
http.Redirect(w, r, pasteURL.String(), http.StatusFound)
// But still render the page for CURL-like clients.
cd := canDeleteYes
data := map[string]interface{}{
"Paste": p,
"FileExt": fileExt,
"CanDeleteString": cd.String(),
"CanDeleteBool": cd.Bool(),
}
rl.render(w, r, 0, "pasteMeta", data)
}
func (rl *rushlink) newPasteHandler(w http.ResponseWriter, r *http.Request) {
if err := r.ParseMultipartForm(formParseMaxMemory); err != nil {
msg := fmt.Sprintf("could not parse form: %v\n", err)
rl.renderError(w, r, http.StatusBadRequest, msg)
return
}
fileHeaders, fileHeadersPrs := r.MultipartForm.File["file"]
shortens, shortensPrs := r.MultipartForm.Value["shorten"]
if !shortensPrs && !fileHeadersPrs {
rl.renderError(w, r, http.StatusBadRequest, "no 'file' and no 'shorten' fields given in form\n")
return
}
if shortensPrs && fileHeadersPrs {
rl.renderError(w, r, http.StatusBadRequest, "both 'file' and 'shorten' fields provided in form\n")
return
}
if shortensPrs {
rl.newRedirectPasteHandler(w, r, shortens[0])
return
}
if fileHeadersPrs {
fileHeader := fileHeaders[0]
file, err := fileHeader.Open()
if err != nil {
rl.renderInternalServerError(w, r, err)
return
}
rl.newFileUploadPasteHandler(w, r, file, *fileHeader)
return
}
}
func (rl *rushlink) newFileUploadPasteHandler(w http.ResponseWriter, r *http.Request, file multipart.File, header multipart.FileHeader) {
var fu *db.FileUpload
var paste *db.Paste
if err := rl.db.Transaction(func(tx *db.Database) error {
var err error
fu, err = db.NewFileUpload(rl.fs, file, header.Filename)
if err != nil {
panic(errors.Wrap(err, "creating fileUpload"))
}
if err := fu.Save(tx); err != nil {
panic(errors.Wrap(err, "saving fileUpload in db"))
}
paste, err = shortenFileUploadID(tx, fu.PubID)
return err
}); err != nil {
panic(err)
}
rl.viewActionSuccess(w, r, paste, fu)
}
func (rl *rushlink) newRedirectPasteHandler(w http.ResponseWriter, r *http.Request, rawurl string) {
userURL, err := url.Parse(rawurl)
if err != nil {
msg := fmt.Sprintf("invalid url (%v): %v", err, rawurl)
rl.renderError(w, r, http.StatusBadRequest, msg)
return
}
if userURL.Scheme == "" {
rl.renderError(w, r, http.StatusBadRequest, "invalid url (unspecified scheme)\n")
return
}
if userURL.Host == "" {
rl.renderError(w, r, http.StatusBadRequest, "invalid url (unspecified host)\n")
return
}
var paste *db.Paste
if err := rl.db.Transaction(func(tx *db.Database) error {
var err error
paste, err = shortenURL(tx, userURL)
return err
}); err != nil {
panic(err)
}
rl.viewActionSuccess(w, r, paste, nil)
}
// Delete a URL from the database
func (rl *rushlink) deletePasteHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
key := vars["key"]
deleteToken := getDeleteTokenFromRequest(r)
if deleteToken == "" {
rl.renderError(w, r, http.StatusBadRequest, "no delete token provided\n")
return
}
var errorCode int
var paste *db.Paste
if err := rl.db.Transaction(func(tx *db.Database) error {
var err error
paste, err = db.GetPaste(tx, key)
if err != nil {
errorCode = http.StatusNotFound
return err
}
if paste.State == db.PasteStateDeleted {
errorCode = http.StatusGone
return errors.New("already deleted")
}
if subtle.ConstantTimeCompare([]byte(deleteToken), []byte(paste.DeleteToken)) == 0 {
errorCode = http.StatusForbidden
return errors.New("invalid delete token")
}
if err := paste.Delete(tx, rl.fs); err != nil {
errorCode = http.StatusInternalServerError
return err
}
return nil
}); err != nil {
log.Printf("error: %v\n", err)
rl.renderError(w, r, errorCode, fmt.Sprintf("error: %v\n", err))
return
}
rl.viewActionSuccess(w, r, paste, nil)
}
// Add a new fileUpload redirect to the database
//
// Returns the new paste key if the fileUpload was successfully added to the
// database
func shortenFileUploadID(tx *db.Database, id uuid.UUID) (*db.Paste, error) {
return shorten(tx, db.PasteTypeFileUpload, id[:])
}
// Add a new URL to the database
//
// Returns the new paste key if the url was successfully shortened
func shortenURL(tx *db.Database, userURL *url.URL) (*db.Paste, error) {
return shorten(tx, db.PasteTypeRedirect, []byte(userURL.String()))
}
// Add a paste (of any kind) to the database with arbitrary content.
func shorten(tx *db.Database, ty db.PasteType, content []byte) (*db.Paste, error) {
// Generate the paste key
var keyEntropy int
if ty == db.PasteTypeFileUpload || ty == db.PasteTypePaste {
keyEntropy = highOnlineEntropy
}
pasteKey, err := db.GeneratePasteKey(tx, keyEntropy)
if err != nil {
return nil, errors.Wrap(err, "generating paste key")
}
// Also generate a deleteToken
deleteToken, err := db.GenerateDeleteToken()
if err != nil {
return nil, errors.Wrap(err, "generating delete token")
}
// Store the new key
p := db.Paste{
Type: ty,
State: db.PasteStatePresent,
Content: content,
Key: pasteKey,
DeleteToken: deleteToken,
}
if err := p.Save(tx); err != nil {
return nil, err
}
return &p, nil
}
func getDeleteTokenFromRequest(r *http.Request) string {
return r.URL.Query().Get("deleteToken")
}

View File

@ -1,253 +0,0 @@
package handlers
import (
"crypto/subtle"
"encoding/base64"
"fmt"
"log"
"net/http"
"net/url"
"time"
"github.com/gorilla/mux"
"github.com/pkg/errors"
bolt "go.etcd.io/bbolt"
"gitea.hashru.nl/dsprenkels/rushlink/db"
)
type viewPaste uint
const (
_ viewPaste = 1 << iota
viewNoRedirect
viewShowMeta
)
const CookieDeleteToken = "owner_token"
// These keys are designated reserved, and will not be randomly chosen
var ReservedPasteKeys = []string{"xd42", "example"}
// Base64 encoding and decoding
var base64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
var base64Encoder = base64.RawURLEncoding.WithPadding(base64.NoPadding)
func (t pasteType) String() string {
switch t {
case typeUndef:
return "unknown"
case typePaste:
return "paste"
case typeRedirect:
return "redirect"
default:
return "invalid"
}
}
func (t pasteState) String() string {
switch t {
case stateUndef:
return "unknown"
case statePresent:
return "present"
case stateDeleted:
return "deleted"
default:
return "invalid"
}
}
func indexGetHandler(w http.ResponseWriter, r *http.Request) {
render(w, r, "index", map[string]interface{}{})
}
func viewPasteHandler(w http.ResponseWriter, r *http.Request) {
viewPasteHandlerInner(w, r, 0)
}
func viewPasteHandlerNoRedirect(w http.ResponseWriter, r *http.Request) {
viewPasteHandlerInner(w, r, viewNoRedirect)
}
func viewPasteHandlerMeta(w http.ResponseWriter, r *http.Request) {
viewPasteHandlerInner(w, r, viewShowMeta)
}
func viewPasteHandlerInner(w http.ResponseWriter, r *http.Request, flags viewPaste) {
vars := mux.Vars(r)
key := vars["key"]
var p *paste
if err := db.DB.View(func(tx *bolt.Tx) error {
var err error
p, err = getPaste(tx, key)
return err
}); err != nil {
panic(err)
return
}
if p == nil {
renderError(w, r, http.StatusNotFound, "url key not found in the database")
return
}
if flags&viewShowMeta != 0 {
canDelete := struct {
Bool bool
String string
}{Bool: false}
deleteToken := getDeleteTokenFromRequest(r)
if deleteToken == "" {
canDelete.String = "undefined"
} else {
if subtle.ConstantTimeCompare([]byte(deleteToken), []byte(p.DeleteToken)) == 1 {
canDelete.Bool = true
canDelete.String = "correct"
} else {
canDelete.String = "invalid"
}
}
data := map[string]interface{}{
"Paste": p,
"CanDelete": canDelete,
}
render(w, r, "pasteMeta", data)
return
}
switch p.State {
case statePresent:
if flags&viewNoRedirect == 0 {
rawurl := string(p.Content)
urlParse, err := url.Parse(rawurl)
if err != nil {
panic(errors.Wrapf(err, "invalid URL ('%v') in database for key '%v'", rawurl, p.Key))
}
http.Redirect(w, r, urlParse.String(), http.StatusSeeOther)
}
w.Write(p.Content)
case stateDeleted:
renderError(w, r, http.StatusGone, "paste has been deleted")
default:
panic(errors.Errorf("invalid paste.State (%v) for key '%v'", p.State, p.Key))
}
}
func newPasteHandler(w http.ResponseWriter, r *http.Request) {
if err := r.ParseMultipartForm(50 * 1000 * 1000); err != nil {
panic(err)
}
// Determine what kind of post this is, currently only `shorten=...`
if len(r.PostForm) == 0 {
renderError(w, r, http.StatusBadRequest, "empty body in POST request\n")
return
}
shorten_values, prs := r.PostForm["shorten"]
if !prs {
renderError(w, r, http.StatusBadRequest, "no 'shorten' param given\n")
return
}
if len(shorten_values) != 1 {
renderError(w, r, http.StatusBadRequest, "only one 'shorten' param is allowed per request\n")
return
}
newRedirectPasteHandler(w, r)
}
func newRedirectPasteHandler(w http.ResponseWriter, r *http.Request) {
rawurl := r.PostForm.Get("shorten")
userURL, err := url.ParseRequestURI(rawurl)
if err != nil {
msg := fmt.Sprintf("invalid url (%v): %v", err, rawurl)
renderError(w, r, http.StatusBadRequest, msg)
return
}
if userURL.Scheme == "" {
renderError(w, r, http.StatusBadRequest, "invalid url (unspecified scheme)")
return
}
if userURL.Host == "" {
renderError(w, r, http.StatusBadRequest, "invalid url (unspecified host)")
return
}
var paste *paste
if err := db.DB.Update(func(tx *bolt.Tx) error {
// Generate a new delete token for this paste
var err error
paste, err = shortenURL(tx, userURL)
return err
}); err != nil {
panic(err)
}
data := map[string]interface{}{"Paste": paste}
render(w, r, "newRedirectPasteSuccess", data)
}
// Delete a URL from the database
func deletePasteHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
key := vars["key"]
deleteToken := getDeleteTokenFromRequest(r)
if deleteToken == "" {
renderError(w, r, http.StatusBadRequest, "no delete token provided")
return
}
var errorCode int
if err := db.DB.Update(func(tx *bolt.Tx) error {
p, err := getPaste(tx, key)
if err != nil {
errorCode = http.StatusNotFound
return err
}
if subtle.ConstantTimeCompare([]byte(deleteToken), []byte(p.DeleteToken)) == 1 {
p.delete(tx)
}
errorCode = http.StatusForbidden
return errors.New("invalid delete token")
}); err != nil {
log.Printf("error: %v\n", err)
renderError(w, r, errorCode, fmt.Sprintf("error: %v", err))
return
}
}
// Add a new URL to the database
//
// Returns the new ID if the url was successfully shortened
func shortenURL(tx *bolt.Tx, userURL *url.URL) (*paste, error) {
pasteKey, err := generatePasteKey(tx)
if err != nil {
return nil, errors.Wrap(err, "generating paste key")
}
// Also generate a deleteToken
deleteToken, err := generateDeleteToken()
if err != nil {
return nil, errors.Wrap(err, "generating delete token")
}
// Store the new key
p := paste{
Type: typeRedirect,
State: statePresent,
Content: []byte(userURL.String()),
Key: pasteKey,
DeleteToken: deleteToken,
TimeCreated: time.Now().UTC(),
}
if err := p.save(tx); err != nil {
return nil, err
}
return &p, nil
}
func getDeleteTokenFromRequest(r *http.Request) string {
return r.URL.Query().Get("deleteToken")
}

View File

@ -1,159 +0,0 @@
package handlers
import (
"crypto/rand"
"encoding/hex"
"strings"
"time"
"gitea.hashru.nl/dsprenkels/rushlink/db"
"gitea.hashru.nl/dsprenkels/rushlink/gobmarsh"
"github.com/pkg/errors"
bolt "go.etcd.io/bbolt"
)
type pasteType int
type pasteState int
type paste struct {
Type pasteType
State pasteState
Content []byte
Key string
DeleteToken string
TimeCreated time.Time
}
const (
typeUndef pasteType = 0
typePaste = 1
typeRedirect = 2
)
const (
stateUndef pasteState = 0
statePresent = 1
stateDeleted = 2
)
// Retrieve a paste from the database
func getPaste(tx *bolt.Tx, key string) (*paste, error) {
pastesBucket := tx.Bucket([]byte(db.BUCKET_PASTES))
if pastesBucket == nil {
return nil, errors.Errorf("bucket %v does not exist", db.BUCKET_PASTES)
}
storedBytes := pastesBucket.Get([]byte(key))
if storedBytes == nil {
return nil, nil
}
p := &paste{}
err := gobmarsh.Unmarshal(storedBytes, p)
return p, err
}
func (p *paste) save(tx *bolt.Tx) error {
bucket := tx.Bucket([]byte(db.BUCKET_PASTES))
if bucket == nil {
return errors.Errorf("bucket %v does not exist", db.BUCKET_PASTES)
}
buf, err := gobmarsh.Marshal(p)
if err != nil {
return errors.Wrap(err, "encoding for database failed")
}
if err := bucket.Put([]byte(p.Key), buf); err != nil {
return errors.Wrap(err, "database transaction failed")
}
return nil
}
func (p paste) delete(tx *bolt.Tx) error {
// Replace the old paste with a new empty paste
return (&paste{
Key: p.Key,
State: stateDeleted,
DeleteToken: p.DeleteToken,
}).save(tx)
}
// Generate a key until it is not in the database, this occurs in O(log N),
// where N is the amount of keys stored in the url-shorten database.
func generatePasteKey(tx *bolt.Tx) (string, error) {
pastesBucket := tx.Bucket([]byte(db.BUCKET_PASTES))
if pastesBucket == nil {
return "", errors.Errorf("bucket %v does not exist", db.BUCKET_PASTES)
}
epoch := 0
var key string
for {
var err error
key, err = generatePasteKeyInner(epoch)
if err != nil {
return "", errors.Wrap(err, "url-key generation failed")
}
found := pastesBucket.Get([]byte(key))
if found == nil {
break
}
isReserved := false
for _, reservedKey := range ReservedPasteKeys {
if strings.HasPrefix(key, reservedKey) {
isReserved = true
break
}
}
if !isReserved {
break
}
epoch++
}
return key, nil
}
func generatePasteKeyInner(epoch int) (string, error) {
urlKey := make([]byte, 4+epoch)
_, err := rand.Read(urlKey)
if err != nil {
return "", err
}
// Put all the values in the range 0..64 for easier base64-encoding
for i := 0; i < len(urlKey); i++ {
urlKey[i] &= 0x3F
}
// Implement truncate-resistance by forcing the prefix to
// 0b111110xxxxxxxxxx
// ^----- {epoch} ones followed by a single 0
//
// Example when epoch is 1: prefix is 0b10.
i := 0
for i < epoch {
// Set this bit to 1
limb := i / 6
bit := i % 6
urlKey[limb] |= 1 << uint(5-bit)
i++
}
// Finally set the next bit to 0
limb := i / 6
bit := i % 6
urlKey[limb] &= ^(1 << uint(5-bit))
// Convert this ID to a canonical base64 notation
for i := range urlKey {
urlKey[i] = base64Alphabet[urlKey[i]]
}
return string(urlKey), nil
}
func generateDeleteToken() (string, error) {
var deleteToken [16]byte
_, err := rand.Read(deleteToken[:])
if err != nil {
return "", err
}
return hex.EncodeToString(deleteToken[:]), nil
}

View File

@ -1,50 +0,0 @@
package handlers
import (
"fmt"
"log"
"net/http"
"time"
"github.com/gorilla/mux"
)
func recoveryMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
defer func() {
defer func() {
if err := recover(); err != nil {
log.Printf("error: panic while recovering from another panic: %v\n", err)
fmt.Fprintf(w, "internal server error: %v\n", err)
}
}()
if err := recover(); err != nil {
log.Printf("error: %v\n", err)
renderInternalServerError(w, r, err)
}
}()
next.ServeHTTP(w, r)
})
}
func StartMainServer() {
// Initialize Gorilla router
router := mux.NewRouter()
router.Use(recoveryMiddleware)
router.HandleFunc("/", indexGetHandler).Methods("GET")
router.HandleFunc("/", newPasteHandler).Methods("POST")
router.HandleFunc("/{key:[A-Za-z0-9-_]{4,}}", viewPasteHandler).Methods("GET")
router.HandleFunc("/{key:[A-Za-z0-9-_]{4,}}/nr", viewPasteHandlerNoRedirect).Methods("GET")
router.HandleFunc("/{key:[A-Za-z0-9-_]{4,}}/meta", viewPasteHandlerMeta).Methods("GET")
router.HandleFunc("/{key:[A-Za-z0-9-_]{4,}}", deletePasteHandler).Methods("DELETE")
router.HandleFunc("/{key:[A-Za-z0-9-_]{4,}}/delete", deletePasteHandler).Methods("POST")
srv := &http.Server{
Handler: router,
Addr: "127.0.0.1:8000",
WriteTimeout: 15 * time.Second,
ReadTimeout: 15 * time.Second,
}
log.Fatal(srv.ListenAndServe())
}

222
handlers_test.go Normal file
View File

@ -0,0 +1,222 @@
package rushlink
import (
"bytes"
"fmt"
"io/ioutil"
"mime/multipart"
"net/http"
"net/http/httptest"
"net/url"
"os"
"path/filepath"
"strings"
"testing"
"gitea.hashru.nl/dsprenkels/rushlink/internal/db"
"github.com/gorilla/mux"
)
// createTemporaryRouter initializes a rushlink instance, with temporary
// filestore and database.
//
// It will use testing.T.Cleanup to cleanup after itself.
func createTemporaryRouter(t *testing.T) (*mux.Router, *rushlink) {
tempDir, err := ioutil.TempDir("", "rushlink-tmp-*")
if err != nil {
t.Fatalf("creating temporary directory: %s\n", err)
}
t.Cleanup(func() {
os.RemoveAll(tempDir)
})
fileStore, err := db.OpenFileStore(filepath.Join(tempDir, "filestore"))
if err != nil {
t.Fatalf("opening temporary filestore: %s\n", err)
}
os.Setenv(db.EnvDatabaseDriver, "sqlite")
os.Setenv(db.EnvDatabasePath, "file::memory:?cache=shared")
database, err := db.OpenDBFromEnvironment()
if err != nil {
t.Fatalf("opening temporary database: %v\n", err)
}
database.Debug()
if err := db.Gormigrate(database).Migrate(); err != nil {
t.Fatalf("migration failed: %v\n", err)
}
// *.invalid. is guaranteed not to exist (RFC 6761).
rootURL, err := url.Parse("https://rushlink.invalid")
if err != nil {
t.Fatalf("parsing URL: %s\n", err)
}
rl := rushlink{
db: database,
fs: fileStore,
rootURL: rootURL,
}
r := mux.NewRouter()
InitMainRouter(r, &rl)
return r, &rl
}
// checkStatusCode checks whether the status code from a recorded response is equal
// to some response code.
func checkStatusCode(t *testing.T, rr *httptest.ResponseRecorder, code int) {
if actual := rr.Code; actual != code {
t.Logf("request body:\n%v\n", rr.Body.String())
t.Fatalf("handler returned wrong status code: got %v want %v\n",
actual, code)
}
}
// checkLocationHeader checks whether the status code from a recorded response is equal
// to some expected URL.
func checkLocationHeader(t *testing.T, rr *httptest.ResponseRecorder, expected string) {
location := rr.Header().Get("Location")
if location != expected {
t.Fatalf("handler returned bad redirect location: got %v want %v", location, expected)
}
}
func TestIssue43(t *testing.T) {
srv, _ := createTemporaryRouter(t)
// Put a URL with a fragment identifier into the database.
var body bytes.Buffer
form := multipart.NewWriter(&body)
form.WriteField("shorten", "https://example.com#fragment")
form.Close()
req, err := http.NewRequest("POST", "/", bytes.NewReader(body.Bytes()))
if err != nil {
t.Fatal(err)
}
req.Header.Add("Content-Type", form.FormDataContentType())
rr := httptest.NewRecorder()
srv.ServeHTTP(rr, req)
checkStatusCode(t, rr, http.StatusFound)
rawURL := strings.SplitN(rr.Body.String(), "\n", 2)[0]
pasteURL, err := url.Parse(rawURL)
if err != nil {
t.Fatal(err)
}
// Check if the URL was encoded correctly.
req, err = http.NewRequest("GET", pasteURL.Path, nil)
if err != nil {
t.Fatal(err)
}
req = mux.SetURLVars(req, map[string]string{"key": pasteURL.Path[1:]})
rr = httptest.NewRecorder()
srv.ServeHTTP(rr, req)
checkStatusCode(t, rr, http.StatusTemporaryRedirect)
checkLocationHeader(t, rr, "https://example.com#fragment")
}
func TestIssue53(t *testing.T) {
srv, rl := createTemporaryRouter(t)
// Put a URL with a fragment identifier into the database.
var body bytes.Buffer
form := multipart.NewWriter(&body)
if _, err := form.CreateFormFile("file", "../directory-traversal/file.txt"); err != nil {
t.Fatal(err)
}
form.Close()
req, err := http.NewRequest("POST", "/", bytes.NewReader(body.Bytes()))
if err != nil {
t.Fatal(err)
}
req.Header.Add("Content-Type", form.FormDataContentType())
rr := httptest.NewRecorder()
srv.ServeHTTP(rr, req)
checkStatusCode(t, rr, http.StatusFound)
// Check that any attempt to do directory traversal has failed.
rl.db.Transaction(func(tx *db.Database) error {
fus, err := db.AllFileUploads(tx)
if err != nil {
t.Fatal(err)
}
for _, fu := range fus {
if strings.ContainsAny(fu.FileName, "/\\") {
t.Fatalf(fmt.Sprintf("found a slash in file name: %v", fu.FileName))
}
}
return nil
})
}
func TestIssue60(t *testing.T) {
srv, _ := createTemporaryRouter(t)
// Request a nonexistent static file
req, err := http.NewRequest("GET", "/css/nonexistent_file.css", nil)
if err != nil {
t.Fatal(err)
}
rr := httptest.NewRecorder()
srv.ServeHTTP(rr, req)
checkStatusCode(t, rr, http.StatusNotFound)
}
func TestIssue56(t *testing.T) {
srv, _ := createTemporaryRouter(t)
// Make a POST request with both a 'file' *and* a 'shorten' part.
var body bytes.Buffer
form := multipart.NewWriter(&body)
if _, err := form.CreateFormFile("file", "empty.txt"); err != nil {
t.Fatal(err)
}
if _, err := form.CreateFormField("shorten"); err != nil {
t.Fatal(err)
}
form.Close()
req, err := http.NewRequest("POST", "/", bytes.NewReader(body.Bytes()))
if err != nil {
t.Fatal(err)
}
req.Header.Add("Content-Type", form.FormDataContentType())
rr := httptest.NewRecorder()
srv.ServeHTTP(rr, req)
checkStatusCode(t, rr, http.StatusBadRequest)
}
func TestIssue68(t *testing.T) {
srv, _ := createTemporaryRouter(t)
originalURL := "https://example.com"
var body bytes.Buffer
form := multipart.NewWriter(&body)
form.WriteField("shorten", "https://example.com")
form.Close()
req, err := http.NewRequest("POST", "/", bytes.NewReader(body.Bytes()))
if err != nil {
t.Fatal(err)
}
req.Header.Add("Content-Type", form.FormDataContentType())
rr := httptest.NewRecorder()
srv.ServeHTTP(rr, req)
checkStatusCode(t, rr, http.StatusFound)
rawURL := strings.SplitN(rr.Body.String(), "\n", 2)[0]
pasteURL, err := url.Parse(rawURL)
if err != nil {
t.Fatal(err)
}
// Check if the no-redirect handler works properly.
req, err = http.NewRequest("GET", pasteURL.Path+"/nr", nil)
if err != nil {
t.Fatal(err)
}
rr = httptest.NewRecorder()
srv.ServeHTTP(rr, req)
checkStatusCode(t, rr, http.StatusOK)
if rr.Body.String() != originalURL {
t.Errorf("incorrect URL = %v, want %v", rr.Body.String(), originalURL)
}
}

74
internal/db/db.go Normal file
View File

@ -0,0 +1,74 @@
package db
import (
"log"
"os"
"time"
"github.com/pkg/errors"
"gorm.io/driver/postgres"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"gorm.io/gorm/logger"
)
const (
// EnvDatabaseDriver is the key for the 'database driver' environment variable.
EnvDatabaseDriver = "RUSHLINK_DATABASE_DRIVER"
// EnvDatabasePath is the key for the 'database path' environment variable.
EnvDatabasePath = "RUSHLINK_DATABASE_PATH"
// EnvPostgresURL is the key for the 'postgresql URL' environment variable.
EnvPostgresURL = "RUSHLINK_POSTGRES_URL"
// EnvFileStorePath is the key for the environment variable locating the file store.
EnvFileStorePath = "RUSHLINK_FILE_STORE_PATH"
)
// Database is the main rushlink database type.
//
// Open a database using OpenDBFromEnvironment(). Closing is not necessary.
// Only one instance of DB should exist in a program at any moment.
type Database = gorm.DB
var (
gormLogger logger.Interface = logger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), logger.Config{
SlowThreshold: 50 * time.Millisecond,
LogLevel: logger.Warn,
Colorful: true,
})
gormConfig = gorm.Config{Logger: gormLogger, PrepareStmt: true}
)
// OpenDBFromEnvironment tries to open an SQL database, described by
func OpenDBFromEnvironment() (*Database, error) {
const envNotSetMsg = "%v environment variable is not set"
driver, prs := os.LookupEnv(EnvDatabaseDriver)
if !prs {
return nil, errors.Errorf(envNotSetMsg, EnvDatabaseDriver)
}
switch driver {
case "sqlite":
path, prs := os.LookupEnv(EnvDatabasePath)
if !prs {
return nil, errors.Errorf(envNotSetMsg, EnvDatabasePath)
}
db, err := gorm.Open(sqlite.Open(path), &gormConfig)
if err != nil {
return nil, err
}
return db, nil
case "postgres":
dsn, prs := os.LookupEnv(EnvPostgresURL)
if !prs {
return nil, errors.Errorf(envNotSetMsg, EnvPostgresURL)
}
db, err := gorm.Open(postgres.Open(dsn), &gormConfig)
if err != nil {
return nil, err
}
return db, nil
default:
return nil, errors.Errorf("RUSHLINK_DATABASE_DRIVER should be either 'sqlite' or 'postgres' (not '%v'), "+
"for more info see <https://stackoverflow.com/q/3582552/5207081>", driver)
}
}

240
internal/db/fileupload.go Normal file
View File

@ -0,0 +1,240 @@
package db
import (
"bytes"
"encoding/hex"
"hash/crc32"
"io"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
"time"
"github.com/google/uuid"
"github.com/pkg/errors"
"gorm.io/gorm"
)
// Use the Castagnoli checksum because of the acceleration on Intel CPUs
var checksumTable = crc32.MakeTable(crc32.Castagnoli)
// FileStore holds the path to a file storage location.
type FileStore struct {
path string
}
// FileUploadState determines the current state of a FileUpload object.
type FileUploadState int
// FileUpload models an uploaded file.
type FileUpload struct {
ID uint `gorm:"primaryKey"`
// State of the FileUpload (present/deleted/etc).
State FileUploadState `gorm:"index"`
// UUID publically identifies this FileUpload.
PubID uuid.UUID `gorm:"uniqueIndex"`
// FileName contains the original filename of this FileUpload.
FileName string
// Content type as determined by http.DetectContentType.
ContentType string
// Checksum holds a crc32c checksum of the file.
//
// This checksum is only meant to allow for the detection of random
// database corruption.
Checksum uint32
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt
}
const (
dirMode os.FileMode = 0750
fileMode os.FileMode = 0640
)
const (
// FileUploadStateUndef is an undefined FileUpload.
FileUploadStateUndef FileUploadState = 0
// FileUploadStatePresent denotes the normal (existing) state.
FileUploadStatePresent FileUploadState = 1
// FileUploadStateDeleted denotes a deleted state.
FileUploadStateDeleted FileUploadState = 2
)
func (t FileUploadState) String() string {
switch t {
case FileUploadStateUndef:
return "unknown"
case FileUploadStatePresent:
return "present"
case FileUploadStateDeleted:
return "deleted"
default:
return "invalid"
}
}
// ErrFileUploadDoesNotExist occurs when a key does not exist in the database.
var ErrFileUploadDoesNotExist = errors.New("file not found in the database")
// OpenFileStoreFromEnvironment tries to open a file store located at ${RUSHLINK_FILE_STORE_PATH}.
func OpenFileStoreFromEnvironment() (*FileStore, error) {
path, prs := os.LookupEnv(EnvFileStorePath)
if !prs {
err := errors.Errorf("%v environment variable is not set", EnvFileStorePath)
return nil, errors.Wrap(err, "opening file store")
}
return OpenFileStore(path)
}
// OpenFileStore opens the file storage at path.
func OpenFileStore(path string) (*FileStore, error) {
if path == "" {
return nil, errors.New("file-store not set")
}
// Try to create the file store directory if it does not yet exist
if err := os.MkdirAll(path, dirMode); err != nil {
return nil, errors.Wrap(err, "creating file store directory")
}
return &FileStore{path[:]}, nil
}
// Path returns the path of the FileStore root.
func (fs *FileStore) Path() string {
return fs.path
}
// filePath resolves the path of a file in the FileStore given some id and filename.
func (fs *FileStore) filePath(pubID uuid.UUID, fileName string) string {
if fs.path == "" {
panic("fileStoreDir called while the file store path has not been set")
}
return path.Join(fs.path, hex.EncodeToString(pubID[:]), fileName)
}
// NewFileUpload creates a new FileUpload object.
//
// Internally, this function detects the type of the file stored in `r` using
// `http.DetectContentType`.
func NewFileUpload(fs *FileStore, r io.Reader, fileName string) (*FileUpload, error) {
// Generate a file ID
pubID, err := uuid.NewRandom()
if err != nil {
return nil, errors.Wrap(err, "generating UUID")
}
// Construct a checksum for this file
hash := crc32.New(checksumTable)
tee := io.TeeReader(r, hash)
// Detect the file type
var tmpBuf bytes.Buffer
tmpBuf.Grow(512)
io.CopyN(&tmpBuf, tee, 512)
contentType := http.DetectContentType(tmpBuf.Bytes())
// Open the file on disk for writing
baseName := filepath.Base(fileName)
filePath := fs.filePath(pubID, baseName)
if err := os.Mkdir(path.Dir(filePath), dirMode); err != nil {
return nil, errors.Wrap(err, "creating file dir")
}
file, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE, fileMode)
if err != nil {
return nil, errors.Wrap(err, "opening file")
}
defer file.Close()
// Write the file to disk
_, err = io.Copy(file, &tmpBuf)
if err != nil {
return nil, errors.Wrap(err, "writing to file")
}
_, err = io.Copy(file, tee)
if err != nil {
return nil, errors.Wrap(err, "writing to file")
}
fu := &FileUpload{
State: FileUploadStatePresent,
PubID: pubID,
FileName: baseName,
ContentType: contentType,
Checksum: hash.Sum32(),
}
return fu, nil
}
// GetFileUpload tries to retrieve a FileUpload object from the bolt database.
func GetFileUpload(db *gorm.DB, pubID uuid.UUID) (*FileUpload, error) {
var fus []FileUpload
if err := db.Unscoped().Limit(1).Where("pub_id = ?", pubID).Find(&fus).Error; err != nil {
return nil, err
}
if len(fus) == 0 {
return nil, ErrFileUploadDoesNotExist
}
return &fus[0], nil
}
// AllFileUploads tries to retrieve all FileUpload objects from the bolt database.
func AllFileUploads(db *gorm.DB) ([]FileUpload, error) {
var fus []FileUpload
if err := db.Find(&fus).Error; err != nil {
return nil, err
}
return fus, nil
}
// Save saves a FileUpload in the database.
func (fu *FileUpload) Save(db *gorm.DB) error {
return db.Save(fu).Error
}
// Delete deletes a FileUpload from the database.
func (fu *FileUpload) Delete(db *gorm.DB, fs *FileStore) error {
// Remove the file in the backend
filePath := fu.Path(fs)
if err := os.Remove(filePath); err != nil {
return err
}
// Update the file in the server
if err := db.Delete(fu).Error; err != nil {
return err
}
// Cleanup the parent directory
wrap := "deletion succeeded, but removing the file directory has failed"
return errors.Wrap(os.Remove(path.Dir(filePath)), wrap)
}
// Path returns the path to this FileUpload in the FileStore provided in fs.
func (fu *FileUpload) Path(fs *FileStore) string {
return fs.filePath(fu.PubID, fu.FileName)
}
// URL returns the URL for the FileUpload.
func (fu *FileUpload) URL() *url.URL {
rawurl := "/uploads/" + hex.EncodeToString(fu.PubID[:]) + "/" + fu.FileName
urlParse, err := url.Parse(rawurl)
if err != nil {
panic("could not construct /uploads/ url")
}
return urlParse
}
// Ext returns the extension of the file attached to this FileUpload.
func (fu *FileUpload) Ext() string {
return filepath.Ext(fu.FileName)
}

46
internal/db/migrate.go Normal file
View File

@ -0,0 +1,46 @@
package db
import (
"time"
gormigrate "github.com/go-gormigrate/gormigrate/v2"
"github.com/google/uuid"
"gorm.io/gorm"
)
// Gormigrate returns a Gormigrate migrator for the database.
func Gormigrate(db *gorm.DB) *gormigrate.Gormigrate {
return gormigrate.New(db, gormigrate.DefaultOptions, []*gormigrate.Migration{
{
ID: "202010251337",
Migrate: func(tx *gorm.DB) error {
type FileUpload struct {
ID uint `gorm:"primaryKey"`
State FileUploadState `gorm:"index"`
PubID uuid.UUID `gorm:"uniqueIndex"`
FileName string
ContentType string
Checksum uint32
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt
}
type Paste struct {
ID uint `gorm:"primaryKey"`
Type PasteType `gorm:"index"`
State PasteState `gorm:"index"`
Content []byte
Key string `gorm:"uniqueIndex"`
DeleteToken string
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt
}
return tx.AutoMigrate(&FileUpload{}, &Paste{})
},
Rollback: func(tx *gorm.DB) error {
return tx.Migrator().DropTable(&FileUpload{}, &Paste{})
},
},
})
}

305
internal/db/paste.go Normal file
View File

@ -0,0 +1,305 @@
package db
import (
"crypto/rand"
"encoding/hex"
"net/http"
"net/url"
"strings"
"time"
"github.com/google/uuid"
"github.com/pkg/errors"
"gorm.io/gorm"
)
// PasteType describes the type of Paste (i.e. file, redirect, [...]).
type PasteType int
// PasteState describes the state of a Paste (i.e. present, deleted, [...]).
type PasteState int
// Paste describes the main Paste model in the database.
type Paste struct {
ID uint `gorm:"primaryKey"`
Type PasteType `gorm:"index"`
State PasteState `gorm:"index"`
Content []byte
Key string `gorm:"uniqueIndex"`
DeleteToken string
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt
}
// ReservedPasteKeys keys are designated reserved, and will not be randomly chosen.
var ReservedPasteKeys = []string{"xd42", "example"}
// Note: we use iota here. That means removals of PasteType* are not allowed,
// because this changes the value of the constant. Please add the comment
// "// deprecated" if you want to remove the constant. Additions are only
// allowed at the bottom of this block, for the same reason.
const (
PasteTypeUndef PasteType = iota
// PasteTypePaste is as of yet unused. It is still unclear if this type
// will ever get a proper meaning.
PasteTypePaste
PasteTypeRedirect
PasteTypeFileUpload
)
// Note: we use iota here. See the comment above PasteType*
const (
PasteStateUndef PasteState = iota
PasteStatePresent
PasteStateDeleted
)
// minKeyLen specifies the mimimum length of a paste key.
const minKeyLen = 4
var (
// ErrKeyInvalidChar occurs when a key contains an invalid character.
ErrKeyInvalidChar = errors.New("invalid character in key")
// ErrKeyInvalidLength occurs when a key embeds a length that is incorrect.
ErrKeyInvalidLength = errors.New("key length encoding is incorrect")
// ErrPasteDoesNotExist occurs when a key does not exist in the database.
ErrPasteDoesNotExist = errors.New("url key not found in the database")
)
// ErrHTTPStatusCode returns the HTTP status code that should correspond to
// the provided error.
// server error, or false if it is not.
func ErrHTTPStatusCode(err error) int {
switch err {
case nil:
return 0
case gorm.ErrRecordNotFound, ErrKeyInvalidChar, ErrKeyInvalidLength, ErrPasteDoesNotExist:
return http.StatusNotFound
}
return http.StatusInternalServerError
}
// Base64 encoding and decoding
var base64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
func (t PasteType) String() string {
switch t {
case PasteTypeUndef:
return "unknown"
case PasteTypePaste:
return "paste"
case PasteTypeRedirect:
return "redirect"
case PasteTypeFileUpload:
return "file"
default:
return "invalid"
}
}
func (t PasteState) String() string {
switch t {
case PasteStateUndef:
return "unknown"
case PasteStatePresent:
return "present"
case PasteStateDeleted:
return "deleted"
default:
return "invalid"
}
}
// GetPaste retrieves a paste from the database.
func GetPaste(db *gorm.DB, key string) (*Paste, error) {
if err := ValidatePasteKey(key); err != nil {
return nil, err
}
return GetPasteNoValidate(db, key)
}
// ValidatePasteKey validates the format of the key that has
func ValidatePasteKey(key string) error {
internalLen := minKeyLen
countingOnes := true
for _, ch := range key {
limb := strings.IndexRune(base64Alphabet, ch)
if limb == -1 {
return ErrKeyInvalidChar
}
for i := 5; i >= 0 && countingOnes; i-- {
if (limb>>uint(i))&0x1 == 0 {
countingOnes = false
break
}
internalLen++
}
}
if internalLen != len(key) {
return ErrKeyInvalidLength
}
return nil
}
// GetPasteNoValidate retrieves a paste from the database without validating
// the key format first.
func GetPasteNoValidate(db *gorm.DB, key string) (*Paste, error) {
var ps []Paste
if err := db.Unscoped().Limit(1).Where("key = ?", key).Find(&ps).Error; err != nil {
return nil, err
}
if len(ps) == 0 {
return nil, ErrPasteDoesNotExist
}
return &ps[0], nil
}
// Save saves this Paste to the database.
func (p *Paste) Save(db *gorm.DB) error {
return db.Save(p).Error
}
// Delete deletes this Paste from the database.
func (p *Paste) Delete(db *gorm.DB, fs *FileStore) error {
// Remove the (maybe) attached file
if p.Type == PasteTypeFileUpload {
fuID, err := uuid.FromBytes(p.Content)
if err != nil {
return errors.Wrap(err, "failed to parse uuid")
}
fu, err := GetFileUpload(db, fuID)
if err != nil {
return errors.Wrap(err, "failed to find file in database")
}
if err := fu.Delete(db, fs); err != nil {
return errors.Wrap(err, "failed to remove file")
}
}
// Wipe the old paste
p.Type = PasteTypeUndef
p.State = PasteStateDeleted
p.Content = []byte{}
if err := db.Save(&p).Error; err != nil {
return errors.Wrap(err, "failed to wipe paste in database")
}
// Soft-delete the paste as well
if err := db.Delete(&p).Error; err != nil {
return errors.Wrap(err, "failed to delete paste in database")
}
return nil
}
// RedirectURL returns the URL from this paste.
//
// This function assumes that the paste is valid. If the paste struct is
// corrupted in some way, this function will panic.
func (p *Paste) RedirectURL() *url.URL {
if p.Type != PasteTypeRedirect {
panic("expected p.Type to be PasteTypeRedirect")
}
rawurl := string(p.Content)
urlParse, err := url.Parse(rawurl)
if err != nil {
panic(errors.Wrapf(err, "invalid URL ('%v') in database for key '%v'", rawurl, p.Key))
}
return urlParse
}
// GeneratePasteKey generates a new paste key. It will ensure that the newly
// generated paste key does not already exist in the database.
// The running time of this function is in O(log N), where N is the amount of
// keys stored in the url-shorten database.
// In tx, a Bolt transaction is given. Use minimumEntropy to set the mimimum
// guessing entropy of the generated key.
func GeneratePasteKey(db *gorm.DB, minimumEntropy int) (string, error) {
epoch := 0
var key string
for {
var err error
key, err = generatePasteKeyInner(epoch, minimumEntropy)
if err != nil {
return "", errors.Wrap(err, "url-key generation failed")
}
var count int64
db.Unscoped().Model(&Paste{}).Where("key = ?", []byte(key)).Count(&count)
if err != nil {
return "", errors.Wrap(err, "failed to check if key already exists")
}
alreadyInUse := count != 0
isReserved := false
for _, reservedKey := range ReservedPasteKeys {
if strings.HasPrefix(key, reservedKey) {
isReserved = true
break
}
}
if !alreadyInUse && !isReserved {
break
}
epoch++
}
return key, nil
}
// generatePasteKeyInner generates a new paste key, but leaves the
// uniqueness and is-reserved checks to the caller. That is, it only
// generates a random key in the correct (syntactical) format.
// Both epoch and entropy can be used to set the key length. Epoch is used
// to prevent collisions in retrying to generate new keys. Entropy (in bits)
// is used to ensure that a new key has at least some amount of guessing
// entropy.
func generatePasteKeyInner(epoch, entropy int) (string, error) {
entropyEpoch := entropy
entropyEpoch -= minKeyLen * 6 // First 4 characters provide 24 bits.
entropyEpoch++ // One bit less because of '0' bit.
entropyEpoch = (entropyEpoch-1)/5 + 1 // 5 bits for every added epoch.
if epoch < entropyEpoch {
epoch = entropyEpoch
}
urlKey := make([]byte, minKeyLen+epoch)
_, err := rand.Read(urlKey)
if err != nil {
return "", err
}
// Put all the values in the range 0..64 for easier base64-encoding
for i := 0; i < len(urlKey); i++ {
urlKey[i] &= 0x3F
}
// Implement truncate-resistance by forcing the prefix to
// 0b111110xxxxxxxxxx
// ^----- {epoch} ones followed by a single 0
//
// Example when epoch is 1: prefix is 0b10.
i := 0
for i < epoch {
// Set this bit to 1
limb := i / 6
bit := i % 6
urlKey[limb] |= 1 << uint(5-bit)
i++
}
// Finally set the next bit to 0
limb := i / 6
bit := i % 6
urlKey[limb] &= ^(1 << uint(5-bit))
// Convert this ID to a canonical base64 notation
for i := range urlKey {
urlKey[i] = base64Alphabet[urlKey[i]]
}
return string(urlKey), nil
}
// GenerateDeleteToken generates a new (random) delete token.
func GenerateDeleteToken() (string, error) {
var deleteToken [16]byte
_, err := rand.Read(deleteToken[:])
if err != nil {
return "", err
}
return hex.EncodeToString(deleteToken[:]), nil
}

100
internal/db/paste_test.go Normal file
View File

@ -0,0 +1,100 @@
package db
import (
"testing"
"testing/quick"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
func OpenTemporaryDB() (*Database, error) {
db, err := gorm.Open(sqlite.Open(":memory:"), &gormConfig)
if err != nil {
return nil, err
}
migrate := Gormigrate(db)
if err := migrate.Migrate(); err != nil {
return nil, err
}
return db, nil
}
func TestValidatePasteKey(t *testing.T) {
tests := []struct {
key string
wantErr bool
errKind error
}{
{"xd42__", false, nil},
{"xd42_*", true, ErrKeyInvalidChar},
{"xd42_/", true, ErrKeyInvalidChar},
{"xd42_=", true, ErrKeyInvalidChar},
{"xd42_", true, ErrKeyInvalidLength},
{"xd42", true, ErrKeyInvalidLength},
{"xd4", true, ErrKeyInvalidLength},
{"xd", true, ErrKeyInvalidLength},
{"x", true, ErrKeyInvalidLength},
{"", true, ErrKeyInvalidLength},
{"KoJ5", false, nil},
{"__dGSJIIbBpr-SD0", false, nil},
{"__dGSJIIbBpr-SD", true, ErrKeyInvalidLength},
}
for _, tt := range tests {
t.Run(tt.key, func(t *testing.T) {
err := ValidatePasteKey(tt.key)
if (err != nil) != tt.wantErr {
t.Errorf("ValidatePasteKey() got error = %v, want error %v", err != nil, tt.wantErr)
}
if (err != nil) && err != tt.errKind {
t.Errorf("ValidatePasteKey() error = %v, want errKind %v", err, tt.errKind)
}
})
}
}
func TestGeneratedKeysAreValid(t *testing.T) {
db, err := OpenTemporaryDB()
if err != nil {
t.Error(err)
}
var minimumEntropy int
checkGeneratedKeyValid := func() bool {
key, err := GeneratePasteKey(db, minimumEntropy)
if err != nil {
return false
}
return ValidatePasteKey(key) == nil
}
for minimumEntropy = 0; minimumEntropy <= 80; minimumEntropy++ {
if err = quick.Check(checkGeneratedKeyValid, nil); err != nil {
t.Error(err)
}
}
}
func TestTruncatedKeysAreInvalid(t *testing.T) {
db, err := OpenTemporaryDB()
if err != nil {
t.Error(err)
}
var minimumEntropy int
checkTruncatedKeysInvalid := func(truncRand uint) bool {
key, err := GeneratePasteKey(db, minimumEntropy)
if err != nil {
return false
}
trunc := int(truncRand % uint(len(key)-1))
key = key[:trunc]
return ValidatePasteKey(key) == ErrKeyInvalidLength
}
for minimumEntropy = 0; minimumEntropy <= 80; minimumEntropy++ {
if err = quick.Check(checkTruncatedKeysInvalid, nil); err != nil {
t.Error(err)
}
}
}

108
metrics.go Normal file
View File

@ -0,0 +1,108 @@
package rushlink
import (
"log"
"net/http"
"time"
"gitea.hashru.nl/dsprenkels/rushlink/internal/db"
"github.com/gorilla/mux"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
const metricNamespace = "rushlink"
// metricURLsTotalGauge counts the number of requests that are handled by
// the application, partitioned by status code and HTTP method.
//
// This counter is updated by the router.
var metricRequestsTotalCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: metricNamespace,
Subsystem: "http",
Name: "requests_total",
Help: "How many HTTP requests processed, partitioned by status code and HTTP method.",
}, []string{"code", "method"})
// metricRequestsLatencyNanoSeconds keeps track of the request latencies for
// each http request.
//
// This historogram is updated by the router.
var metricRequestsLatencyNanoSeconds = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: metricNamespace,
Subsystem: "http",
Name: "request_duration_seconds",
Buckets: []float64{
float64(500e-6),
float64(1e-3),
float64(2e-3),
float64(5e-3),
float64(10e-3),
float64(20e-3),
float64(50e-3),
},
Help: "The latency of each HTTP request, partitioned by status code and HTTP method.",
}, []string{"code", "method"})
// metricURLsTotalGauge measures the amount of pastes stored in the database,
// partitioned by type and state.
//
// Its values are computed on the fly by updateMetrics().
var metricURLsTotalGauge = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: metricNamespace,
Subsystem: "pastes",
Name: "urls_total",
Help: "The current amount of pastes in the database, partitioned by state and type.",
}, []string{"state", "type"})
// StartMetricsServer starts sering Prometheus metrics exports on addr
func StartMetricsServer(addr string, database *db.Database, fs *db.FileStore) {
prometheus.MustRegister(metricRequestsTotalCounter)
prometheus.MustRegister(metricRequestsLatencyNanoSeconds)
prometheus.MustRegister(metricURLsTotalGauge)
router := mux.NewRouter()
router.Handle("/metrics", &MetricsHandler{database}).Methods("GET")
srv := &http.Server{
Handler: router,
Addr: addr,
WriteTimeout: 15 * time.Second,
ReadTimeout: 15 * time.Second,
}
log.Fatal(srv.ListenAndServe())
}
type MetricsHandler struct {
db *db.Database
}
func (mh *MetricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
mh.updateMetrics()
promhttp.Handler().ServeHTTP(w, r)
}
func (mh *MetricsHandler) updateMetrics() {
// Update metricURLsTotalGauge
results := make([](struct {
Type db.PasteType
State db.PasteState
Count float64
}), 0)
query := mh.db.Unscoped().Model(&db.Paste{}).Select("type", "state", "COUNT(*) as count").Group("type, state").Find(&results)
if err := query.Error; err != nil {
log.Printf("error: %v", errors.Wrap(err, "fetching pastes_total metric"))
return
}
metricURLsTotalGauge.Reset()
for _, r := range results {
labels := map[string]string{
"type": r.Type.String(),
"state": r.State.String(),
}
metricURLsTotalGauge.With(labels).Set(r.Count)
}
}

View File

@ -1,55 +0,0 @@
package metrics
import (
"log"
"net/http"
"time"
"github.com/gorilla/mux"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
bolt "go.etcd.io/bbolt"
"gitea.hashru.nl/dsprenkels/rushlink/db"
)
const (
METRICS_ADDR = "127.0.0.1:58614"
)
func StartMetricsServer() {
var (
_ = promauto.NewGaugeFunc(prometheus.GaugeOpts{
Namespace: "rushlink",
Subsystem: "pastes",
Name: "urls_total",
Help: "The current amount of pastes in the database.",
}, func() float64 {
var metric float64
if err := db.DB.View(func(tx *bolt.Tx) error {
bucket := tx.Bucket([]byte("pastes"))
if bucket == nil {
return errors.New("bucket 'pastes' could not be found")
}
metric = float64(bucket.Stats().KeyN)
return nil
}); err != nil {
log.Printf("error: %v", errors.Wrap(err, "fetching pastes_total metric"))
return 0
}
return metric
})
)
router := mux.NewRouter()
router.Handle("/metrics", promhttp.Handler()).Methods("GET")
srv := &http.Server{
Handler: router,
Addr: METRICS_ADDR,
WriteTimeout: 15 * time.Second,
ReadTimeout: 15 * time.Second,
}
log.Fatal(srv.ListenAndServe())
}

View File

@ -1,4 +1,4 @@
package gobmarsh
package rushlink
// Easier marshalling to and from gob encoding
@ -7,6 +7,7 @@ import (
"encoding/gob"
)
// Marshal serializes the value in v to a byte buffer.
func Marshal(v interface{}) ([]byte, error) {
b := new(bytes.Buffer)
err := gob.NewEncoder(b).Encode(v)
@ -16,6 +17,7 @@ func Marshal(v interface{}) ([]byte, error) {
return b.Bytes(), nil
}
// Unmarshal deserializes the data in data into the object in v.
func Unmarshal(data []byte, v interface{}) error {
b := bytes.NewBuffer(data)
return gob.NewDecoder(b).Decode(v)

149
router.go Normal file
View File

@ -0,0 +1,149 @@
package rushlink
import (
"fmt"
"log"
"net/http"
"net/url"
"runtime/debug"
"strconv"
"time"
"gitea.hashru.nl/dsprenkels/rushlink/internal/db"
"github.com/gorilla/mux"
"github.com/pkg/errors"
)
const staticFilenameExpr = "[A-Za-z0-9-_.]+"
const urlKeyExpr = "{key:[A-Za-z0-9-_]{4,}}"
const urlKeyWithExtExpr = urlKeyExpr + "{ext:\\.[A-Za-z0-9-_]+}"
type rushlink struct {
db *db.Database
fs *db.FileStore
rootURL *url.URL
}
func (rl *rushlink) RootURL() *url.URL {
return rl.rootURL
}
func (rl *rushlink) recoveryMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
logRequestInfo := func() {
log.Printf("in request: %v - %v %q %v", r.RemoteAddr, r.Method, r.RequestURI, r.Proto)
}
defer func() {
defer func() {
if err := recover(); err != nil {
w.WriteHeader(500)
log.Printf("error: panic while recovering from another panic: %v\n", err)
logRequestInfo()
debug.PrintStack()
fmt.Fprintf(w, "internal server error: %v\n", err)
}
}()
if err := recover(); err != nil {
w.WriteHeader(500)
log.Printf("error: %v\n", err)
logRequestInfo()
debug.PrintStack()
rl.renderInternalServerError(w, r, err)
}
}()
next.ServeHTTP(w, r)
})
}
func (rl *rushlink) metricsMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
tick := time.Now()
srw := statusResponseWriter{Inner: w}
next.ServeHTTP(&srw, r)
tock := time.Now()
status := strconv.Itoa(srw.StatusCode)
labels := map[string]string{"code": status, "method": r.Method}
// Update requests counter metric
metricRequestsTotalCounter.With(labels).Inc()
// Update request latency metric
elapsed := tock.Sub(tick)
metricRequestsLatencyNanoSeconds.With(labels).Observe(elapsed.Seconds())
})
}
type statusResponseWriter struct {
Inner http.ResponseWriter
StatusCode int
}
func (w *statusResponseWriter) Header() http.Header {
return w.Inner.Header()
}
func (w *statusResponseWriter) Write(buf []byte) (int, error) {
if w.StatusCode == 0 {
w.WriteHeader(http.StatusOK)
}
return w.Inner.Write(buf)
}
func (w *statusResponseWriter) WriteHeader(statusCode int) {
w.StatusCode = statusCode
w.Inner.WriteHeader(statusCode)
}
// InitMainRouter creates the main Gorilla router for the application.
//
// This function will not populate the router with an error-recovery and
// metrics-reporting middleware. If these middleware are required, then the
// caller should encapsulate this router inside of another router and register
// the middlewares on the encapsulating router.
func InitMainRouter(r *mux.Router, rl *rushlink) {
r.HandleFunc("/{path:img/"+staticFilenameExpr+"}", rl.staticGetHandler).Methods("GET", "HEAD")
r.HandleFunc("/{path:css/"+staticFilenameExpr+"}", rl.staticGetHandler).Methods("GET", "HEAD")
r.HandleFunc("/{path:js/"+staticFilenameExpr+"}", rl.staticGetHandler).Methods("GET", "HEAD")
r.HandleFunc("/", rl.indexGetHandler).Methods("GET", "HEAD")
r.HandleFunc("/", rl.newPasteHandler).Methods("POST")
r.HandleFunc("/"+urlKeyExpr, rl.viewPasteHandler).Methods("GET", "HEAD")
r.HandleFunc("/"+urlKeyWithExtExpr, rl.viewPasteHandler).Methods("GET", "HEAD")
r.HandleFunc("/"+urlKeyExpr+"/nr", rl.viewPasteHandlerNoRedirect).Methods("GET", "HEAD")
r.HandleFunc("/"+urlKeyWithExtExpr+"/nr", rl.viewPasteHandlerNoRedirect).Methods("GET", "HEAD")
r.HandleFunc("/"+urlKeyExpr+"/meta", rl.viewPasteHandlerMeta).Methods("GET", "HEAD")
r.HandleFunc("/"+urlKeyWithExtExpr+"/meta", rl.viewPasteHandlerMeta).Methods("GET", "HEAD")
r.HandleFunc("/"+urlKeyExpr, rl.deletePasteHandler).Methods("DELETE")
r.HandleFunc("/"+urlKeyWithExtExpr, rl.deletePasteHandler).Methods("DELETE")
r.HandleFunc("/"+urlKeyExpr+"/delete", rl.deletePasteHandler).Methods("POST")
r.HandleFunc("/"+urlKeyWithExtExpr+"/delete", rl.deletePasteHandler).Methods("POST")
}
// StartMainServer starts the main http server listening on addr.
func StartMainServer(addr string, db *db.Database, fs *db.FileStore, rawRootURL string) {
var rootURL *url.URL
if rawRootURL != "" {
var err error
rootURL, err = url.Parse(rawRootURL)
if err != nil {
log.Fatalln(errors.Wrap(err, "could not parse rootURL flag"))
}
}
rl := rushlink{
db: db,
fs: fs,
rootURL: rootURL,
}
router := mux.NewRouter()
router.Use(rl.metricsMiddleware)
router.Use(rl.recoveryMiddleware)
InitMainRouter(router, &rl)
srv := &http.Server{
Handler: router,
Addr: addr,
WriteTimeout: 15 * time.Second,
ReadTimeout: 15 * time.Second,
}
log.Fatal(srv.ListenAndServe())
}

View File

@ -1,8 +1,6 @@
package handlers
package rushlink
//go:generate go get github.com/go-bindata/go-bindata
//go:generate go get -u github.com/go-bindata/go-bindata/...
//go:generate go-bindata -pkg $GOPACKAGE -prefix ../assets ../assets/...
//go:generate go-bindata -pkg $GOPACKAGE -prefix assets/ assets/...
import (
"bytes"
@ -18,21 +16,24 @@ import (
"strconv"
"strings"
text "text/template"
"time"
"github.com/pkg/errors"
)
const defaultScheme = "http"
// Plain text templates
var textBaseTemplate *text.Template = text.Must(text.New("").Parse(string(MustAsset("templates/txt/base.txt.tmpl"))))
var htmlBaseTemplate *html.Template = html.Must(html.New("").Parse(string(MustAsset("templates/html/base.html.tmpl"))))
// Template collections
var textTemplates = make(map[string]*text.Template, 0)
var htmlTemplates = make(map[string]*html.Template, 0)
var textTemplates = make(map[string]*text.Template)
var htmlTemplates = make(map[string]*html.Template)
// Used by resolveResponseContentType
var acceptHeaderMediaRangeRegex = regexp.MustCompile(`^\s*([^()<>@,;:\\"/\[\]?.=]+)/([^()<>@,;:\\"/\[\]?.=]+)\s*$`)
var acceptHeaderAcceptParamsRegex = regexp.MustCompile(`^\s*(\w+)=([A-Za-z0-9.-])\s*$`)
var acceptHeaderAcceptParamsRegex = regexp.MustCompile(`^\s*(\w+)=([A-Za-z0-9.-]+)\s*$`)
var acceptHeaderWeight = regexp.MustCompile(`^\s*q=0(?:\.([0-9]{0,3}))|1(?:\.0{0,3})\s*$`)
// HTML templates
@ -74,19 +75,37 @@ func mustMatch(pattern, name string) bool {
return m
}
func parseFail(tmplName string, err error) {
panic(errors.Wrapf(err, "parsing of %v failed", tmplName))
func mapExtend(m map[string]interface{}, key string, value interface{}) {
if m[key] != nil {
return
}
m[key] = value
}
func render(w http.ResponseWriter, r *http.Request, tmplName string, data map[string]interface{}) {
func (rl *rushlink) renderStatic(w http.ResponseWriter, r *http.Request, path string) {
var modTime time.Time
if info, err := AssetInfo(path); err == nil {
modTime = info.ModTime()
}
contents, err := Asset(path)
if err != nil {
rl.renderError(w, r, http.StatusNotFound, err.Error())
return
}
http.ServeContent(w, r, path, modTime, bytes.NewReader(contents))
}
func (rl *rushlink) render(w http.ResponseWriter, r *http.Request, status int, tmplName string, data map[string]interface{}) {
contentType, err := resolveResponseContentType(r, []string{"text/plain", "text/html"})
if err != nil {
w.WriteHeader(http.StatusNotAcceptable)
fmt.Fprintf(w, "error parsing Accept header: %v\n", err)
return
}
// Add the request to the template data
data["Request"] = r
mapExtend(data, "RootURL", rl.resolveRootURL(r))
mapExtend(data, "Request", r)
switch contentType {
case "text/plain":
@ -96,7 +115,12 @@ func render(w http.ResponseWriter, r *http.Request, tmplName string, data map[st
err = fmt.Errorf("'%v' not in textTemplates", tmplName)
break
}
err = tmpl.Execute(w, data)
if status != 0 {
w.WriteHeader(status)
}
if r.Method != "HEAD" {
err = tmpl.Execute(w, data)
}
case "text/html":
w.Header().Set("Content-Type", "text/html")
tmpl := htmlTemplates[tmplName]
@ -117,7 +141,12 @@ func render(w http.ResponseWriter, r *http.Request, tmplName string, data map[st
}
return buf.String()
}
err = tmpl.Execute(w, data)
if status != 0 {
w.WriteHeader(status)
}
if r.Method != "HEAD" {
err = tmpl.Execute(w, data)
}
default:
// Fall back to plain text without template
w.WriteHeader(http.StatusNotAcceptable)
@ -129,14 +158,44 @@ func render(w http.ResponseWriter, r *http.Request, tmplName string, data map[st
}
}
func renderError(w http.ResponseWriter, r *http.Request, status int, msg string) {
w.WriteHeader(status)
render(w, r, "error", map[string]interface{}{"Message": msg})
func (rl *rushlink) renderError(w http.ResponseWriter, r *http.Request, status int, msg string) {
rl.render(w, r, status, "error", map[string]interface{}{"Message": msg})
}
func renderInternalServerError(w http.ResponseWriter, r *http.Request, err interface{}) {
func (rl *rushlink) renderInternalServerError(w http.ResponseWriter, r *http.Request, err interface{}) {
msg := fmt.Sprintf("internal server error: %v", err)
renderError(w, r, http.StatusInternalServerError, msg)
rl.renderError(w, r, http.StatusInternalServerError, msg)
}
// resolveRootURL constructs the `scheme://host` part of rushlinks public API.
//
// If the `--root_url` flag is set, it will return that URL.
// Otherwise, this function will return 'https://{Host}', where `{Host}` is
// the value provided by the client in the HTTP `Host` header. This value may
// be invalid, but it is impossible to handle this error (because we *cannot*
// know the real host).
func (rl *rushlink) resolveRootURL(r *http.Request) string {
rlHost := rl.RootURL()
if rlHost != nil {
// Root URL overridden by command line arguments
return rlHost.String()
}
// Guess scheme
scheme := defaultScheme
forwardedScheme := r.Header.Get("X-Forwarded-Proto")
switch forwardedScheme {
case "http":
scheme = "http"
case "https":
scheme = "https"
}
// Guess host
host := r.Host
if forwardedHost := r.Header.Get("X-Forwarded-Host"); forwardedHost != "" {
host = forwardedHost
}
return scheme + "://" + host
}
// Try to resolve the preferred content-type for the response to this request.
@ -154,7 +213,7 @@ func resolveResponseContentType(r *http.Request, types []string) (string, error)
if len(types) == 0 {
return "", nil
}
acceptHeader := r.Header.Get("Accept")
acceptHeader := strings.TrimSpace(r.Header.Get("Accept"))
if acceptHeader == "" {
return types[0], nil
}
@ -172,7 +231,7 @@ func resolveResponseContentType(r *http.Request, types []string) (string, error)
choiceParts := strings.Split(avString, ";")
mediaRange := acceptHeaderMediaRangeRegex.FindStringSubmatch(choiceParts[0])
if mediaRange == nil {
return "", fmt.Errorf("bad media-range (\"%v\")", choiceParts[0])
return "", fmt.Errorf("bad media-range ('%v')", choiceParts[0])
}
av.Type = mediaRange[1]
av.Subtype = mediaRange[2]
@ -197,7 +256,7 @@ func resolveResponseContentType(r *http.Request, types []string) (string, error)
// Check if this parameter is still invalid in any case
acceptParams := acceptHeaderAcceptParamsRegex.FindStringSubmatchIndex(choiceParts[0])
if acceptParams == nil {
return "", fmt.Errorf("bad accept-params (\"%v\")", choiceParts[0])
return "", fmt.Errorf("bad accept-params ('%v')", choiceParts[0])
}
}
avs[i] = av

54
views_test.go Normal file
View File

@ -0,0 +1,54 @@
package rushlink
import (
"net/http"
"testing"
)
func resolveResponseContentTypeSuccess(t *testing.T, expected string, types []string, acceptVal string) {
r, err := http.NewRequest("HEAD", "", nil)
if err != nil {
panic(err)
}
r.Header.Set("Accept", acceptVal)
got, err := resolveResponseContentType(r, types)
if err != nil {
t.Errorf("error: '%v'\n", err)
}
if got != expected {
t.Errorf("error: '%v' should be '%v'\n", got, expected)
}
}
func resolveResponseContentTypeError(t *testing.T, expected string, types []string, acceptVal string) {
r, err := http.NewRequest("HEAD", "", nil)
if err != nil {
panic(err)
}
r.Header.Set("Accept", acceptVal)
got, err := resolveResponseContentType(r, types)
if err == nil {
t.Errorf("expected an error, but got a success: '%v'", got)
}
if got != "" {
t.Errorf("error: return value should be empty, not '%v'", got)
}
if err.Error() != expected {
t.Errorf("wrong error value error: got '%v', want '%v'\n", got, expected)
}
}
func TestResolveResponseContentType(t *testing.T) {
resolveResponseContentTypeSuccess(t, "", []string{}, "text/html")
resolveResponseContentTypeSuccess(t, "text/html", []string{"text/html"}, "")
resolveResponseContentTypeSuccess(t, "text/html", []string{"text/txt", "text/html"}, "text/txt;q=0.5,text/html")
resolveResponseContentTypeSuccess(t, "text/html", []string{"text/txt", "text/html"}, "text/txt;q=0.5,text/html;q=0.9")
resolveResponseContentTypeSuccess(t, "", []string{"text"}, "text/html")
resolveResponseContentTypeSuccess(t, "", []string{"text/*"}, "image/*")
// Issue #17
resolveResponseContentTypeSuccess(t, "*/*", []string{"*/*"}, "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3")
// Issue #66
resolveResponseContentTypeError(t, "bad media-range ('*')", []string{"text/plain"}, " *")
}