First commit

This commit is contained in:
Melon 2023-04-16 11:56:17 +01:00
commit 2f8a564e8d
Signed by: melon
GPG Key ID: 6C9D970C50D26A25
70 changed files with 3147 additions and 0 deletions

93
api/api.go Normal file
View File

@ -0,0 +1,93 @@
package api
import (
"code.mrmelon54.com/melon/summer/pkg/utils"
"code.mrmelon54.com/melon/summer/pkg/utils/debug"
"encoding/json"
"errors"
"fmt"
"github.com/golang-jwt/jwt/v4"
"github.com/google/uuid"
"github.com/gorilla/mux"
"golang.org/x/crypto/bcrypt"
"log"
"net/http"
"runtime"
"time"
)
var (
ErrNoError = errors.New("no error")
ErrParamMissing = errors.New("parameter is missing")
ErrParamWrongType = errors.New("parameter is of the wrong type")
noLogErrors = []error{
ErrNoError,
ErrParamMissing,
ErrParamWrongType,
}
// prevent logging these to stop clutter of the logs
noLogProdErrors = []error{
bcrypt.ErrMismatchedHashAndPassword,
jwt.ErrTokenInvalidClaims,
jwt.ErrTokenMalformed,
jwt.ErrTokenExpired,
}
)
type logErrorOutput struct {
Message string `json:"message"`
LogId string `json:"log_id"`
}
func GenericErrorMsg[T any](rw http.ResponseWriter, err error, code int, msg string, args ...any) bool {
if err == nil {
return false
}
m := fmt.Sprintf(msg, args...)
u := fmt.Sprintf("LOG_%s", uuid.New())
var noLog bool
for _, i := range noLogErrors {
if errors.Is(err, i) {
noLog = true
}
}
if !debug.IsDebug() {
for _, i := range noLogProdErrors {
if errors.Is(err, i) {
noLog = true
}
}
}
if !noLog {
var pr string
_, file, line, ok := runtime.Caller(1)
if ok {
pr = fmt.Sprintf(" (%s:%d)", file, line)
}
log.Printf("[GenericApi::%T] {%s}%s %s: %s\n", *new(T), u, pr, m, err)
}
rw.Header().Set("Content-Type", "application/json")
rw.Header().Set("X-Content-Type-Options", "nosniff")
rw.WriteHeader(code)
_ = json.NewEncoder(rw).Encode(logErrorOutput{
Message: m,
LogId: u,
})
return true
}
func RunApiServer(listen string, router *mux.Router) *http.Server {
s := &http.Server{
Addr: listen,
Handler: router,
ReadTimeout: 1 * time.Minute,
ReadHeaderTimeout: 1 * time.Minute,
WriteTimeout: 1 * time.Minute,
IdleTimeout: 1 * time.Minute,
MaxHeaderBytes: 2500,
}
log.Printf("[API] Starting API server on: '%s'\n", s.Addr)
go utils.RunBackgroundHttp("API", s)
return s
}

13
api/compilable.go Normal file
View File

@ -0,0 +1,13 @@
package api
type Compilable interface {
Compile()
}
type MultiCompilable []Compilable
func (m MultiCompilable) Compile() {
for _, i := range m {
i.Compile()
}
}

5
api/config.go Normal file
View File

@ -0,0 +1,5 @@
package api
type AuthConfig struct {
Public string `yaml:"public"`
}

47
api/crud/database.go Normal file
View File

@ -0,0 +1,47 @@
package crud
import (
"fmt"
"xorm.io/xorm"
)
type databaseProvider[T any] struct {
db *xorm.Engine
idWhere string
}
func NewDatabaseProvider[T any](db *xorm.Engine, idColumn string) CheckedProvider[T] {
return &databaseProvider[T]{db, fmt.Sprintf("%s = ?", idColumn)}
}
func (d databaseProvider[T]) Find() ([]T, error) {
a := make([]T, 0)
err := d.db.Find(&a)
return a, err
}
func (d databaseProvider[T]) Add(item T) (T, error) {
_, err := d.db.Insert(&item)
return item, err
}
func (d databaseProvider[T]) Get(id string) (T, bool, error) {
var t T
ok, err := d.db.Where(d.idWhere, id).Get(&t)
return t, ok, err
}
func (d databaseProvider[T]) Put(id string, item T) error {
_, err := d.db.Where(d.idWhere, id).Update(&item)
return err
}
func (d databaseProvider[T]) Patch(id string, item T) error {
_, err := d.db.Where(d.idWhere, id).Update(&item)
return err
}
func (d databaseProvider[T]) Delete(id string) error {
_, err := d.db.Where(d.idWhere, id).Delete(new(T))
return err
}

View File

@ -0,0 +1,56 @@
package crud
import (
"code.mrmelon54.com/melon/summer/pkg/claims/auth"
)
type FunctionProvider[T any] struct {
InnerFind fFind[T]
InnerAdd fAdd[T]
InnerGet fGet[T]
InnerPut fPut[T]
InnerPatch fPatch[T]
InnerDelete fDelete
}
func (f FunctionProvider[T]) Find(claims *auth.AccessTokenClaims) ([]T, error) {
if f.InnerFind == nil {
return nil, ErrMethodNotAllowed
}
return f.InnerFind(claims)
}
func (f FunctionProvider[T]) Add(claims *auth.AccessTokenClaims, item T) (T, error) {
if f.InnerAdd == nil {
return *new(T), ErrMethodNotAllowed
}
return f.InnerAdd(claims, item)
}
func (f FunctionProvider[T]) Get(claims *auth.AccessTokenClaims, id string) (T, bool, error) {
if f.InnerGet == nil {
return *new(T), false, ErrMethodNotAllowed
}
return f.InnerGet(claims, id)
}
func (f FunctionProvider[T]) Put(claims *auth.AccessTokenClaims, id string, item T) error {
if f.InnerPut == nil {
return ErrMethodNotAllowed
}
return f.InnerPut(claims, id, item)
}
func (f FunctionProvider[T]) Patch(claims *auth.AccessTokenClaims, id string, item T) error {
if f.InnerPatch == nil {
return ErrMethodNotAllowed
}
return f.InnerPatch(claims, id, item)
}
func (f FunctionProvider[T]) Delete(claims *auth.AccessTokenClaims, id string) error {
if f.InnerDelete == nil {
return ErrMethodNotAllowed
}
return f.InnerDelete(claims, id)
}

171
api/crud/generic.go Normal file
View File

@ -0,0 +1,171 @@
package crud
import (
"code.mrmelon54.com/melon/summer/pkg/api"
"code.mrmelon54.com/melon/summer/pkg/claims/auth"
"code.mrmelon54.com/melon/summer/pkg/utils"
"encoding/json"
"github.com/gorilla/mux"
"github.com/mrmelon54/mjwt"
"net/http"
)
type crudHandler[T any] struct {
provider Provider[T]
verify mjwt.Provider
}
type secureHandlerFunc func(rw http.ResponseWriter, req *http.Request, claims *auth.AccessTokenClaims)
func NewCrudHandler[T any](router *mux.Router, verify mjwt.Provider, provider Provider[T], findPath, itemPath string) {
z := &crudHandler[T]{provider: provider, verify: verify}
router.HandleFunc(findPath, z.claimExtractor(z.handleFind)).Methods(http.MethodGet)
router.HandleFunc(findPath, z.claimExtractor(z.handleAdd)).Methods(http.MethodPost)
router.HandleFunc(itemPath, z.claimExtractor(z.handleGet)).Methods(http.MethodGet)
router.HandleFunc(itemPath, z.claimExtractor(z.handlePut)).Methods(http.MethodPut)
router.HandleFunc(itemPath, z.claimExtractor(z.handlePatch)).Methods(http.MethodPatch)
router.HandleFunc(itemPath, z.claimExtractor(z.handleDelete)).Methods(http.MethodDelete)
}
func (c *crudHandler[T]) claimExtractor(f secureHandlerFunc) func(rw http.ResponseWriter, req *http.Request) {
return func(rw http.ResponseWriter, req *http.Request) {
token := utils.GetBearerToken(req)
if token == "" {
f(rw, req, nil)
return
}
// Verify as mfa flow token
_, b, err := mjwt.ExtractClaims[auth.AccessTokenClaims](c.verify, token)
if err != nil {
f(rw, req, nil)
return
}
f(rw, req, &b.Claims)
}
}
func (c *crudHandler[T]) handleFind(rw http.ResponseWriter, _ *http.Request, claims *auth.AccessTokenClaims) {
a, err := c.provider.Find(claims)
if HttpCatchError(rw, err) {
return
}
if api.GenericErrorMsg[T](rw, err, http.StatusInternalServerError, "Find error") {
return
}
rw.Header().Set("Content-Type", "application/json")
rw.WriteHeader(http.StatusOK)
err = json.NewEncoder(rw).Encode(a)
if api.GenericErrorMsg[T](rw, err, http.StatusInternalServerError, "Encode error") {
return
}
}
func (c *crudHandler[T]) handleAdd(rw http.ResponseWriter, req *http.Request, claims *auth.AccessTokenClaims) {
var t T
err := json.NewDecoder(req.Body).Decode(&t)
if api.GenericErrorMsg[T](rw, err, http.StatusBadRequest, "Decode error") {
return
}
t, err = c.provider.Add(claims, t)
if HttpCatchError(rw, err) {
return
}
if api.GenericErrorMsg[T](rw, err, http.StatusInternalServerError, "Add error") {
return
}
rw.Header().Set("Content-Type", "application/json")
rw.WriteHeader(http.StatusCreated)
err = json.NewEncoder(rw).Encode(&t)
if api.GenericErrorMsg[T](rw, err, http.StatusInternalServerError, "Encode error") {
return
}
}
func (c *crudHandler[T]) handleGet(rw http.ResponseWriter, req *http.Request, claims *auth.AccessTokenClaims) {
vars := mux.Vars(req)
s, ok := vars["id"]
if !ok {
api.GenericErrorMsg[T](rw, api.ErrParamMissing, http.StatusBadRequest, "Parameter error")
return
}
t, found, err := c.provider.Get(claims, s)
if HttpCatchError(rw, err) {
return
}
if api.GenericErrorMsg[T](rw, err, http.StatusInternalServerError, "Get error") {
return
}
if !found {
api.GenericErrorMsg[T](rw, err, http.StatusNotFound, "Not Found")
return
}
rw.Header().Set("Content-Type", "application/json")
rw.WriteHeader(http.StatusOK)
err = json.NewEncoder(rw).Encode(&t)
if api.GenericErrorMsg[T](rw, err, http.StatusInternalServerError, "Encode error") {
return
}
}
func (c *crudHandler[T]) handlePut(rw http.ResponseWriter, req *http.Request, claims *auth.AccessTokenClaims) {
vars := mux.Vars(req)
s, ok := vars["id"]
if !ok {
api.GenericErrorMsg[T](rw, api.ErrParamMissing, http.StatusBadRequest, "Parameter error")
return
}
var t T
err := json.NewDecoder(req.Body).Decode(&t)
if api.GenericErrorMsg[T](rw, err, http.StatusBadRequest, "Decode error") {
return
}
err = c.provider.Put(claims, s, t)
if HttpCatchError(rw, err) {
return
}
if api.GenericErrorMsg[T](rw, err, http.StatusInternalServerError, "Put error") {
return
}
rw.WriteHeader(http.StatusNoContent)
}
func (c *crudHandler[T]) handlePatch(rw http.ResponseWriter, req *http.Request, claims *auth.AccessTokenClaims) {
vars := mux.Vars(req)
s, ok := vars["id"]
if !ok {
api.GenericErrorMsg[T](rw, api.ErrParamMissing, http.StatusBadRequest, "Parameter error")
return
}
var t T
err := json.NewDecoder(req.Body).Decode(&t)
if api.GenericErrorMsg[T](rw, err, http.StatusBadRequest, "Decode error") {
return
}
err = c.provider.Patch(claims, s, t)
if HttpCatchError(rw, err) {
return
}
if api.GenericErrorMsg[T](rw, err, http.StatusInternalServerError, "Patch error") {
return
}
rw.WriteHeader(http.StatusNoContent)
}
func (c *crudHandler[T]) handleDelete(rw http.ResponseWriter, req *http.Request, claims *auth.AccessTokenClaims) {
vars := mux.Vars(req)
s, ok := vars["id"]
if !ok {
api.GenericErrorMsg[T](rw, api.ErrParamMissing, http.StatusBadRequest, "Parameter error")
return
}
err := c.provider.Delete(claims, s)
if HttpCatchError(rw, err) {
return
}
if api.GenericErrorMsg[T](rw, err, http.StatusInternalServerError, "Delete error") {
return
}
rw.WriteHeader(http.StatusNoContent)
}

34
api/crud/http-errors.go Normal file
View File

@ -0,0 +1,34 @@
package crud
import (
"code.mrmelon54.com/melon/summer/pkg/api"
"fmt"
"github.com/pkg/errors"
"net/http"
)
var (
ErrForbidden = HttpError(http.StatusForbidden)
ErrMethodNotAllowed = HttpError(http.StatusMethodNotAllowed)
)
type HttpError int
func (h HttpError) Error() string {
return fmt.Sprintf("%d %s", h, http.StatusText(int(h)))
}
var catchErrors = []HttpError{
ErrForbidden,
ErrMethodNotAllowed,
}
func HttpCatchError(rw http.ResponseWriter, err error) bool {
for _, i := range catchErrors {
if errors.Is(err, i) {
api.GenericErrorMsg[HttpError](rw, err, http.StatusForbidden, i.Error())
return true
}
}
return false
}

29
api/crud/provider.go Normal file
View File

@ -0,0 +1,29 @@
package crud
import "code.mrmelon54.com/melon/summer/pkg/claims/auth"
type Provider[T any] interface {
Find(claims *auth.AccessTokenClaims) ([]T, error)
Add(claims *auth.AccessTokenClaims, item T) (T, error)
Get(claims *auth.AccessTokenClaims, id string) (T, bool, error)
Put(claims *auth.AccessTokenClaims, id string, item T) error
Patch(claims *auth.AccessTokenClaims, id string, item T) error
Delete(claims *auth.AccessTokenClaims, id string) error
}
type CheckedProvider[T any] interface {
Find() ([]T, error)
Add(item T) (T, error)
Get(id string) (T, bool, error)
Put(id string, item T) error
Patch(id string, item T) error
Delete(id string) error
}
type fFind[T any] func(claims *auth.AccessTokenClaims) ([]T, error)
type fAdd[T any] func(claims *auth.AccessTokenClaims, item T) (T, error)
type fGet[T any] func(claims *auth.AccessTokenClaims, id string) (T, bool, error)
type fChange[T any] func(claims *auth.AccessTokenClaims, id string, item T) error
type fPut[T any] fChange[T]
type fPatch[T any] fChange[T]
type fDelete func(claims *auth.AccessTokenClaims, id string) error

56
api/crud/single-perm.go Normal file
View File

@ -0,0 +1,56 @@
package crud
import (
"code.mrmelon54.com/melon/summer/pkg/claims/auth"
)
type singlePermProvider[T any] struct {
perm string
provider CheckedProvider[T]
}
func NewSinglePermProvider[T any](perm string, provider CheckedProvider[T]) Provider[T] {
return &singlePermProvider[T]{perm, provider}
}
func (s *singlePermProvider[T]) Find(claims *auth.AccessTokenClaims) ([]T, error) {
if !claims.Perms.Has(s.perm) {
return nil, ErrForbidden
}
return s.provider.Find()
}
func (s *singlePermProvider[T]) Add(claims *auth.AccessTokenClaims, item T) (T, error) {
if !claims.Perms.Has(s.perm) {
return *new(T), ErrForbidden
}
return s.provider.Add(item)
}
func (s *singlePermProvider[T]) Get(claims *auth.AccessTokenClaims, id string) (T, bool, error) {
if !claims.Perms.Has(s.perm) {
return *new(T), false, ErrForbidden
}
return s.provider.Get(id)
}
func (s *singlePermProvider[T]) Put(claims *auth.AccessTokenClaims, id string, item T) error {
if !claims.Perms.Has(s.perm) {
return ErrForbidden
}
return s.provider.Put(id, item)
}
func (s *singlePermProvider[T]) Patch(claims *auth.AccessTokenClaims, id string, item T) error {
if !claims.Perms.Has(s.perm) {
return ErrForbidden
}
return s.provider.Patch(id, item)
}
func (s *singlePermProvider[T]) Delete(claims *auth.AccessTokenClaims, id string) error {
if !claims.Perms.Has(s.perm) {
return ErrForbidden
}
return s.provider.Delete(id)
}

View File

@ -0,0 +1,11 @@
package bit_storage
import "golang.org/x/exp/constraints"
type BitStorage[T constraints.Unsigned] interface {
Set(v uint32)
Clear(v uint32)
Get(v uint32) bool
Unique() []uint32
Dump() []uint32
}

30
bit-storage/u32.go Normal file
View File

@ -0,0 +1,30 @@
package bit_storage
import "encoding/json"
type bitU32 struct {
V uint32
}
var _ BitStorage[uint32] = &bitU32{}
func EmptyU32() *bitU32 { return &bitU32{} }
func (b *bitU32) Set(v uint32) { b.V |= v }
func (b *bitU32) Clear(v uint32) { b.V &^= v }
func (b *bitU32) Get(v uint32) bool { return b.V&v > 0 }
func (b *bitU32) Unique() []uint32 {
z := make([]uint32, 0)
m := 0
n := b.V
for n > 0 {
z = append(z, (n&2)<<m)
n >>= 1
m++
}
return z
}
func (b *bitU32) Dump() []uint32 { return []uint32{b.V} }
func (b *bitU32) MarshalJSON() ([]byte, error) { return json.Marshal(b.V) }
func (b *bitU32) UnmarshalJSON(bytes []byte) error { return json.Unmarshal(bytes, &b.V) }

52
bit-storage/u32inf.go Normal file
View File

@ -0,0 +1,52 @@
package bit_storage
import "encoding/json"
type bitU32inf struct {
V []uint32
}
var _ BitStorage[uint32] = &bitU32inf{}
func EmptyInfiniteU32() *bitU32inf { return &bitU32inf{V: make([]uint32, 0)} }
func ParseInfiniteU32(v []uint32) *bitU32inf { return &bitU32inf{V: v} }
func (b *bitU32inf) Set(v uint32) {
a := int(v / 32)
l := len(b.V)
if a > l {
b.V = append(b.V, make([]uint32, a-l)...)
}
b.V[a] |= v % 32
}
func (b *bitU32inf) Clear(v uint32) {
if int(v/32) > len(b.V) {
return
}
b.V[v/32] &^= v % 32
}
func (b *bitU32inf) Get(v uint32) bool {
if int(v/32) > len(b.V) {
return false
}
return b.V[v/32]&(v%32) > 0
}
func (b *bitU32inf) Unique() []uint32 {
z := make([]uint32, 0)
m := 0
for i := range b.V {
n := b.V[i]
for n > 0 {
z = append(z, (n&2)<<m)
n >>= 1
m++
}
}
return z
}
func (b *bitU32inf) Dump() []uint32 {
return b.V
}
func (b *bitU32inf) MarshalJSON() ([]byte, error) { return json.Marshal(b.V) }
func (b *bitU32inf) UnmarshalJSON(bytes []byte) error { return json.Unmarshal(bytes, &b.V) }

23
claims/auth/access.go Normal file
View File

@ -0,0 +1,23 @@
package auth
import (
"code.mrmelon54.com/melon/summer/pkg/claims"
"github.com/mrmelon54/mjwt"
"time"
)
type AccessTokenClaims struct {
UserId uint64 `json:"uid"`
Perms *claims.PermStorage `json:"per"`
}
func (a AccessTokenClaims) Valid() error { return nil }
func (a AccessTokenClaims) Type() string { return "access-token" }
func CreateAccessToken(p mjwt.Provider, sub, id string, userId uint64, perms *claims.PermStorage) (string, error) {
return p.GenerateJwt(sub, id, time.Minute*15, &AccessTokenClaims{
UserId: userId,
Perms: perms,
})
}

19
claims/auth/refresh.go Normal file
View File

@ -0,0 +1,19 @@
package auth
import (
"github.com/mrmelon54/mjwt"
"time"
)
type RefreshTokenClaims struct {
UserId uint64 `json:"uid"`
}
func (r RefreshTokenClaims) Valid() error { return nil }
func (r RefreshTokenClaims) Type() string { return "refresh-token" }
func CreateRefreshToken(p mjwt.Provider, sub, id string, userId uint64) (string, error) {
return p.GenerateJwt(sub, id, time.Hour*24*7, RefreshTokenClaims{
UserId: userId,
})
}

21
claims/flow/login.go Normal file
View File

@ -0,0 +1,21 @@
package flow
import (
"github.com/mrmelon54/mjwt"
"time"
)
type LoginFlowClaims struct {
LoginId uint64 `json:"lid"`
NextState string `json:"nxs"`
}
func (l LoginFlowClaims) Valid() error { return nil }
func (l LoginFlowClaims) Type() string { return "login-flow" }
func CreateLoginFlowToken(p mjwt.Provider, sub, id, nextState string, loginId uint64, dur time.Duration) (string, error) {
return p.GenerateJwt(sub, id, dur, LoginFlowClaims{
LoginId: loginId,
NextState: nextState,
})
}

19
claims/flow/mfa.go Normal file
View File

@ -0,0 +1,19 @@
package flow
import (
"github.com/mrmelon54/mjwt"
"time"
)
type MfaFlowClaims struct {
LoginId uint64 `json:"lid"`
}
func (m MfaFlowClaims) Valid() error { return nil }
func (m MfaFlowClaims) Type() string { return "mfa-flow" }
func CreateMfaFlowToken(p mjwt.Provider, sub, id string, loginId uint64, dur time.Duration) (string, error) {
return p.GenerateJwt(sub, id, dur, MfaFlowClaims{
LoginId: loginId,
})
}

23
claims/flow/oauth.go Normal file
View File

@ -0,0 +1,23 @@
package flow
import (
"code.mrmelon54.com/melon/summer/pkg/claims"
"github.com/mrmelon54/mjwt"
"time"
)
type OAuthFlowClaims struct {
LoginId uint64 `json:"lid"`
Scopes *claims.PermStorage `json:"sco"`
}
func (o OAuthFlowClaims) Valid() error { return nil }
func (o OAuthFlowClaims) Type() string { return "oauth-flow" }
func CreateOAuthFlowToken(p mjwt.Provider, sub, id string, loginId uint64, scopes *claims.PermStorage, dur time.Duration) (string, error) {
return p.GenerateJwt(sub, id, dur, OAuthFlowClaims{
LoginId: loginId,
Scopes: scopes,
})
}

85
claims/perms.go Normal file
View File

@ -0,0 +1,85 @@
package claims
import (
"encoding/json"
"gopkg.in/yaml.v3"
"sort"
)
type PermStorage struct {
values map[string]struct{}
}
func NewPermStorage() *PermStorage {
return new(PermStorage).setup()
}
func (p *PermStorage) setup() *PermStorage {
if p.values == nil {
p.values = make(map[string]struct{})
}
return p
}
func (p *PermStorage) Set(perm string) {
p.values[perm] = struct{}{}
}
func (p *PermStorage) Clear(perm string) {
delete(p.values, perm)
}
func (p *PermStorage) Has(perm string) bool {
_, ok := p.values[perm]
return ok
}
func (p *PermStorage) OneOf(o *PermStorage) bool {
for i := range o.values {
if o.Has(i) {
return true
}
}
return false
}
func (p *PermStorage) dump() []string {
var a []string
for i := range p.values {
a = append(a, i)
}
sort.Strings(a)
return a
}
func (p *PermStorage) prepare(a []string) {
for _, i := range a {
p.Set(i)
}
}
func (p *PermStorage) MarshalJSON() ([]byte, error) { return json.Marshal(p.dump()) }
func (p *PermStorage) UnmarshalJSON(bytes []byte) error {
p.setup()
var a []string
err := json.Unmarshal(bytes, &a)
if err != nil {
return err
}
p.prepare(a)
return nil
}
func (p *PermStorage) MarshalYAML() (interface{}, error) { return yaml.Marshal(p.dump()) }
func (p *PermStorage) UnmarshalYAML(value *yaml.Node) error {
p.setup()
var a []string
err := value.Decode(&a)
if err != nil {
return err
}
p.prepare(a)
return nil
}

85
cli/main.go Normal file
View File

@ -0,0 +1,85 @@
package cli
import (
"code.mrmelon54.com/melon/summer/pkg/utils"
"flag"
"fmt"
_ "github.com/go-sql-driver/mysql"
"gopkg.in/yaml.v3"
"log"
"math/rand"
"os"
"os/signal"
"syscall"
"time"
"xorm.io/xorm"
)
func Run(software, dbString string, executor Executor[any]) {
preSetup(software, nil)
postSetup[any](software, dbString, nil, executor)
}
func RunWithConfig[T any](software string, dbFunc func(t T) string, executor Executor[T]) {
var configPath string
preSetup(software, &configPath)
open, err := os.Open(configPath)
utils.Check("Failed to open config file", err)
decoder := yaml.NewDecoder(open)
t := *new(T)
utils.Check("Failed to decode config file", decoder.Decode(&t))
postSetup(software, dbFunc(t), t, executor)
}
func preSetup(software string, configPath *string) {
rand.Seed(time.Now().UnixMilli())
var version bool
flag.BoolVar(&version, "version", false, "Show program version")
if configPath != nil {
flag.StringVar(configPath, "config", fmt.Sprintf("/etc/melon-summer/%s.config.yml", software), fmt.Sprintf("Path to config file for %s", software))
}
flag.Parse()
if version {
fmt.Printf("%s %s\n", software, utils.BuildVersion)
return
}
}
func postSetup[T any](software string, dbString string, t T, executor Executor[T]) {
log.Printf("[Main] Starting up %s (%s from %s)\n", software, utils.BuildVersion, utils.BuildDate)
// Load database
engine, err := xorm.NewEngine("mysql", dbString)
utils.Check("Failed to connect to database", err)
// Start runner
runner := &Runner[T]{software: software, executor: executor, Config: t, Database: engine}
executor.Init(runner)
// Wait for exit signal
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
<-sc
fmt.Println()
// Stop runner
log.Printf("[Main] Stopping " + software)
n := time.Now()
executor.Destroy()
log.Printf("[Main] Took '%s' to shutdown\n", time.Now().Sub(n))
log.Println("[Main] Goodbye")
}
type Executor[T any] interface {
Init(*Runner[T])
Destroy()
}
type Runner[T any] struct {
software string
executor Executor[T]
Config T
Database *xorm.Engine
}

42
go.mod Normal file
View File

@ -0,0 +1,42 @@
module code.mrmelon54.com/melon/summer-utils
go 1.20
require (
code.mrmelon54.com/melon/certgen v0.0.0-20220830133534-0fb4cb7e67d1
code.mrmelon54.com/melon/summer v0.0.2
github.com/emersion/go-message v0.16.0
github.com/emersion/go-sasl v0.0.0-20220912192320-0145f2c60ead
github.com/emersion/go-smtp v0.16.0
github.com/go-sql-driver/mysql v1.7.0
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
github.com/mrmelon54/mjwt v0.0.1
github.com/pkg/errors v0.9.1
github.com/sec51/twofactor v1.0.0
github.com/stretchr/testify v1.8.2
golang.org/x/crypto v0.8.0
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
gopkg.in/yaml.v3 v3.0.1
xorm.io/xorm v1.3.2
)
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 // indirect
github.com/goccy/go-json v0.8.1 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sec51/convert v1.0.2 // indirect
github.com/sec51/cryptoengine v0.0.0-20180911112225-2306d105a49e // indirect
github.com/sec51/gf256 v0.0.0-20160126143050-2454accbeb9e // indirect
github.com/sec51/qrcode v0.0.0-20160126144534-b7779abbcaf1 // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
golang.org/x/sys v0.7.0 // indirect
xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978 // indirect
)

680
go.sum Normal file
View File

@ -0,0 +1,680 @@
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=
code.mrmelon54.com/melon/certgen v0.0.0-20220830133534-0fb4cb7e67d1 h1:tll8DwvO1CL+xXJIMLyDmQYoYr/gA4BkcUFtNHB1BFo=
code.mrmelon54.com/melon/certgen v0.0.0-20220830133534-0fb4cb7e67d1/go.mod h1:Liyhe1bkNyeVfw6LicCgrQ+4oUT/w/qONLjvejkUim0=
code.mrmelon54.com/melon/summer v0.0.2 h1:8VGzgS5BKULvbONwtLE3k2EiYJzMtyBqEHwUz9EaLec=
code.mrmelon54.com/melon/summer v0.0.2/go.mod h1:8RztDnjYO+04/+o6pWnyv74sGH8ZkaVMrF6wAt6H9D0=
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU=
gitee.com/travelliu/dm v1.8.11192/go.mod h1:DHTzyhCrM843x9VdKVbZ+GKXGRbKM2sJ4LxihRxShkE=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
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/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/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/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
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/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/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/denisenkom/go-mssqldb v0.10.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/dustin/go-humanize v1.0.0/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/emersion/go-message v0.16.0 h1:uZLz8ClLv3V5fSFF/fFdW9jXjrZkXIpE1Fn8fKx7pO4=
github.com/emersion/go-message v0.16.0/go.mod h1:pDJDgf/xeUIF+eicT6B/hPX/ZbEorKkUMPOxrPVG2eQ=
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ=
github.com/emersion/go-sasl v0.0.0-20220912192320-0145f2c60ead h1:fI1Jck0vUrXT8bnphprS1EoVRe2Q5CKCX8iDlpqjQ/Y=
github.com/emersion/go-sasl v0.0.0-20220912192320-0145f2c60ead/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ=
github.com/emersion/go-smtp v0.16.0 h1:eB9CY9527WdEZSs5sWisTmilDX7gG+Q/2IdRcmubpa8=
github.com/emersion/go-smtp v0.16.0/go.mod h1:qm27SGYgoIPRot6ubfQ/GpiPy/g3PaZAVRxiO/sDUgQ=
github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 h1:IbFBtwoTQyw0fIM5xv1HF+Y+3ZijDR839WMulgxCcUY=
github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594/go.mod h1:aqO8z8wPrjkscevZJFVE1wXJrLpC5LtJG7fqLOsPb2U=
github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
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-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-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.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 h1:wG8n/XJQ07TmjbITcGiUaOtXxdrINDz1b0J1w0SzqDc=
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1/go.mod h1:A2S0CWkNylc2phvKXWBBdD3K0iGnDBGbzRpISP2zBl8=
github.com/goccy/go-json v0.8.1 h1:4/Wjm0JIJaTDm8K1KcGrLHJoa8EsJ13YWeX+6Kfq6uI=
github.com/goccy/go-json v0.8.1/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
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-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
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/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
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/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/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.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
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.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
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 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
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/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/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/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.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o=
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/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
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/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
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.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
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/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.7.0/go.mod h1:ZnHF+rMePVqDKaOfJVI4Q8IVvAQMryDlDkZnKOI75BE=
github.com/jackc/pgtype v1.8.0/go.mod h1:PqDKcEBtllAtk/2p6z6SHdXW5UB+MhE75tUol2OKexE=
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.11.0/go.mod h1:i62xJgdrtVDsnL3U8ekyrQXEwGNTRoG7/8r+CIdYfcc=
github.com/jackc/pgx/v4 v4.12.0/go.mod h1:fE547h6VulLPA3kySjfnSG/e2D861g/50JlVUa/ub60=
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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
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.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
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/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
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/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/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/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/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.10.2/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 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
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.9 h1:10HX2Td0ocZpYEjhilsuo6WWtUqttj2Kb0KtD86/KYA=
github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
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 h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
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/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mrmelon54/mjwt v0.0.1 h1:XgyWviTmgsbMiKXjxo+Jp/QSf7FF7/omkvrUag8/P5U=
github.com/mrmelon54/mjwt v0.0.1/go.mod h1:M+kZ6t9EArEQ2/CGjfgyNhAo542ot+S7gw5uJCK11Ms=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/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 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
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/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
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.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
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/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.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
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.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
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/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/sec51/convert v1.0.2 h1:NoKWIRARjM3rQglNypMpcXSLLqPsN/uTTzaGeqDKbeg=
github.com/sec51/convert v1.0.2/go.mod h1:5qL/cT/oiOIvWXy2SccQ7LnacYftqqy9wdyFkTc1k2w=
github.com/sec51/cryptoengine v0.0.0-20180911112225-2306d105a49e h1:HsNjVWYeVdO/zoSfNBwJOs1PuSQCSCkwqW6Lp1TtZGs=
github.com/sec51/cryptoengine v0.0.0-20180911112225-2306d105a49e/go.mod h1:g7izN9sUffTPdvcrt39y/ZephG5oJ9XizhJxxBOYDL0=
github.com/sec51/gf256 v0.0.0-20160126143050-2454accbeb9e h1:wKXba8dfsFjbxkMpzZBKt8gkJAMSm1fIf1OSWQFQrVA=
github.com/sec51/gf256 v0.0.0-20160126143050-2454accbeb9e/go.mod h1:hCjOqSOB9PBw5MdJ+0uSLCBV7FbLy0xwOR+c193HkcE=
github.com/sec51/qrcode v0.0.0-20160126144534-b7779abbcaf1 h1:CI9zS8HvMiibvXM/F3IthY797GW77fNYgioJl/8Xzzk=
github.com/sec51/qrcode v0.0.0-20160126144534-b7779abbcaf1/go.mod h1:uPm44Rj3uXSSOvmKmoeRuAUNUgwH2JHW5KIzqFFS/j4=
github.com/sec51/twofactor v1.0.0 h1:1BTbzPhyMyB0YvcWxgNxEkI7WDNsBLvR+z699YWGMC8=
github.com/sec51/twofactor v1.0.0/go.mod h1:CjtKwpvQSs9SYzLUsRH7gML+TgKeIofT8uxoy7RTLQI=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
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/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/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
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.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
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.22.2/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-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/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
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-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I=
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-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-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
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/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-20201020160332-67f06af15bc9/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-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
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-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-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/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.3.0/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/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/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/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-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-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/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-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE=
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/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
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/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/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-20190425155659-357c62f0e4bb/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-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
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.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.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
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 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
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 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
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 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
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 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
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-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
lukechampine.com/uint128 v1.1.1 h1:pnxCASz787iMf+02ssImqk6OLt+Z5QHMoZyUXR4z6JU=
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
modernc.org/cc/v3 v3.33.6/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.33.9/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.33.11/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.34.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.4/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.5/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.7/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.8/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.10/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.15/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.16/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.17/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.18 h1:rMZhRcWrba0y3nVmdiQ7kxAgOOSq2m2f2VzjHLgEs6U=
modernc.org/cc/v3 v3.35.18/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/ccgo/v3 v3.9.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60=
modernc.org/ccgo/v3 v3.10.0/go.mod h1:c0yBmkRFi7uW4J7fwx/JiijwOjeAeR2NoSaRVFPmjMw=
modernc.org/ccgo/v3 v3.11.0/go.mod h1:dGNposbDp9TOZ/1KBxghxtUp/bzErD0/0QW4hhSaBMI=
modernc.org/ccgo/v3 v3.11.1/go.mod h1:lWHxfsn13L3f7hgGsGlU28D9eUOf6y3ZYHKoPaKU0ag=
modernc.org/ccgo/v3 v3.11.3/go.mod h1:0oHunRBMBiXOKdaglfMlRPBALQqsfrCKXgw9okQ3GEw=
modernc.org/ccgo/v3 v3.12.4/go.mod h1:Bk+m6m2tsooJchP/Yk5ji56cClmN6R1cqc9o/YtbgBQ=
modernc.org/ccgo/v3 v3.12.6/go.mod h1:0Ji3ruvpFPpz+yu+1m0wk68pdr/LENABhTrDkMDWH6c=
modernc.org/ccgo/v3 v3.12.8/go.mod h1:Hq9keM4ZfjCDuDXxaHptpv9N24JhgBZmUG5q60iLgUo=
modernc.org/ccgo/v3 v3.12.11/go.mod h1:0jVcmyDwDKDGWbcrzQ+xwJjbhZruHtouiBEvDfoIsdg=
modernc.org/ccgo/v3 v3.12.14/go.mod h1:GhTu1k0YCpJSuWwtRAEHAol5W7g1/RRfS4/9hc9vF5I=
modernc.org/ccgo/v3 v3.12.18/go.mod h1:jvg/xVdWWmZACSgOiAhpWpwHWylbJaSzayCqNOJKIhs=
modernc.org/ccgo/v3 v3.12.20/go.mod h1:aKEdssiu7gVgSy/jjMastnv/q6wWGRbszbheXgWRHc8=
modernc.org/ccgo/v3 v3.12.21/go.mod h1:ydgg2tEprnyMn159ZO/N4pLBqpL7NOkJ88GT5zNU2dE=
modernc.org/ccgo/v3 v3.12.22/go.mod h1:nyDVFMmMWhMsgQw+5JH6B6o4MnZ+UQNw1pp52XYFPRk=
modernc.org/ccgo/v3 v3.12.25/go.mod h1:UaLyWI26TwyIT4+ZFNjkyTbsPsY3plAEB6E7L/vZV3w=
modernc.org/ccgo/v3 v3.12.29/go.mod h1:FXVjG7YLf9FetsS2OOYcwNhcdOLGt8S9bQ48+OP75cE=
modernc.org/ccgo/v3 v3.12.36/go.mod h1:uP3/Fiezp/Ga8onfvMLpREq+KUjUmYMxXPO8tETHtA8=
modernc.org/ccgo/v3 v3.12.38/go.mod h1:93O0G7baRST1vNj4wnZ49b1kLxt0xCW5Hsa2qRaZPqc=
modernc.org/ccgo/v3 v3.12.43/go.mod h1:k+DqGXd3o7W+inNujK15S5ZYuPoWYLpF5PYougCmthU=
modernc.org/ccgo/v3 v3.12.46/go.mod h1:UZe6EvMSqOxaJ4sznY7b23/k13R8XNlyWsO5bAmSgOE=
modernc.org/ccgo/v3 v3.12.47/go.mod h1:m8d6p0zNps187fhBwzY/ii6gxfjob1VxWb919Nk1HUk=
modernc.org/ccgo/v3 v3.12.50/go.mod h1:bu9YIwtg+HXQxBhsRDE+cJjQRuINuT9PUK4orOco/JI=
modernc.org/ccgo/v3 v3.12.51/go.mod h1:gaIIlx4YpmGO2bLye04/yeblmvWEmE4BBBls4aJXFiE=
modernc.org/ccgo/v3 v3.12.53/go.mod h1:8xWGGTFkdFEWBEsUmi+DBjwu/WLy3SSOrqEmKUjMeEg=
modernc.org/ccgo/v3 v3.12.54/go.mod h1:yANKFTm9llTFVX1FqNKHE0aMcQb1fuPJx6p8AcUx+74=
modernc.org/ccgo/v3 v3.12.55/go.mod h1:rsXiIyJi9psOwiBkplOaHye5L4MOOaCjHg1Fxkj7IeU=
modernc.org/ccgo/v3 v3.12.56/go.mod h1:ljeFks3faDseCkr60JMpeDb2GSO3TKAmrzm7q9YOcMU=
modernc.org/ccgo/v3 v3.12.57/go.mod h1:hNSF4DNVgBl8wYHpMvPqQWDQx8luqxDnNGCMM4NFNMc=
modernc.org/ccgo/v3 v3.12.60/go.mod h1:k/Nn0zdO1xHVWjPYVshDeWKqbRWIfif5dtsIOCUVMqM=
modernc.org/ccgo/v3 v3.12.65/go.mod h1:D6hQtKxPNZiY6wDBtehSGKFKmyXn53F8nGTpH+POmS4=
modernc.org/ccgo/v3 v3.12.66/go.mod h1:jUuxlCFZTUZLMV08s7B1ekHX5+LIAurKTTaugUr/EhQ=
modernc.org/ccgo/v3 v3.12.67/go.mod h1:Bll3KwKvGROizP2Xj17GEGOTrlvB1XcVaBrC90ORO84=
modernc.org/ccgo/v3 v3.12.73/go.mod h1:hngkB+nUUqzOf3iqsM48Gf1FZhY599qzVg1iX+BT3cQ=
modernc.org/ccgo/v3 v3.12.81/go.mod h1:p2A1duHoBBg1mFtYvnhAnQyI6vL0uw5PGYLSIgF6rYY=
modernc.org/ccgo/v3 v3.12.82 h1:wudcnJyjLj1aQQCXF3IM9Gz2X6UNjw+afIghzdtn0v8=
modernc.org/ccgo/v3 v3.12.82/go.mod h1:ApbflUfa5BKadjHynCficldU1ghjen84tuM5jRynB7w=
modernc.org/ccorpus v1.11.1/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ=
modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM=
modernc.org/libc v1.9.8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
modernc.org/libc v1.9.11/go.mod h1:NyF3tsA5ArIjJ83XB0JlqhjTabTCHm9aX4XMPHyQn0Q=
modernc.org/libc v1.11.0/go.mod h1:2lOfPmj7cz+g1MrPNmX65QCzVxgNq2C5o0jdLY2gAYg=
modernc.org/libc v1.11.2/go.mod h1:ioIyrl3ETkugDO3SGZ+6EOKvlP3zSOycUETe4XM4n8M=
modernc.org/libc v1.11.5/go.mod h1:k3HDCP95A6U111Q5TmG3nAyUcp3kR5YFZTeDS9v8vSU=
modernc.org/libc v1.11.6/go.mod h1:ddqmzR6p5i4jIGK1d/EiSw97LBcE3dK24QEwCFvgNgE=
modernc.org/libc v1.11.11/go.mod h1:lXEp9QOOk4qAYOtL3BmMve99S5Owz7Qyowzvg6LiZso=
modernc.org/libc v1.11.13/go.mod h1:ZYawJWlXIzXy2Pzghaf7YfM8OKacP3eZQI81PDLFdY8=
modernc.org/libc v1.11.16/go.mod h1:+DJquzYi+DMRUtWI1YNxrlQO6TcA5+dRRiq8HWBWRC8=
modernc.org/libc v1.11.19/go.mod h1:e0dgEame6mkydy19KKaVPBeEnyJB4LGNb0bBH1EtQ3I=
modernc.org/libc v1.11.24/go.mod h1:FOSzE0UwookyT1TtCJrRkvsOrX2k38HoInhw+cSCUGk=
modernc.org/libc v1.11.26/go.mod h1:SFjnYi9OSd2W7f4ct622o/PAYqk7KHv6GS8NZULIjKY=
modernc.org/libc v1.11.27/go.mod h1:zmWm6kcFXt/jpzeCgfvUNswM0qke8qVwxqZrnddlDiE=
modernc.org/libc v1.11.28/go.mod h1:Ii4V0fTFcbq3qrv3CNn+OGHAvzqMBvC7dBNyC4vHZlg=
modernc.org/libc v1.11.31/go.mod h1:FpBncUkEAtopRNJj8aRo29qUiyx5AvAlAxzlx9GNaVM=
modernc.org/libc v1.11.34/go.mod h1:+Tzc4hnb1iaX/SKAutJmfzES6awxfU1BPvrrJO0pYLg=
modernc.org/libc v1.11.37/go.mod h1:dCQebOwoO1046yTrfUE5nX1f3YpGZQKNcITUYWlrAWo=
modernc.org/libc v1.11.39/go.mod h1:mV8lJMo2S5A31uD0k1cMu7vrJbSA3J3waQJxpV4iqx8=
modernc.org/libc v1.11.42/go.mod h1:yzrLDU+sSjLE+D4bIhS7q1L5UwXDOw99PLSX0BlZvSQ=
modernc.org/libc v1.11.44/go.mod h1:KFq33jsma7F5WXiYelU8quMJasCCTnHK0mkri4yPHgA=
modernc.org/libc v1.11.45/go.mod h1:Y192orvfVQQYFzCNsn+Xt0Hxt4DiO4USpLNXBlXg/tM=
modernc.org/libc v1.11.47/go.mod h1:tPkE4PzCTW27E6AIKIR5IwHAQKCAtudEIeAV1/SiyBg=
modernc.org/libc v1.11.49/go.mod h1:9JrJuK5WTtoTWIFQ7QjX2Mb/bagYdZdscI3xrvHbXjE=
modernc.org/libc v1.11.51/go.mod h1:R9I8u9TS+meaWLdbfQhq2kFknTW0O3aw3kEMqDDxMaM=
modernc.org/libc v1.11.53/go.mod h1:5ip5vWYPAoMulkQ5XlSJTy12Sz5U6blOQiYasilVPsU=
modernc.org/libc v1.11.54/go.mod h1:S/FVnskbzVUrjfBqlGFIPA5m7UwB3n9fojHhCNfSsnw=
modernc.org/libc v1.11.55/go.mod h1:j2A5YBRm6HjNkoSs/fzZrSxCuwWqcMYTDPLNx0URn3M=
modernc.org/libc v1.11.56/go.mod h1:pakHkg5JdMLt2OgRadpPOTnyRXm/uzu+Yyg/LSLdi18=
modernc.org/libc v1.11.58/go.mod h1:ns94Rxv0OWyoQrDqMFfWwka2BcaF6/61CqJRK9LP7S8=
modernc.org/libc v1.11.70/go.mod h1:DUOmMYe+IvKi9n6Mycyx3DbjfzSKrdr/0Vgt3j7P5gw=
modernc.org/libc v1.11.71/go.mod h1:DUOmMYe+IvKi9n6Mycyx3DbjfzSKrdr/0Vgt3j7P5gw=
modernc.org/libc v1.11.75/go.mod h1:dGRVugT6edz361wmD9gk6ax1AbDSe0x5vji0dGJiPT0=
modernc.org/libc v1.11.82/go.mod h1:NF+Ek1BOl2jeC7lw3a7Jj5PWyHPwWD4aq3wVKxqV1fI=
modernc.org/libc v1.11.86/go.mod h1:ePuYgoQLmvxdNT06RpGnaDKJmDNEkV7ZPKI2jnsvZoE=
modernc.org/libc v1.11.87 h1:PzIzOqtlzMDDcCzJ5cUP6h/Ku6Fa9iyflP2ccTY64aE=
modernc.org/libc v1.11.87/go.mod h1:Qvd5iXTeLhI5PS0XSyqMY99282y+3euapQFxM7jYnpY=
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/mathutil v1.4.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/mathutil v1.4.1 h1:ij3fYGe8zBF4Vu+g0oT7mB06r8sqGWKuJu1yXeR4by8=
modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc=
modernc.org/memory v1.0.5 h1:XRch8trV7GgvTec2i7jc33YlUI0RKVDBvZ5eZ5m8y14=
modernc.org/memory v1.0.5/go.mod h1:B7OYswTRnfGg+4tDH1t1OeUNnsy2viGTdME4tzd+IjM=
modernc.org/opt v0.1.1 h1:/0RX92k9vwVeDXj+Xn23DKp2VJubL7k8qNffND6qn3A=
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/sqlite v1.14.2 h1:ohsW2+e+Qe2To1W6GNezzKGwjXwSax6R+CrhRxVaFbE=
modernc.org/sqlite v1.14.2/go.mod h1:yqfn85u8wVOE6ub5UT8VI9JjhrwBUUCNyTACN0h6Sx8=
modernc.org/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs=
modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw=
modernc.org/tcl v1.8.13/go.mod h1:V+q/Ef0IJaNUSECieLU4o+8IScapxnMyFV6i/7uQlAY=
modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk=
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
modernc.org/z v1.2.19/go.mod h1:+ZpP0pc4zz97eukOzW3xagV/lS82IpPN9NGG5pNF9vY=
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=
xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978 h1:bvLlAPW1ZMTWA32LuZMBEGHAUOcATZjzHcotf3SWweM=
xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
xorm.io/xorm v1.3.2 h1:uTRRKF2jYzbZ5nsofXVUx6ncMaek+SHjWYtCXyZo1oM=
xorm.io/xorm v1.3.2/go.mod h1:9NbjqdnjX6eyjRRhh01GHm64r6N9shTb/8Ak3YRt8Nw=

View File

@ -0,0 +1,75 @@
package login_checker
import (
"code.mrmelon54.com/melon/summer/pkg/api"
"code.mrmelon54.com/melon/summer/pkg/claims/auth"
"code.mrmelon54.com/melon/summer/pkg/tables/user"
"code.mrmelon54.com/melon/summer/pkg/utils"
"errors"
"github.com/mrmelon54/mjwt"
"net/http"
"net/url"
"xorm.io/xorm"
)
type LoginChecker struct {
db *xorm.Engine
signer mjwt.Provider
loginSite url.URL
mfaLoginSite url.URL
}
func NewLoginChecker(db *xorm.Engine, signer mjwt.Provider) *LoginChecker {
return &LoginChecker{
db: db,
signer: signer,
loginSite: url.URL{Path: "/login"},
mfaLoginSite: url.URL{Path: "/mfa"},
}
}
func (lc *LoginChecker) GetUserID(req *http.Request) (uint64, error) {
token := utils.GetBearerToken(req)
if token == "" {
return 0, errors.New("access token missing")
}
// Verify as access token
_, b, err := mjwt.ExtractClaims[auth.AccessTokenClaims](lc.signer, token)
if err != nil {
return 0, err
}
var u user.User
get, err := lc.db.Where("id = ?", b.Claims.UserId).Get(&u)
if err != nil {
return 0, err
}
if !utils.SBool(u.EmailVerified) {
return 0, errors.New("requires email verification")
}
if !utils.SBool(u.MfaActive) {
return 0, errors.New("requires MFA")
}
if get {
return u.Id, nil
}
return 0, errors.New("failed login check")
}
func (lc *LoginChecker) CheckRequired(rw http.ResponseWriter, req *http.Request, cbGood func(uint64)) {
userId, err := lc.GetUserID(req)
if api.GenericErrorMsg[LoginChecker](rw, err, http.StatusUnauthorized, "Token Not Valid") {
return
}
cbGood(userId)
}
func (lc *LoginChecker) CheckOptional(rw http.ResponseWriter, req *http.Request, cbGood func(uint64), cbBad func(uint64)) {
userId, err := lc.GetUserID(req)
if err != nil {
cbBad(0)
return
}
cbGood(userId)
}

129
mailer/mailer.go Normal file
View File

@ -0,0 +1,129 @@
package mailer
import (
"bytes"
"crypto/tls"
"crypto/x509"
"errors"
"fmt"
"github.com/emersion/go-message"
"github.com/emersion/go-sasl"
"github.com/emersion/go-smtp"
"io"
"os"
"strings"
)
type Mailer struct {
auth sasl.Client
conf SmtpConfig
pool *x509.CertPool
}
func NewMailer(conf SmtpConfig) (*Mailer, error) {
var pool *x509.CertPool = nil
if conf.Cert != "" {
pool = x509.NewCertPool()
open, err := os.Open(conf.Cert)
if err != nil {
return nil, err
}
all, err := io.ReadAll(open)
if err != nil {
return nil, err
}
if !pool.AppendCertsFromPEM(all) {
return nil, errors.New("invalid SMTP certificate")
}
}
return &Mailer{
auth: sasl.NewPlainClient("", conf.Username, conf.Password),
conf: conf,
pool: pool,
}, nil
}
func (m *Mailer) MailHtml(subject string, to []string, body io.Reader) error {
h := message.Header{}
h.SetContentType("multipart/alternative", nil)
h.SetText("From", m.conf.From)
h.SetText("To", strings.Join(to, ", "))
h.SetText("Subject", subject)
h.SetText("MIME-version", "1.0")
msg := new(bytes.Buffer)
w, err := message.CreateWriter(msg, h)
if err != nil {
return fmt.Errorf("failed to create message writer: %w", err)
}
h2 := message.Header{}
h2.SetContentType("text/html", map[string]string{"charset": "UTF-8"})
part, err := w.CreatePart(h2)
if err != nil {
return fmt.Errorf("failed to create part: %w", err)
}
_, err = io.Copy(part, body)
if err != nil {
return fmt.Errorf("failed to copy body into part: %w", err)
}
err = part.Close()
if err != nil {
return fmt.Errorf("failed to close part: %w", err)
}
err = w.Close()
if err != nil {
return fmt.Errorf("failed to close message writer: %w", err)
}
return m.sendMail(to, msg)
}
func (m *Mailer) sendMail(to []string, body io.Reader) error {
var err error
var client *smtp.Client
if m.conf.Tls {
client, err = smtp.DialTLS(m.conf.Server, &tls.Config{RootCAs: m.pool})
if err != nil {
return fmt.Errorf("failed to dial tls: %w", err)
}
} else {
client, err = smtp.Dial(m.conf.Server)
if err != nil {
return fmt.Errorf("failed to dial: %w", err)
}
}
if m.conf.StartTls {
if ok, _ := client.Extension("STARTTLS"); ok {
if err = client.StartTLS(nil); err != nil {
return fmt.Errorf("failed to start tls: %w", err)
}
}
}
if err = client.Auth(m.auth); err != nil {
return fmt.Errorf("failed to add auth: %w", err)
}
if err = client.Mail(m.conf.Username, nil); err != nil {
return fmt.Errorf("failed to start mail: %w", err)
}
for _, i := range to {
if err = client.Rcpt(i); err != nil {
return fmt.Errorf("failed to add recipient: %w", err)
}
}
wc, err := client.Data()
if err != nil {
return fmt.Errorf("failed to start mail data: %w", err)
}
if _, err = io.Copy(wc, body); err != nil {
return fmt.Errorf("failed to : %w", err)
}
if err = wc.Close(); err != nil {
return fmt.Errorf("failed to close: %w", err)
}
if err = client.Quit(); err != nil {
return fmt.Errorf("failed to quit: %w", err)
}
return nil
}

11
mailer/smtp-config.go Normal file
View File

@ -0,0 +1,11 @@
package mailer
type SmtpConfig struct {
Cert string `yaml:"certificate"`
StartTls bool `yaml:"startTls"`
Tls bool `yaml:"tls"`
Server string `yaml:"server"`
From string `yaml:"from"`
Username string `yaml:"username"`
Password string `yaml:"password"`
}

23
notifier/notifier.go Normal file
View File

@ -0,0 +1,23 @@
package notifier
import "errors"
var ErrInvalidNotifierType = errors.New("invalid notifier type")
type Notifier interface {
SendMessage(s string)
}
type Config struct {
Type string `yaml:"type"`
Token string `yaml:"token"` // the token used to log in to the bot
Target string `yaml:"target"` // the target chat or user to send updates to
}
func Init(conf Config) (Notifier, error) {
switch conf.Type {
case "telegram":
return newTelegram(conf.Token, conf.Target)
}
return nil, ErrInvalidNotifierType
}

31
notifier/telegram.go Normal file
View File

@ -0,0 +1,31 @@
package notifier
import (
tgBotApi5 "github.com/go-telegram-bot-api/telegram-bot-api/v5"
"log"
"strconv"
)
type Telegram struct {
bot *tgBotApi5.BotAPI
chatId int64
}
func newTelegram(token, chat string) (*Telegram, error) {
bot, err := tgBotApi5.NewBotAPI(token)
if err != nil {
return nil, err
}
chatId, err := strconv.ParseInt(chat, 10, 64)
if err != nil {
return nil, err
}
return &Telegram{bot: bot, chatId: chatId}, nil
}
func (t *Telegram) SendMessage(s string) {
_, err := t.bot.Send(tgBotApi5.NewMessage(t.chatId, s))
if err != nil {
log.Printf("[Notifier:Telegram] Failed to send message: %s\n", err)
}
}

View File

@ -0,0 +1,51 @@
package certificate
import (
"code.mrmelon54.com/melon/certgen"
"code.mrmelon54.com/melon/summer/pkg/utils"
"crypto/tls"
"github.com/pkg/errors"
"time"
)
type CertificateData struct {
DataId uint64 `xorm:"pk autoincr"`
MetaId uint64
PreviousCert uint64
CertificateBytes []byte
KeyBytes []byte
NotAfter time.Time
CreatedAt time.Time `xorm:"created"`
UpdatedAt time.Time `xorm:"updated"`
Ready *bool
}
func (c *CertificateData) SortOutDefaultValues() {
if c.CertificateBytes == nil {
c.CertificateBytes = make([]byte, 0)
}
if c.KeyBytes == nil {
c.KeyBytes = make([]byte, 0)
}
if c.Ready == nil {
c.Ready = utils.PBool(false)
}
}
func (c *CertificateData) GetCertificate() (*tls.Certificate, error) {
cert, err := tls.X509KeyPair(c.CertificateBytes, c.KeyBytes)
return &cert, err
}
func (c *CertificateData) UpdateNotAfter() error {
certBase, err := c.GetCertificate()
if err != nil {
return errors.Errorf("Invalid certificate: %s", err)
}
certLeaf := certgen.TlsLeaf(certBase)
if certLeaf == nil {
return errors.Errorf("Failed to get leaf for certificate")
}
c.NotAfter = certLeaf.NotAfter
return nil
}

View File

@ -0,0 +1,8 @@
package certificate
type CertificateDomain struct {
DomainId uint64 `xorm:"pk autoincr"`
CertId uint64
Domain string
Wildcard *bool
}

View File

@ -0,0 +1,76 @@
package certificate
import (
"code.mrmelon54.com/melon/summer/pkg/utils"
"github.com/pkg/errors"
"xorm.io/xorm"
)
var ErrFailedToGetCertificate = errors.New("failed to get certificate")
type Certificate struct {
Id uint64 `xorm:"pk autoincr"`
Owner uint64
LetsEncrypt uint64
Namesilo uint64
AutoRenew *bool
Active *bool
Renewing *bool
RenewFailed *bool
}
func (c *Certificate) SortOutDefaultValues() {
if c.Active == nil {
c.Active = utils.PBool(false)
}
if c.Renewing == nil {
c.Renewing = utils.PBool(false)
}
if c.RenewFailed == nil {
c.RenewFailed = utils.PBool(false)
}
}
//goland:noinspection GoNameStartsWithPackageName
type CertificateMetaDomainJoiner struct {
Certificate `xorm:"extends"`
CertificateData `xorm:"extends"`
CertificateDomain `xorm:"extends"`
}
func (c *CertificateMetaDomainJoiner) TableName() string { return "certificate" }
func (c *CertificateMetaDomainJoiner) SortOutDefaultValues() {
c.Certificate.SortOutDefaultValues()
c.CertificateData.SortOutDefaultValues()
}
func GetCertForDomain(db *xorm.Engine, a string) (*CertificateMetaDomainJoiner, error) {
b, ok := utils.GetBaseDomain(a)
if !ok {
return nil, errors.New("no idea what domain name you are using")
}
// Time for a massive SQL query
var c []CertificateMetaDomainJoiner
//goland:noinspection SqlDialectInspection,SqlNoDataSourceInspection
err := db.SQL(`
select * from certificate
inner join certificate_data on id = meta_id and ready = 1 and not_after > now()
inner join certificate_domain on id = cert_id
where (domain = ? and wildcard = 0) or (domain = ? and wildcard = 1) and active = 1
order by ready DESC, wildcard ASC, not_after DESC
limit 1
`, a, b).Find(&c)
if err != nil {
return nil, err
}
if len(c) < 1 {
return nil, ErrFailedToGetCertificate
}
// If there is at least 1 certificate then use for first and ignore the rest
d := c[0]
d.SortOutDefaultValues()
return &d, nil
}

35
tables/oauth/app.go Normal file
View File

@ -0,0 +1,35 @@
package oauth
import "code.mrmelon54.com/melon/summer/pkg/utils"
type App struct {
AppId uint64 `json:"id" xorm:"pk autoincr"`
UserId uint64 `json:"user_id"`
Secret string `json:"-"`
Enabled *bool `json:"enabled"`
AppName string `json:"app_name"`
AppDesc string `json:"app_desc"`
AppIcon string `json:"app_icon"`
Privacy string `json:"privacy"`
Terms string `json:"terms"`
}
func (c App) TableName() string {
return "oauth_app"
}
func (c App) GetId() uint64 {
return c.AppId
}
func (c App) SetEnabled(v bool) App {
c.Enabled = utils.PBool(v)
return c
}
func (c App) ClearForNew() App {
c.AppId = 0
c.UserId = 0
c.Secret = ""
return c
}

11
tables/oauth/domain.go Normal file
View File

@ -0,0 +1,11 @@
package oauth
type Domain struct {
DomainId uint64 `xorm:"pk autoincr"`
AppId uint64
Domain string
}
func (d Domain) TableName() string {
return "oauth_domain"
}

30
tables/oauth/namespace.go Normal file
View File

@ -0,0 +1,30 @@
package oauth
import (
"code.mrmelon54.com/melon/summer/pkg/utils"
"net/http"
"xorm.io/xorm"
)
type AuthNamespace struct {
Id uint64 `xorm:"pk autoincr"`
BaseDomain string
AuthDomain string
WebsiteTitle string
}
func GetNamespaceByDomain(db *xorm.Engine, h string) (AuthNamespace, bool) {
var n AuthNamespace
b, err := db.Where("base_domain = ? or auth_domain = ?", h, h).Get(&n)
if err == nil && b {
return n, true
}
return AuthNamespace{}, false
}
func GetNamespaceByRequest(db *xorm.Engine, req *http.Request) (AuthNamespace, bool) {
if domain, ok := utils.GetDomainWithoutPort(req.Host); ok {
return GetNamespaceByDomain(db, domain)
}
return AuthNamespace{}, false
}

View File

@ -0,0 +1,8 @@
package renewal
type AcmeContent struct {
Id uint64 `xorm:"pk autoincr"`
Domain string
Key string
Content string
}

View File

@ -0,0 +1,24 @@
package renewal
import (
"crypto/rsa"
"crypto/x509"
"encoding/pem"
)
type LetsEncryptAccount struct {
Id uint64 `xorm:"pk autoincr"`
Email string
PrivateKey []byte
}
func (e *LetsEncryptAccount) SortOutDefaultValues() {
if e.PrivateKey == nil {
e.PrivateKey = make([]byte, 0)
}
}
func (e *LetsEncryptAccount) GetKeyObject() (*rsa.PrivateKey, error) {
letsEncryptPemBlock, _ := pem.Decode(e.PrivateKey)
return x509.ParsePKCS1PrivateKey(letsEncryptPemBlock.Bytes)
}

View File

@ -0,0 +1,7 @@
package renewal
type NamesiloAccount struct {
Id uint64 `xorm:"pk autoincr"`
Email string // literally just need a description
Token string
}

39
tables/user/perm.go Normal file
View File

@ -0,0 +1,39 @@
package user
import (
"code.mrmelon54.com/melon/summer/pkg/claims"
"code.mrmelon54.com/melon/summer/pkg/utils"
)
type Perm struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
Key string `json:"key"`
Name string `json:"name"`
Desc string `json:"desc"`
Visible *bool `json:"visible"`
Enabled *bool `json:"enabled"`
IsPerm *bool `json:"isPerm"`
IsScope *bool `json:"isScope"`
}
func (p Perm) GetId() uint64 {
return p.Id
}
func (p Perm) SetEnabled(v bool) Perm {
p.Enabled = utils.PBool(v)
return p
}
func (p Perm) ClearForNew() Perm {
p.Id = 0
return p
}
func CheckSpecificPerms(storage *claims.PermStorage, v []string) []bool {
z := make([]bool, len(v))
for i := range v {
z[i] = storage.Has(v[i])
}
return z
}

11
tables/user/user-perm.go Normal file
View File

@ -0,0 +1,11 @@
package user
type LinkUserPerm struct {
UserId uint64 `json:"user_id"`
PermId uint64 `json:"perm_id"`
}
type ExtendUserPerm struct {
User User `xorm:"extends"`
Perm Perm `xorm:"extends"`
}

132
tables/user/user.go Normal file
View File

@ -0,0 +1,132 @@
package user
import (
"code.mrmelon54.com/melon/summer/pkg/utils"
"github.com/sec51/twofactor"
"time"
)
type ProfileVisibility byte
const (
ProfileVisibilityPrivate = ProfileVisibility(iota)
ProfileVisibilityFriends
ProfileVisibilityPublic
)
func ParseVisibility(a *byte) ProfileVisibility {
b := ProfileVisibility(utils.SByte(a))
if b > ProfileVisibilityPublic {
return ProfileVisibilityPrivate
}
return b
}
func (v ProfileVisibility) AsByte() *byte {
return utils.PByte(byte(v))
}
type ProfilePronouns byte
const (
ProfilePronounsUnknown = ProfilePronouns(iota)
ProfilePronounsHeHim
ProfilePronounsSheHer
ProfilePronounsTheyThem
)
func ParsePronouns(a *byte) ProfilePronouns {
b := ProfilePronouns(utils.SByte(a))
if b > ProfilePronounsTheyThem {
return ProfilePronounsUnknown
}
return b
}
func (p ProfilePronouns) AsByte() *byte {
return utils.PByte(byte(p))
}
type User struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
Email string `json:"email"`
Username string `json:"username"`
Password string `json:"-"`
Visibility *byte `json:"visibility" xorm:"unsigned tinyint(3)"`
Gender *string `json:"gender"`
Pronouns *byte `json:"pronouns" xorm:"unsigned tinyint(3)"`
Birthday time.Time `json:"birthday"`
DisplayName string `json:"display_name"`
Created time.Time `json:"created"`
LastOnline time.Time `json:"last_online"`
Icon string `json:"icon"`
MfaActive *bool `json:"-"`
MfaBytes []byte `json:"-"`
MfaObj *twofactor.Totp `json:"-" xorm:"-"`
EmailVerified *bool `json:"email_verified"`
EmailToken string `json:"-"`
EnableRefresh *bool `json:"-"`
Enabled *bool `json:"enabled"`
}
func (u User) GetId() uint64 {
return u.Id
}
func (u User) SetEnabled(v bool) User {
u.Enabled = utils.PBool(v)
return u
}
func (u User) ClearForNew() User {
u.Id = 0
return u
}
func (u User) ClearForPut() User {
return User{
Id: 0,
Email: "",
Username: "",
Password: "",
Visibility: u.Visibility,
Gender: u.Gender,
Pronouns: u.Pronouns,
Birthday: u.Birthday,
DisplayName: u.DisplayName,
Created: time.Time{},
LastOnline: time.Time{},
Icon: u.Icon,
MfaActive: nil,
MfaBytes: nil,
MfaObj: nil,
EmailVerified: nil,
EmailToken: "",
EnableRefresh: nil,
Enabled: nil,
}
}
func (u User) ClearForAdminPut() User {
return User{
Id: 0,
Email: "",
Username: "",
Password: "",
Visibility: nil,
Gender: nil,
Pronouns: nil,
Birthday: time.Time{},
DisplayName: "",
Created: time.Time{},
LastOnline: time.Time{},
Icon: "",
MfaActive: nil,
MfaBytes: nil,
MfaObj: nil,
EmailVerified: nil,
EmailToken: "",
EnableRefresh: u.EnableRefresh,
Enabled: u.Enabled,
}
}

27
tables/web/api-domain.go Normal file
View File

@ -0,0 +1,27 @@
package web
import (
"code.mrmelon54.com/melon/summer/pkg/utils"
)
type ApiDomain struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
Domain string `json:"domain"`
DstHome string `json:"dst_home"`
Enabled *bool `json:"enabled"`
LiveRoutes []ApiRoute `json:"-" xorm:"-"`
}
func (a ApiDomain) GetId() uint64 {
return a.Id
}
func (a ApiDomain) SetEnabled(v bool) ApiDomain {
a.Enabled = utils.PBool(v)
return a
}
func (a ApiDomain) ClearForNew() ApiDomain {
a.Id = 0
return a
}

34
tables/web/api-route.go Normal file
View File

@ -0,0 +1,34 @@
package web
import (
"code.mrmelon54.com/melon/summer/pkg/utils"
"net/http"
)
type ApiRoute struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
DomainId uint64 `json:"domain_id"`
Version uint64 `json:"version"`
Route string `json:"route"`
Dst string `json:"dst"`
SecureMode *bool `json:"secure_mode,omitempty"`
IgnoreCert *bool `json:"ignore_cert,omitempty"`
Enabled *bool `json:"enabled"`
}
func (a ApiRoute) GetId() uint64 { return a.Id }
func (a ApiRoute) SetEnabled(v bool) ApiRoute {
a.Enabled = utils.PBool(v)
return a
}
func (a ApiRoute) ClearForNew() ApiRoute {
a.Id = 0
return a
}
func (a ApiRoute) IsSecureMode() bool { return utils.SBool(a.SecureMode) }
func (a ApiRoute) IsIgnoreCert() bool { return utils.SBool(a.IgnoreCert) }
func (a ApiRoute) UpdateHeaders(_ http.Header) {} // purposefully a stub

6
tables/web/domain.go Normal file
View File

@ -0,0 +1,6 @@
package web
type Domain struct {
Id uint64 `xorm:"pk autoincr"`
Domain string
}

View File

@ -0,0 +1,7 @@
package web
type HttpDefaultHost struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
Key string `json:"key"`
Dst string `json:"dst"`
}

View File

@ -0,0 +1,9 @@
package web
type HttpFavicon struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
Host string `json:"host"`
Ico string `json:"ico"` // auto convert from png if present
Png string `json:"png"` // auto convert from svg if present
Svg string `json:"svg"` // can't be auto converted
}

View File

@ -0,0 +1,26 @@
package web
import (
"code.mrmelon54.com/melon/summer/pkg/utils"
)
type HttpRedirect struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
Src string `json:"address"`
Target string `json:"target"`
Enabled *bool `json:"enabled"`
}
func (h HttpRedirect) GetId() uint64 {
return h.Id
}
func (h HttpRedirect) SetEnabled(v bool) HttpRedirect {
h.Enabled = utils.PBool(v)
return h
}
func (h HttpRedirect) ClearForNew() HttpRedirect {
h.Id = 0
return h
}

View File

@ -0,0 +1,13 @@
package web
import "code.mrmelon54.com/melon/summer/pkg/utils"
type HttpRouteHeader struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
RouteId uint64 `json:"route_id"`
Key string `json:"key"`
Value *string `json:"value"`
}
func (h HttpRouteHeader) HeaderKey() string { return h.Key }
func (h HttpRouteHeader) HeaderValue() string { return utils.SString(h.Value) }

49
tables/web/http-route.go Normal file
View File

@ -0,0 +1,49 @@
package web
import (
"code.mrmelon54.com/melon/summer/pkg/utils"
"net/http"
)
type HttpRoute struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
Src string `json:"src"`
Dst string `json:"dst"`
AbsPath *bool `json:"abs_path"`
SecureMode *bool `json:"secure_mode,omitempty"`
IgnoreCert *bool `json:"ignore_cert,omitempty"`
ForwardHost *bool `json:"forward_host,omitempty"`
Enabled *bool `json:"enabled"`
LiveHeaders []HttpRouteHeader `json:"-" xorm:"-"`
}
func (h HttpRoute) GetId() uint64 { return h.Id }
func (h HttpRoute) SetEnabled(v bool) HttpRoute {
h.Enabled = utils.PBool(v)
return h
}
func (h HttpRoute) ClearForNew() HttpRoute {
h.Id = 0
return h
}
func (h HttpRoute) Target() string { return h.Dst }
func (h HttpRoute) IsAbsPath() bool { return utils.SBool(h.AbsPath) }
func (h HttpRoute) IsSecureMode() bool { return utils.SBool(h.SecureMode) }
func (h HttpRoute) IsIgnoreCert() bool { return utils.SBool(h.IgnoreCert) }
func (h HttpRoute) IsForwardHost() bool { return utils.SBool(h.ForwardHost) }
func (h HttpRoute) UpdateHeaders(header http.Header) {
if h.LiveHeaders == nil {
return
}
for _, i := range h.LiveHeaders {
if a := i.HeaderValue(); a != "" {
header.Set(i.HeaderKey(), a)
} else {
header.Del(i.HeaderKey())
}
}
}

View File

@ -0,0 +1,13 @@
package web
import "code.mrmelon54.com/melon/summer/pkg/utils"
type HttpServiceHeader struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
ServiceId uint64 `json:"service_id"`
Key string `json:"key"`
Value *string `json:"value"`
}
func (h HttpServiceHeader) HeaderKey() string { return h.Key }
func (h HttpServiceHeader) HeaderValue() string { return utils.SString(h.Value) }

View File

@ -0,0 +1,49 @@
package web
import (
"code.mrmelon54.com/melon/summer/pkg/utils"
"net/http"
)
type HttpService struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
Host string `json:"host"`
Dst string `json:"dst"`
AbsPath *bool `json:"abs_path,omitempty"`
SecureMode *bool `json:"secure_mode,omitempty"`
IgnoreCert *bool `json:"ignore_cert,omitempty"`
ForwardHost *bool `json:"forward_host,omitempty"`
Enabled *bool `json:"enabled"`
LiveHeaders []HttpServiceHeader `json:"-" xorm:"-"`
}
func (h HttpService) GetId() uint64 { return h.Id }
func (h HttpService) SetEnabled(v bool) HttpService {
h.Enabled = utils.PBool(v)
return h
}
func (h HttpService) ClearForNew() HttpService {
h.Id = 0
return h
}
func (h HttpService) Target() string { return h.Dst }
func (h HttpService) IsAbsPath() bool { return utils.SBool(h.AbsPath) }
func (h HttpService) IsSecureMode() bool { return utils.SBool(h.SecureMode) }
func (h HttpService) IsIgnoreCert() bool { return utils.SBool(h.IgnoreCert) }
func (h HttpService) IsForwardHost() bool { return utils.SBool(h.ForwardHost) }
func (h HttpService) UpdateHeaders(header http.Header) {
if h.LiveHeaders == nil {
return
}
for _, i := range h.LiveHeaders {
if a := i.Value; a != nil && *a != "" {
header.Set(i.Key, *a)
} else {
header.Del(i.Key)
}
}
}

View File

@ -0,0 +1,24 @@
package web
import "code.mrmelon54.com/melon/summer/pkg/utils"
type TcpRedirect struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
Port int `json:"port"`
Target string `json:"target"`
Enabled *bool `json:"enabled"`
}
func (t TcpRedirect) GetId() uint64 {
return t.Id
}
func (t TcpRedirect) SetEnabled(v bool) TcpRedirect {
t.Enabled = utils.PBool(v)
return t
}
func (t TcpRedirect) ClearForNew() TcpRedirect {
t.Id = 0
return t
}

View File

@ -0,0 +1,24 @@
package web
import "code.mrmelon54.com/melon/summer/pkg/utils"
type UdpRedirect struct {
Id uint64 `json:"id" xorm:"pk autoincr"`
Port int `json:"port"`
Target string `json:"target"`
Enabled *bool `json:"enabled"`
}
func (u UdpRedirect) GetId() uint64 {
return u.Id
}
func (u UdpRedirect) SetEnabled(v bool) UdpRedirect {
u.Enabled = utils.PBool(v)
return u
}
func (u UdpRedirect) ClearForNew() UdpRedirect {
u.Id = 0
return u
}

6
utils/build-info.go Normal file
View File

@ -0,0 +1,6 @@
package utils
var (
BuildVersion = ""
BuildDate = ""
)

67
utils/cert-cache.go Normal file
View File

@ -0,0 +1,67 @@
package utils
import (
"crypto/tls"
"sync"
"time"
)
type CertCache struct {
syncLock *sync.RWMutex
certs map[string]*certCacheItem
}
func NewCertCache() *CertCache {
return &CertCache{&sync.RWMutex{}, make(map[string]*certCacheItem)}
}
func (cc *CertCache) Put(domain string, cert *tls.Certificate) {
cc.syncLock.Lock()
a, ok := cc.certs[domain]
if ok {
a.tick.Stop()
close(a.end)
delete(cc.certs, domain)
}
// Set up a ticker and timeout value
i := &certCacheItem{cert, time.NewTicker(time.Minute * 10), make(chan struct{})}
go cc.internalItemTick(domain, i)
cc.certs[domain] = i
cc.syncLock.Unlock()
}
func (cc *CertCache) Get(domain string) (*tls.Certificate, bool) {
cc.syncLock.RLock()
c, ok := cc.certs[domain]
cc.syncLock.RUnlock()
if ok {
return c.cert, ok
}
return nil, false
}
func (cc *CertCache) Del(domain string) {
cc.syncLock.Lock()
a, ok := cc.certs[domain]
if ok {
a.tick.Stop()
close(a.end)
}
delete(cc.certs, domain)
cc.syncLock.Unlock()
}
func (cc *CertCache) internalItemTick(domain string, item *certCacheItem) {
select {
case <-item.tick.C:
cc.Del(domain)
case <-item.end:
}
}
type certCacheItem struct {
cert *tls.Certificate
tick *time.Ticker
end chan struct{}
}

9
utils/check.go Normal file
View File

@ -0,0 +1,9 @@
package utils
import "log"
func Check(msg string, err error) {
if err != nil {
log.Fatalln(msg, err)
}
}

7
utils/debug/debug.go Normal file
View File

@ -0,0 +1,7 @@
//go:build DEBUG
package debug
func IsDebug() bool {
return true
}

7
utils/debug/normal.go Normal file
View File

@ -0,0 +1,7 @@
//go:build !DEBUG
package debug
func IsDebug() bool {
return false
}

61
utils/domain-utils.go Normal file
View File

@ -0,0 +1,61 @@
package utils
import (
"fmt"
"strings"
)
func SplitDomainPort(host string, defaultPort uint16) (domain string, port uint16, ok bool) {
a := strings.SplitN(host, ":", 2)
switch len(a) {
case 2:
domain = a[0]
_, err := fmt.Sscanf(a[1], "%d", &port)
ok = err == nil
case 1:
domain = a[0]
port = defaultPort
ok = true
}
return
}
func GetDomainWithoutPort(domain string) (string, bool) {
a := strings.SplitN(domain, ":", 2)
if len(a) == 2 {
return a[0], true
}
if len(a) == 0 {
return "", false
}
return a[0], true
}
func ReplaceSubdomainWithWildcard(domain string) (string, bool) {
a, b := GetBaseDomain(domain)
return "*." + a, b
}
func GetBaseDomain(domain string) (string, bool) {
a := strings.SplitN(domain, ".", 2)
l := len(a)
if l == 2 {
return a[1], true
}
if l == 1 {
return a[0], true
}
return "", false
}
func GetTopFqdn(domain string) (string, bool) {
a := strings.Split(domain, ".")
l := len(a)
if l >= 2 {
return strings.Join(a[l-2:], "."), true
}
if l == 1 {
return domain, true
}
return "", false
}

View File

@ -0,0 +1,58 @@
package utils
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestSplitDomainPort(t *testing.T) {
domain, port, ok := SplitDomainPort("www.example.com:5612", 443)
assert.True(t, ok, "Output should be true")
assert.Equal(t, "www.example.com", domain)
assert.Equal(t, uint16(5612), port)
domain, port, ok = SplitDomainPort("example.com", 443)
assert.True(t, ok, "Output should be true")
assert.Equal(t, "example.com", domain)
assert.Equal(t, uint16(443), port)
}
func TestDomainWithoutPort(t *testing.T) {
domain, ok := GetDomainWithoutPort("www.example.com:5612")
assert.True(t, ok, "Output should be true")
assert.Equal(t, "www.example.com", domain)
domain, ok = GetDomainWithoutPort("example.com:443")
assert.True(t, ok, "Output should be true")
assert.Equal(t, "example.com", domain)
}
func TestReplaceSubdomainWithWildcard(t *testing.T) {
domain, ok := ReplaceSubdomainWithWildcard("www.example.com")
assert.True(t, ok, "Output should be true")
assert.Equal(t, "*.example.com", domain)
domain, ok = ReplaceSubdomainWithWildcard("www.example.com:5612")
assert.True(t, ok, "Output should be true")
assert.Equal(t, "*.example.com:5612", domain)
}
func TestGetBaseDomain(t *testing.T) {
domain, ok := GetBaseDomain("www.example.com")
assert.True(t, ok, "Output should be true")
assert.Equal(t, "example.com", domain)
domain, ok = GetBaseDomain("www.example.com:5612")
assert.True(t, ok, "Output should be true")
assert.Equal(t, "example.com:5612", domain)
}
func TestGetTopFqdn(t *testing.T) {
domain, ok := GetTopFqdn("www.example.com")
assert.True(t, ok, "Output should be true")
assert.Equal(t, "example.com", domain)
domain, ok = GetTopFqdn("www.www.example.com")
assert.True(t, ok, "Output should be true")
assert.Equal(t, "example.com", domain)
}

30
utils/done-chan.go Normal file
View File

@ -0,0 +1,30 @@
package utils
import "sync"
type DoneChan struct {
C chan struct{}
m *sync.RWMutex
e bool
}
func NewDoneChan() *DoneChan {
return &DoneChan{
C: make(chan struct{}, 0),
m: &sync.RWMutex{},
}
}
func (d *DoneChan) Close() {
d.m.Lock()
if !d.e {
close(d.C)
}
d.m.Unlock()
}
func (d *DoneChan) Running() bool {
d.m.RLock()
defer d.m.RUnlock()
return !d.e
}

24
utils/key-value-string.go Normal file
View File

@ -0,0 +1,24 @@
package utils
import "strings"
type KeyValuePair struct{ key, value string }
func ParseKeyValueString(text string) *KeyValuePair {
v := strings.SplitN(text, "=", 2)
if len(v) != 2 {
return nil
}
return &KeyValuePair{v[0], v[1]}
}
func ParseKeyValueFromStringArray(text []string) []KeyValuePair {
out := make([]KeyValuePair, 0)
for _, a := range text {
b := ParseKeyValueString(a)
if b != nil {
out = append(out, *b)
}
}
return out
}

View File

@ -0,0 +1,19 @@
package utils
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestParseKeyValueString(t *testing.T) {
assert.Nil(t, ParseKeyValueString("hello world"))
assert.Equal(t, &KeyValuePair{"hello", "world"}, ParseKeyValueString("hello=world"))
}
func TestParseKeyValueFromStringArray(t *testing.T) {
assert.Equal(t, []KeyValuePair{}, ParseKeyValueFromStringArray([]string{}))
assert.Equal(t, []KeyValuePair{}, ParseKeyValueFromStringArray([]string{"hello world"}))
assert.Equal(t, []KeyValuePair{{"hello", "world"}}, ParseKeyValueFromStringArray([]string{"hello=world"}))
assert.Equal(t, []KeyValuePair{{"hello", "world"}}, ParseKeyValueFromStringArray([]string{"hello=world", "test"}))
assert.Equal(t, []KeyValuePair{{"hello", "world"}, {"test", "1"}}, ParseKeyValueFromStringArray([]string{"hello=world", "test=1"}))
}

20
utils/pointer.go Normal file
View File

@ -0,0 +1,20 @@
package utils
func PBool(a bool) *bool { return &a }
func SBool(a *bool) bool { return a != nil && *a }
func PByte(a byte) *byte { return &a }
func SByte(a *byte) byte {
if a == nil {
return 0
}
return *a
}
func PString(a string) *string { return &a }
func SString(a *string) string {
if a == nil {
return ""
}
return *a
}

36
utils/quoted-string.go Normal file
View File

@ -0,0 +1,36 @@
package utils
func QuotedStringToArray(text string) []string {
var escape, quoted bool
out := make([]string, 0)
var a string
runeArr := []rune(text)
for _, char := range runeArr {
if escape {
a += string(char)
escape = false
continue
}
switch char {
case ' ':
if quoted {
a += " "
} else if a != "" {
out = append(out, a)
a = ""
}
case '\\':
escape = true
case '"':
quoted = !quoted
default:
a += string(char)
}
}
if a != "" {
out = append(out, a)
a = ""
}
return out
}

View File

@ -0,0 +1,15 @@
package utils
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestQuotedStringToArray(t *testing.T) {
assert.Equal(t, []string{"hello", "world"}, QuotedStringToArray("hello world"))
assert.Equal(t, []string{"hello world"}, QuotedStringToArray("\"hello world\""))
assert.Equal(t, []string{"test", "hello world", "message"}, QuotedStringToArray("test \"hello world\" message"))
assert.Equal(t, []string{"test", "hello world \"with extra data\" inside", "message"}, QuotedStringToArray("test \"hello world \\\"with extra data\\\" inside\" message"))
assert.Equal(t, []string{"hello world"}, QuotedStringToArray("hello\\ world"))
assert.Equal(t, []string{"test", "hello world", "message"}, QuotedStringToArray("test hello\\ world message"))
}

24
utils/random-string.go Normal file
View File

@ -0,0 +1,24 @@
package utils
import (
"math/rand"
)
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
var numberRunes = []rune("0123456789")
func GenRandStringLetters(n int) string {
return GenRandStringCustom(n, letterRunes)
}
func GenRandStringNumbers(n int) string {
return GenRandStringCustom(n, numberRunes)
}
func GenRandStringCustom(n int, custom []rune) string {
b := make([]rune, n)
for i := range b {
b[i] = custom[rand.Intn(len(custom))]
}
return string(b)
}

53
utils/request-utils.go Normal file
View File

@ -0,0 +1,53 @@
package utils
import (
"net/http"
"net/url"
"strconv"
"strings"
"time"
)
var cacheETag = strconv.FormatInt(time.Now().Unix(), 16)
func RequestKiller(rw http.ResponseWriter) {
if hi, ok := rw.(http.Hijacker); ok {
conn, _, err := hi.Hijack()
if err == nil {
_ = conn.Close()
}
}
}
func GetBearerToken(req *http.Request) string {
auth := req.Header.Get("Authorization")
if strings.HasPrefix(strings.ToLower(auth), "bearer ") {
return auth[len("bearer "):]
}
return ""
}
func CachedPage(cb func(rw http.ResponseWriter, req *http.Request)) func(rw http.ResponseWriter, req *http.Request) {
return func(rw http.ResponseWriter, req *http.Request) {
if req.Header.Get("If-None-Match") == req.RequestURI+"."+cacheETag {
rw.WriteHeader(http.StatusNotModified)
return
}
rw.Header().Set("Etag", req.RequestURI+"."+cacheETag)
cb(rw, req)
}
}
// CloneURL is copied from https://github.com/golang/go/blob/go1.19/src/net/http/clone.go#L22
func CloneURL(u *url.URL) *url.URL {
if u == nil {
return nil
}
u2 := new(url.URL)
*u2 = *u
if u.User != nil {
u2.User = new(url.Userinfo)
*u2.User = *u.User
}
return u2
}

10
utils/response-utils.go Normal file
View File

@ -0,0 +1,10 @@
package utils
import (
"fmt"
"net/http"
)
func RespondHttpStatus(rw http.ResponseWriter, status int) {
http.Error(rw, fmt.Sprintf("%d %s\n", status, http.StatusText(status)), status)
}

55
utils/server-utils.go Normal file
View File

@ -0,0 +1,55 @@
package utils
import (
"errors"
"log"
"net/http"
"regexp"
"strconv"
"strings"
)
func logHttpServerError(prefix string, err error) {
if err != nil {
if err == http.ErrServerClosed {
log.Printf("[%s] The http server shutdown successfully\n", prefix)
} else {
log.Printf("[%s] Error trying to host the http server: %s\n", prefix, err.Error())
}
}
}
func RunBackgroundHttp(prefix string, s *http.Server) {
logHttpServerError(prefix, s.ListenAndServe())
}
func RunBackgroundHttps(prefix string, s *http.Server) {
logHttpServerError(prefix, s.ListenAndServeTLS("", ""))
}
var symbolicHostParse = regexp.MustCompile("^([^:~/]+?)(?::([0-9]+?))?(/[^~]+?)?(?:~(.+?))?$")
// ParseSymbolicHost converts keyed hosts to host and path combo
func ParseSymbolicHost(host string) (dst string, port uint16, path string, flags []string, ref bool, err error) {
sub := symbolicHostParse.FindStringSubmatch(host)
if len(sub) != 5 {
return "", 0, "", nil, false, errors.New("symbolic host parsing error")
}
var a uint64
if sub[2] != "" {
a, err = strconv.ParseUint(sub[2], 10, 16)
if err != nil {
return
}
}
dst = sub[1]
port = uint16(a)
path = sub[3]
if sub[4] != "" {
flags = strings.Split(sub[4], ",")
}
ref = len(dst) >= 1 && dst[0] == '*'
return
}

View File

@ -0,0 +1,32 @@
package utils
import (
"github.com/stretchr/testify/assert"
"testing"
)
func assertSymbolicHost(t *testing.T, src string, host string, port uint16, path string, trailingSlash []string, ref bool) {
a, b, c, ts, r, err := ParseSymbolicHost(src)
assert.NoError(t, err)
assert.Equal(t, host, a)
assert.Equal(t, port, b)
assert.Equal(t, path, c)
assert.Equal(t, ts, trailingSlash)
assert.Equal(t, ref, r)
}
func TestParseSymbolicHost(t *testing.T) {
assertSymbolicHost(t, "*web:5600/hello", "*web", 5600, "/hello", nil, true)
assertSymbolicHost(t, "*web:5600", "*web", 5600, "", nil, true)
assertSymbolicHost(t, "*web/hello", "*web", 0, "/hello", nil, true)
assertSymbolicHost(t, "*web", "*web", 0, "", nil, true)
assertSymbolicHost(t, "*web:5600/hello~sec", "*web", 5600, "/hello", []string{"sec"}, true)
assertSymbolicHost(t, "*web/hello~sec,host", "*web", 0, "/hello", []string{"sec", "host"}, true)
assertSymbolicHost(t, "localhost:5600/hello", "localhost", 5600, "/hello", nil, false)
assertSymbolicHost(t, "localhost:5600", "localhost", 5600, "", nil, false)
assertSymbolicHost(t, "localhost/hello", "localhost", 0, "/hello", nil, false)
assertSymbolicHost(t, "localhost", "localhost", 0, "", nil, false)
assertSymbolicHost(t, "localhost:5600/hello~sec", "localhost", 5600, "/hello", []string{"sec"}, false)
assertSymbolicHost(t, "localhost/hello~sec,host", "localhost", 0, "/hello", []string{"sec", "host"}, false)
}

20
utils/slice-utils.go Normal file
View File

@ -0,0 +1,20 @@
package utils
func Contains[T comparable](slice []T, item T) bool {
for _, i := range slice {
if i == item {
return true
}
}
return false
}
func Count[T comparable](slice []T, item T) int {
z := 0
for _, i := range slice {
if i == item {
z++
}
}
return z
}

18
utils/slice-utils_test.go Normal file
View File

@ -0,0 +1,18 @@
package utils
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestContains2(t *testing.T) {
assert.True(t, Contains[string]([]string{"hello", "world"}, "hello"))
assert.True(t, Contains[string]([]string{"hello", "world"}, "world"))
assert.False(t, Contains[string]([]string{"hello", "world"}, "another"))
}
func TestCount2(t *testing.T) {
assert.Equal(t, 0, Count[string]([]string{}, "hello"))
assert.Equal(t, 1, Count[string]([]string{"hello"}, "hello"))
assert.Equal(t, 2, Count[string]([]string{"hello", "hello"}, "hello"))
}