From c79c8d3618d3db01e68880a10babe3d6ff26bec0 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 22 Jun 2024 17:29:53 +0800 Subject: [PATCH] :arrow_up: Upgrade to support the latest version Hydrogen Project standard --- go.mod | 20 +- go.sum | 196 +++++++++++++++++- pkg/grpc/client.go | 42 ---- pkg/{ => internal}/database/migrator.go | 2 +- pkg/{ => internal}/database/source.go | 0 pkg/{ => internal}/embed.go | 0 pkg/internal/gap/client.go | 12 ++ pkg/internal/gap/net.go | 15 ++ pkg/internal/gap/server.go | 40 ++++ pkg/internal/grpc/health.go | 26 +++ pkg/internal/grpc/server.go | 31 +++ pkg/{ => internal}/meta.go | 0 pkg/{ => internal}/models/accounts.go | 0 pkg/{ => internal}/models/base.go | 0 pkg/{ => internal}/models/categories.go | 0 pkg/{ => internal}/models/posts.go | 0 pkg/{ => internal}/models/reactions.go | 0 pkg/{ => internal}/models/realms.go | 0 .../server/api}/categories_api.go | 27 ++- .../server/api}/feed_api.go | 8 +- pkg/internal/server/api/index.go | 32 +++ .../server/api}/posts_api.go | 42 ++-- .../server/api}/replies_api.go | 8 +- .../server/api}/users_api.go | 12 +- pkg/internal/server/exts/auth.go | 19 ++ pkg/{server => internal/server/exts}/utils.go | 2 +- .../startup.go => internal/server/server.go} | 35 +--- pkg/{ => internal}/services/accounts.go | 20 +- pkg/internal/services/attachments.go | 20 ++ pkg/{ => internal}/services/auth.go | 33 +-- pkg/{ => internal}/services/categories.go | 4 +- pkg/{ => internal}/services/cleaner.go | 2 +- pkg/{ => internal}/services/encryptor.go | 0 pkg/{ => internal}/services/jwt.go | 0 pkg/{ => internal}/services/mailer.go | 0 pkg/{ => internal}/services/posts.go | 6 +- pkg/{ => internal}/services/realms.go | 32 ++- pkg/{ => internal}/views/favicon.png | Bin pkg/{ => internal}/views/index.gohtml | 0 pkg/{ => internal}/views/open.gohtml | 0 pkg/{cmd => }/main.go | 32 +-- pkg/server/auth.go | 50 ----- pkg/server/well_known_api.go | 16 -- pkg/services/attachments.go | 29 --- settings.toml | 4 +- 45 files changed, 538 insertions(+), 279 deletions(-) delete mode 100644 pkg/grpc/client.go rename pkg/{ => internal}/database/migrator.go (84%) rename pkg/{ => internal}/database/source.go (100%) rename pkg/{ => internal}/embed.go (100%) create mode 100644 pkg/internal/gap/client.go create mode 100644 pkg/internal/gap/net.go create mode 100644 pkg/internal/gap/server.go create mode 100644 pkg/internal/grpc/health.go create mode 100644 pkg/internal/grpc/server.go rename pkg/{ => internal}/meta.go (100%) rename pkg/{ => internal}/models/accounts.go (100%) rename pkg/{ => internal}/models/base.go (100%) rename pkg/{ => internal}/models/categories.go (100%) rename pkg/{ => internal}/models/posts.go (100%) rename pkg/{ => internal}/models/reactions.go (100%) rename pkg/{ => internal}/models/realms.go (100%) rename pkg/{server => internal/server/api}/categories_api.go (73%) rename pkg/{server => internal/server/api}/feed_api.go (84%) create mode 100644 pkg/internal/server/api/index.go rename pkg/{server => internal/server/api}/posts_api.go (87%) rename pkg/{server => internal/server/api}/replies_api.go (86%) rename pkg/{server => internal/server/api}/users_api.go (67%) create mode 100644 pkg/internal/server/exts/auth.go rename pkg/{server => internal/server/exts}/utils.go (96%) rename pkg/{server/startup.go => internal/server/server.go} (69%) rename pkg/{ => internal}/services/accounts.go (69%) create mode 100644 pkg/internal/services/attachments.go rename pkg/{ => internal}/services/auth.go (56%) rename pkg/{ => internal}/services/categories.go (93%) rename pkg/{ => internal}/services/cleaner.go (90%) rename pkg/{ => internal}/services/encryptor.go (100%) rename pkg/{ => internal}/services/jwt.go (100%) rename pkg/{ => internal}/services/mailer.go (100%) rename pkg/{ => internal}/services/posts.go (97%) rename pkg/{ => internal}/services/realms.go (62%) rename pkg/{ => internal}/views/favicon.png (100%) rename pkg/{ => internal}/views/index.gohtml (100%) rename pkg/{ => internal}/views/open.gohtml (100%) rename pkg/{cmd => }/main.go (69%) delete mode 100644 pkg/server/auth.go delete mode 100644 pkg/server/well_known_api.go delete mode 100644 pkg/services/attachments.go diff --git a/go.mod b/go.mod index 271cbf0..61b5e72 100644 --- a/go.mod +++ b/go.mod @@ -3,13 +3,14 @@ module git.solsynth.dev/hydrogen/interactive go 1.21.6 require ( - git.solsynth.dev/hydrogen/paperclip v0.0.0-20240518085442-715238074040 - git.solsynth.dev/hydrogen/passport v0.0.0-20240607130225-b76e7d41cf36 + git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745 + git.solsynth.dev/hydrogen/passport v0.0.0-20240622050421-7007cda8f210 github.com/go-playground/validator/v10 v10.17.0 github.com/gofiber/fiber/v2 v2.52.4 github.com/gofiber/template/html/v2 v2.1.1 github.com/golang-jwt/jwt/v5 v5.2.0 github.com/google/uuid v1.6.0 + github.com/hashicorp/consul/api v1.29.1 github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible github.com/json-iterator/go v1.1.12 github.com/robfig/cron/v3 v3.0.1 @@ -25,6 +26,8 @@ require ( require ( github.com/andybalholm/brotli v1.1.0 // indirect + github.com/armon/go-metrics v0.4.1 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/go-playground/locales v0.14.1 // indirect @@ -32,7 +35,15 @@ require ( github.com/go-sql-driver/mysql v1.7.1 // indirect github.com/gofiber/template v1.8.3 // indirect github.com/gofiber/utils v1.1.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-hclog v1.6.3 // indirect + github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-rootcerts v1.0.2 // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/serf v0.10.1 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect github.com/jackc/pgx/v5 v5.5.1 // indirect @@ -45,6 +56,7 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -63,13 +75,13 @@ require ( github.com/valyala/fasthttp v1.52.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20231219180239-dc181d75b848 // indirect + golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.16.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/protobuf v1.34.1 // indirect + google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gorm.io/driver/mysql v1.5.2 // indirect diff --git a/go.sum b/go.sum index 025cbe5..f7b7fa6 100644 --- a/go.sum +++ b/go.sum @@ -1,20 +1,47 @@ -git.solsynth.dev/hydrogen/paperclip v0.0.0-20240518085442-715238074040 h1:B/3gXFaxoLdD7icLu33OXrx166raEHtHdfhCFrPYgTE= -git.solsynth.dev/hydrogen/paperclip v0.0.0-20240518085442-715238074040/go.mod h1:uTNEtJcNdgt7DhOgsewPaLQQ5kTN9H+tGNRT2CshHGs= -git.solsynth.dev/hydrogen/passport v0.0.0-20240607130225-b76e7d41cf36 h1:L/dlFeiIr3WB22y15FP8LVe/ylrJzu7+8SzejcFg7nI= -git.solsynth.dev/hydrogen/passport v0.0.0-20240607130225-b76e7d41cf36/go.mod h1:UuE3QXf2540Xs1GmViUSZ3V0ILtiYePZ5iXfZhzlSo4= +git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745 h1:40BUsQMNXjqHyytkyF9py1HjTAWlRgO6R57YXUrHNy4= +git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745/go.mod h1:FsQGSLTl0gvo+9Jmbot02S72suyF9tFTrzDj70Xhifo= +git.solsynth.dev/hydrogen/passport v0.0.0-20240622050421-7007cda8f210 h1:DM4AVhG/l3cOfmhA5IDFgn120BL2PEATnPQDtINIS/Q= +git.solsynth.dev/hydrogen/passport v0.0.0-20240622050421-7007cda8f210/go.mod h1:XTNEOv75sZI52sNgpum7Z/tgYmlRcHfK7VdhyV7kc0w= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +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/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= +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-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= +github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +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/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= +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-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-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= @@ -26,6 +53,7 @@ github.com/go-playground/validator/v10 v10.17.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QX github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofiber/fiber/v2 v2.52.4 h1:P+T+4iK7VaqUsq2PALYEfBBo6bJZ4q3FP8cZ84EggTM= github.com/gofiber/fiber/v2 v2.52.4/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ= @@ -35,19 +63,74 @@ github.com/gofiber/template/html/v2 v2.1.1 h1:QEy3O3EBkvwDthy5bXVGUseOyO6ldJoiDx github.com/gofiber/template/html/v2 v2.1.1/go.mod h1:2G0GHHOUx70C1LDncoBpe4T6maQbNa4x1CVNFW0wju0= github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM= github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= +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/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/consul/api v1.29.1 h1:UEwOjYJrd3lG1x5w7HxDRMGiAUPrb3f103EoeKuuEcc= +github.com/hashicorp/consul/api v1.29.1/go.mod h1:lumfRkY/coLuqMICkI7Fh3ylMG31mQSRZyef2c5YvJI= +github.com/hashicorp/consul/proto-public v0.6.1 h1:+uzH3olCrksXYWAYHKqK782CtK9scfqH+Unlw3UHhCg= +github.com/hashicorp/consul/proto-public v0.6.1/go.mod h1:cXXbOg74KBNGajC+o8RlA502Esf0R9prcoJgiOX/2Tg= +github.com/hashicorp/consul/sdk v0.16.1 h1:V8TxTnImoPD5cj0U9Spl0TUxcytjcbbJeADFF07KdHg= +github.com/hashicorp/consul/sdk v0.16.1/go.mod h1:fSXvwxB2hmh1FMZCNl6PwX0Q/1wdWtHJcZ7Ea5tns0s= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI= +github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= +github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= +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-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= +github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= +github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM= +github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= +github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY= +github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 h1:L0QtFUgDarD7Fpv9jeVMgy/+Ec0mtnmYuImjTz6dtDA= @@ -62,20 +145,38 @@ github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible h1:jdpOPRN1zP63Td1hDQbZW73xKmzDvZHzVdNYxhnTMDA= github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible/go.mod h1:1c7szIrayyPPB/987hsnvNzLushdWf4o/79s3P08L8A= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.9/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/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/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/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -84,23 +185,53 @@ github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZ github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI= github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/microsoft/go-mssqldb v0.17.0 h1:Fto83dMZPnYv1Zwx5vHHxpNraeEaUlQ/hhHLgZiaenE= github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ= +github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= +github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= 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/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw= github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0= +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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/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/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= @@ -111,12 +242,17 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA= github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= @@ -128,11 +264,16 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= 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.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= 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.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.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= @@ -141,6 +282,7 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8 github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/tinylib/msgp v1.1.8 h1:FCXC1xanKO4I8plpHGH2P7koL/RzZs12l/+r7vakfm0= github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.52.0 h1:wqBQpxH71XW0e2g+Og4dzQM8pk34aFYlA1Ga8db7gU0= @@ -150,30 +292,58 @@ github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7Fw github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/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-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= -golang.org/x/exp v0.0.0-20231219180239-dc181d75b848 h1:+iq7lrkxmFNBM7xx+Rae2W6uyPfhPeDWD+n+JgppptE= -golang.org/x/exp v0.0.0-20231219180239-dc181d75b848/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +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-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +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-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-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/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-20181116152217-5ac8a444bdc5/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-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/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-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -184,27 +354,37 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= 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.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.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/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.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +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-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.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= diff --git a/pkg/grpc/client.go b/pkg/grpc/client.go deleted file mode 100644 index b09e066..0000000 --- a/pkg/grpc/client.go +++ /dev/null @@ -1,42 +0,0 @@ -package grpc - -import ( - pcpb "git.solsynth.dev/hydrogen/paperclip/pkg/grpc/proto" - idpb "git.solsynth.dev/hydrogen/passport/pkg/grpc/proto" - "google.golang.org/grpc/credentials/insecure" - - "github.com/spf13/viper" - "google.golang.org/grpc" -) - -var Attachments pcpb.AttachmentsClient - -func ConnectPaperclip() error { - addr := viper.GetString("paperclip.grpc_endpoint") - if conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials())); err != nil { - return err - } else { - Attachments = pcpb.NewAttachmentsClient(conn) - } - - return nil -} - -var Realms idpb.RealmsClient -var Friendships idpb.FriendshipsClient -var Notify idpb.NotifyClient -var Auth idpb.AuthClient - -func ConnectPassport() error { - addr := viper.GetString("passport.grpc_endpoint") - if conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials())); err != nil { - return err - } else { - Realms = idpb.NewRealmsClient(conn) - Friendships = idpb.NewFriendshipsClient(conn) - Notify = idpb.NewNotifyClient(conn) - Auth = idpb.NewAuthClient(conn) - } - - return nil -} diff --git a/pkg/database/migrator.go b/pkg/internal/database/migrator.go similarity index 84% rename from pkg/database/migrator.go rename to pkg/internal/database/migrator.go index d3422d8..0b45570 100644 --- a/pkg/database/migrator.go +++ b/pkg/internal/database/migrator.go @@ -1,7 +1,7 @@ package database import ( - "git.solsynth.dev/hydrogen/interactive/pkg/models" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/models" "gorm.io/gorm" ) diff --git a/pkg/database/source.go b/pkg/internal/database/source.go similarity index 100% rename from pkg/database/source.go rename to pkg/internal/database/source.go diff --git a/pkg/embed.go b/pkg/internal/embed.go similarity index 100% rename from pkg/embed.go rename to pkg/internal/embed.go diff --git a/pkg/internal/gap/client.go b/pkg/internal/gap/client.go new file mode 100644 index 0000000..6a6a39e --- /dev/null +++ b/pkg/internal/gap/client.go @@ -0,0 +1,12 @@ +package gap + +import ( + "git.solsynth.dev/hydrogen/passport/pkg/hyper" + "github.com/spf13/viper" +) + +var H *hyper.HyperConn + +func NewHyperClient() { + H = hyper.NewHyperConn(viper.GetString("consul.addr")) +} diff --git a/pkg/internal/gap/net.go b/pkg/internal/gap/net.go new file mode 100644 index 0000000..d618851 --- /dev/null +++ b/pkg/internal/gap/net.go @@ -0,0 +1,15 @@ +package gap + +import "net" + +func GetOutboundIP() (net.IP, error) { + conn, err := net.Dial("udp", "1.1.1.1:80") + if err != nil { + return nil, err + } else { + defer conn.Close() + } + + localAddr := conn.LocalAddr().(*net.UDPAddr) + return localAddr.IP, nil +} diff --git a/pkg/internal/gap/server.go b/pkg/internal/gap/server.go new file mode 100644 index 0000000..061b423 --- /dev/null +++ b/pkg/internal/gap/server.go @@ -0,0 +1,40 @@ +package gap + +import ( + "fmt" + "strconv" + "strings" + + "github.com/hashicorp/consul/api" + "github.com/spf13/viper" +) + +func Register() error { + cfg := api.DefaultConfig() + cfg.Address = viper.GetString("consul.addr") + + client, err := api.NewClient(cfg) + if err != nil { + return err + } + + httpBind := strings.SplitN(viper.GetString("bind"), ":", 2) + grpcBind := strings.SplitN(viper.GetString("grpc_bind"), ":", 2) + + outboundIp, _ := GetOutboundIP() + port, _ := strconv.Atoi(httpBind[1]) + + registration := new(api.AgentServiceRegistration) + registration.ID = viper.GetString("id") + registration.Name = "Hydrogen.Interactive" + registration.Address = outboundIp.String() + registration.Port = port + registration.Check = &api.AgentServiceCheck{ + GRPC: fmt.Sprintf("%s:%s", outboundIp, grpcBind[1]), + Timeout: "5s", + Interval: "1m", + DeregisterCriticalServiceAfter: "3m", + } + + return client.Agent().ServiceRegister(registration) +} diff --git a/pkg/internal/grpc/health.go b/pkg/internal/grpc/health.go new file mode 100644 index 0000000..d71549a --- /dev/null +++ b/pkg/internal/grpc/health.go @@ -0,0 +1,26 @@ +package grpc + +import ( + "context" + health "google.golang.org/grpc/health/grpc_health_v1" + "time" +) + +func (v *Server) Check(ctx context.Context, request *health.HealthCheckRequest) (*health.HealthCheckResponse, error) { + return &health.HealthCheckResponse{ + Status: health.HealthCheckResponse_SERVING, + }, nil +} + +func (v *Server) Watch(request *health.HealthCheckRequest, server health.Health_WatchServer) error { + for { + if server.Send(&health.HealthCheckResponse{ + Status: health.HealthCheckResponse_SERVING, + }) != nil { + break + } + time.Sleep(1000 * time.Millisecond) + } + + return nil +} diff --git a/pkg/internal/grpc/server.go b/pkg/internal/grpc/server.go new file mode 100644 index 0000000..fc2ff00 --- /dev/null +++ b/pkg/internal/grpc/server.go @@ -0,0 +1,31 @@ +package grpc + +import ( + "github.com/spf13/viper" + "google.golang.org/grpc" + health "google.golang.org/grpc/health/grpc_health_v1" + "google.golang.org/grpc/reflection" + "net" +) + +type Server struct { +} + +var S *grpc.Server + +func NewGRPC() { + S = grpc.NewServer() + + health.RegisterHealthServer(S, &Server{}) + + reflection.Register(S) +} + +func ListenGRPC() error { + listener, err := net.Listen("tcp", viper.GetString("grpc_bind")) + if err != nil { + return err + } + + return S.Serve(listener) +} diff --git a/pkg/meta.go b/pkg/internal/meta.go similarity index 100% rename from pkg/meta.go rename to pkg/internal/meta.go diff --git a/pkg/models/accounts.go b/pkg/internal/models/accounts.go similarity index 100% rename from pkg/models/accounts.go rename to pkg/internal/models/accounts.go diff --git a/pkg/models/base.go b/pkg/internal/models/base.go similarity index 100% rename from pkg/models/base.go rename to pkg/internal/models/base.go diff --git a/pkg/models/categories.go b/pkg/internal/models/categories.go similarity index 100% rename from pkg/models/categories.go rename to pkg/internal/models/categories.go diff --git a/pkg/models/posts.go b/pkg/internal/models/posts.go similarity index 100% rename from pkg/models/posts.go rename to pkg/internal/models/posts.go diff --git a/pkg/models/reactions.go b/pkg/internal/models/reactions.go similarity index 100% rename from pkg/models/reactions.go rename to pkg/internal/models/reactions.go diff --git a/pkg/models/realms.go b/pkg/internal/models/realms.go similarity index 100% rename from pkg/models/realms.go rename to pkg/internal/models/realms.go diff --git a/pkg/server/categories_api.go b/pkg/internal/server/api/categories_api.go similarity index 73% rename from pkg/server/categories_api.go rename to pkg/internal/server/api/categories_api.go index 733bd38..b011759 100644 --- a/pkg/server/categories_api.go +++ b/pkg/internal/server/api/categories_api.go @@ -1,8 +1,10 @@ -package server +package api import ( - "git.solsynth.dev/hydrogen/interactive/pkg/models" - "git.solsynth.dev/hydrogen/interactive/pkg/services" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/gap" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/models" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/server/exts" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/services" "github.com/gofiber/fiber/v2" ) @@ -16,7 +18,10 @@ func listCategories(c *fiber.Ctx) error { } func newCategory(c *fiber.Ctx) error { - user := c.Locals("principal").(models.Account) + if err := gap.H.EnsureAuthenticated(c); err != nil { + return err + } + user := c.Locals("user").(models.Account) if user.PowerLevel <= 55 { return fiber.NewError(fiber.StatusForbidden, "require power level 55 to create categories") } @@ -27,7 +32,7 @@ func newCategory(c *fiber.Ctx) error { Description string `json:"description"` } - if err := BindAndValidate(c, &data); err != nil { + if err := exts.BindAndValidate(c, &data); err != nil { return err } @@ -40,7 +45,10 @@ func newCategory(c *fiber.Ctx) error { } func editCategory(c *fiber.Ctx) error { - user := c.Locals("principal").(models.Account) + if err := gap.H.EnsureAuthenticated(c); err != nil { + return err + } + user := c.Locals("user").(models.Account) if user.PowerLevel <= 55 { return fiber.NewError(fiber.StatusForbidden, "require power level 55 to edit categories") } @@ -57,7 +65,7 @@ func editCategory(c *fiber.Ctx) error { Description string `json:"description"` } - if err := BindAndValidate(c, &data); err != nil { + if err := exts.BindAndValidate(c, &data); err != nil { return err } @@ -70,7 +78,10 @@ func editCategory(c *fiber.Ctx) error { } func deleteCategory(c *fiber.Ctx) error { - user := c.Locals("principal").(models.Account) + if err := gap.H.EnsureAuthenticated(c); err != nil { + return err + } + user := c.Locals("user").(models.Account) if user.PowerLevel <= 55 { return fiber.NewError(fiber.StatusForbidden, "require power level 55 to delete categories") } diff --git a/pkg/server/feed_api.go b/pkg/internal/server/api/feed_api.go similarity index 84% rename from pkg/server/feed_api.go rename to pkg/internal/server/api/feed_api.go index b457d52..3195714 100644 --- a/pkg/server/feed_api.go +++ b/pkg/internal/server/api/feed_api.go @@ -1,9 +1,9 @@ -package server +package api import ( - "git.solsynth.dev/hydrogen/interactive/pkg/database" - "git.solsynth.dev/hydrogen/interactive/pkg/models" - "git.solsynth.dev/hydrogen/interactive/pkg/services" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/database" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/models" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/services" "github.com/gofiber/fiber/v2" ) diff --git a/pkg/internal/server/api/index.go b/pkg/internal/server/api/index.go new file mode 100644 index 0000000..d39aef2 --- /dev/null +++ b/pkg/internal/server/api/index.go @@ -0,0 +1,32 @@ +package api + +import ( + "github.com/gofiber/fiber/v2" +) + +func MapAPIs(app *fiber.App) { + api := app.Group("/api").Name("API") + { + api.Get("/users/me", getUserinfo) + api.Get("/users/:accountId", getOthersInfo) + + api.Get("/feed", listFeed) + + posts := api.Group("/posts").Name("Posts API") + { + posts.Get("/", listPost) + posts.Get("/:post", getPost) + posts.Post("/", createPost) + posts.Post("/:post/react", reactPost) + posts.Put("/:postId", editPost) + posts.Delete("/:postId", deletePost) + + posts.Get("/:post/replies", listReplies) + } + + api.Get("/categories", listCategories) + api.Post("/categories", newCategory) + api.Put("/categories/:categoryId", editCategory) + api.Delete("/categories/:categoryId", deleteCategory) + } +} diff --git a/pkg/server/posts_api.go b/pkg/internal/server/api/posts_api.go similarity index 87% rename from pkg/server/posts_api.go rename to pkg/internal/server/api/posts_api.go index ce61360..9160b1c 100644 --- a/pkg/server/posts_api.go +++ b/pkg/internal/server/api/posts_api.go @@ -1,17 +1,17 @@ -package server +package api import ( "fmt" - "strings" - "time" - + "git.solsynth.dev/hydrogen/interactive/pkg/internal/database" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/gap" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/models" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/server/exts" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/services" "github.com/gofiber/fiber/v2" "github.com/google/uuid" - - "git.solsynth.dev/hydrogen/interactive/pkg/database" - "git.solsynth.dev/hydrogen/interactive/pkg/models" - "git.solsynth.dev/hydrogen/interactive/pkg/services" "github.com/samber/lo" + "strings" + "time" ) func getPost(c *fiber.Ctx) error { @@ -74,7 +74,10 @@ func listPost(c *fiber.Ctx) error { } func createPost(c *fiber.Ctx) error { - user := c.Locals("principal").(models.Account) + if err := gap.H.EnsureGrantedPerm(c, "CreateInteractivePost", true); err != nil { + return err + } + user := c.Locals("user").(models.Account) var data struct { Alias string `json:"alias" form:"alias"` @@ -88,7 +91,7 @@ func createPost(c *fiber.Ctx) error { RepostTo *uint `json:"repost_to" form:"repost_to"` } - if err := BindAndValidate(c, &data); err != nil { + if err := exts.BindAndValidate(c, &data); err != nil { return err } else if len(data.Alias) == 0 { data.Alias = strings.ReplaceAll(uuid.NewString(), "-", "") @@ -146,8 +149,11 @@ func createPost(c *fiber.Ctx) error { } func editPost(c *fiber.Ctx) error { - user := c.Locals("principal").(models.Account) id, _ := c.ParamsInt("postId", 0) + if err := gap.H.EnsureAuthenticated(c); err != nil { + return err + } + user := c.Locals("user").(models.Account) var data struct { Alias string `json:"alias" form:"alias" validate:"required"` @@ -158,7 +164,7 @@ func editPost(c *fiber.Ctx) error { Attachments []uint `json:"attachments" form:"attachments"` } - if err := BindAndValidate(c, &data); err != nil { + if err := exts.BindAndValidate(c, &data); err != nil { return err } @@ -191,7 +197,10 @@ func editPost(c *fiber.Ctx) error { } func deletePost(c *fiber.Ctx) error { - user := c.Locals("principal").(models.Account) + if err := gap.H.EnsureAuthenticated(c); err != nil { + return err + } + user := c.Locals("user").(models.Account) id, _ := c.ParamsInt("postId", 0) var item models.Post @@ -210,14 +219,17 @@ func deletePost(c *fiber.Ctx) error { } func reactPost(c *fiber.Ctx) error { - user := c.Locals("principal").(models.Account) + if err := gap.H.EnsureAuthenticated(c); err != nil { + return err + } + user := c.Locals("user").(models.Account) var data struct { Symbol string `json:"symbol" form:"symbol" validate:"required"` Attitude models.ReactionAttitude `json:"attitude" form:"attitude"` } - if err := BindAndValidate(c, &data); err != nil { + if err := exts.BindAndValidate(c, &data); err != nil { return err } diff --git a/pkg/server/replies_api.go b/pkg/internal/server/api/replies_api.go similarity index 86% rename from pkg/server/replies_api.go rename to pkg/internal/server/api/replies_api.go index cc15724..b8caa14 100644 --- a/pkg/server/replies_api.go +++ b/pkg/internal/server/api/replies_api.go @@ -1,10 +1,10 @@ -package server +package api import ( "fmt" - "git.solsynth.dev/hydrogen/interactive/pkg/database" - "git.solsynth.dev/hydrogen/interactive/pkg/models" - "git.solsynth.dev/hydrogen/interactive/pkg/services" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/database" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/models" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/services" "github.com/gofiber/fiber/v2" ) diff --git a/pkg/server/users_api.go b/pkg/internal/server/api/users_api.go similarity index 67% rename from pkg/server/users_api.go rename to pkg/internal/server/api/users_api.go index 89a237b..e0879d8 100644 --- a/pkg/server/users_api.go +++ b/pkg/internal/server/api/users_api.go @@ -1,13 +1,17 @@ -package server +package api import ( - "git.solsynth.dev/hydrogen/interactive/pkg/database" - "git.solsynth.dev/hydrogen/interactive/pkg/models" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/database" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/gap" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/models" "github.com/gofiber/fiber/v2" ) func getUserinfo(c *fiber.Ctx) error { - user := c.Locals("principal").(models.Account) + if err := gap.H.EnsureAuthenticated(c); err != nil { + return err + } + user := c.Locals("user").(models.Account) var data models.Account if err := database.C. diff --git a/pkg/internal/server/exts/auth.go b/pkg/internal/server/exts/auth.go new file mode 100644 index 0000000..d014407 --- /dev/null +++ b/pkg/internal/server/exts/auth.go @@ -0,0 +1,19 @@ +package exts + +import ( + "git.solsynth.dev/hydrogen/interactive/pkg/internal/services" + "git.solsynth.dev/hydrogen/passport/pkg/proto" + "github.com/gofiber/fiber/v2" +) + +func LinkAccountMiddleware(c *fiber.Ctx) error { + if val, ok := c.Locals("p_user").(*proto.Userinfo); ok { + if account, err := services.LinkAccount(val); err != nil { + return fiber.NewError(fiber.StatusInternalServerError, err.Error()) + } else { + c.Locals("user", account) + } + } + + return c.Next() +} diff --git a/pkg/server/utils.go b/pkg/internal/server/exts/utils.go similarity index 96% rename from pkg/server/utils.go rename to pkg/internal/server/exts/utils.go index 8502c7f..f34e873 100644 --- a/pkg/server/utils.go +++ b/pkg/internal/server/exts/utils.go @@ -1,4 +1,4 @@ -package server +package exts import ( "github.com/go-playground/validator/v10" diff --git a/pkg/server/startup.go b/pkg/internal/server/server.go similarity index 69% rename from pkg/server/startup.go rename to pkg/internal/server/server.go index e2c2825..21cfbf7 100644 --- a/pkg/server/startup.go +++ b/pkg/internal/server/server.go @@ -1,7 +1,10 @@ package server import ( - "git.solsynth.dev/hydrogen/interactive/pkg" + pkg "git.solsynth.dev/hydrogen/interactive/pkg/internal" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/gap" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/server/api" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/server/exts" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" "github.com/gofiber/fiber/v2/middleware/favicon" @@ -56,32 +59,8 @@ func NewServer() { Output: log.Logger, })) - A.Get("/.well-known", getMetadata) - - api := A.Group("/api").Name("API") - { - api.Get("/users/me", authMiddleware, getUserinfo) - api.Get("/users/:accountId", getOthersInfo) - - api.Get("/feed", listFeed) - - posts := api.Group("/posts").Name("Posts API") - { - posts.Get("/", listPost) - posts.Get("/:post", getPost) - posts.Post("/", authMiddleware, createPost) - posts.Post("/:post/react", authMiddleware, reactPost) - posts.Put("/:postId", authMiddleware, editPost) - posts.Delete("/:postId", authMiddleware, deletePost) - - posts.Get("/:post/replies", listReplies) - } - - api.Get("/categories", listCategories) - api.Post("/categories", authMiddleware, newCategory) - api.Put("/categories/:categoryId", authMiddleware, editCategory) - api.Delete("/categories/:categoryId", authMiddleware, deleteCategory) - } + A.Use(gap.H.AuthMiddleware) + A.Use(exts.LinkAccountMiddleware) A.Use(favicon.New(favicon.Config{ FileSystem: http.FS(pkg.FS), @@ -89,6 +68,8 @@ func NewServer() { URL: "/favicon.png", })) + api.MapAPIs(A) + A.Get("/", func(c *fiber.Ctx) error { return c.Render("views/open", fiber.Map{ "frontend": viper.GetString("frontend"), diff --git a/pkg/services/accounts.go b/pkg/internal/services/accounts.go similarity index 69% rename from pkg/services/accounts.go rename to pkg/internal/services/accounts.go index bb75354..60d3849 100644 --- a/pkg/services/accounts.go +++ b/pkg/internal/services/accounts.go @@ -2,10 +2,10 @@ package services import ( "context" - "git.solsynth.dev/hydrogen/interactive/pkg/database" - "git.solsynth.dev/hydrogen/interactive/pkg/grpc" - "git.solsynth.dev/hydrogen/interactive/pkg/models" - "git.solsynth.dev/hydrogen/passport/pkg/grpc/proto" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/database" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/gap" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/models" + "git.solsynth.dev/hydrogen/passport/pkg/proto" "github.com/rs/zerolog/log" "github.com/spf13/viper" "time" @@ -24,7 +24,11 @@ func GetAccountFriend(userId, relatedId uint, status int) (*proto.FriendshipResp ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) defer cancel() - return grpc.Friendships.GetFriendship(ctx, &proto.FriendshipTwoSideLookupRequest{ + pc, err := gap.H.DiscoverServiceGRPC("Hydrogen.Passport") + if err != nil { + return nil, err + } + return proto.NewFriendshipsClient(pc).GetFriendship(ctx, &proto.FriendshipTwoSideLookupRequest{ AccountId: uint64(user.ExternalID), RelatedId: uint64(related.ExternalID), Status: uint32(status), @@ -35,7 +39,11 @@ func NotifyPosterAccount(user models.Account, subject, content string, links ... ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) defer cancel() - _, err := grpc.Notify.NotifyUser(ctx, &proto.NotifyRequest{ + pc, err := gap.H.DiscoverServiceGRPC("Hydrogen.Passport") + if err != nil { + return err + } + _, err = proto.NewNotifyClient(pc).NotifyUser(ctx, &proto.NotifyRequest{ ClientId: viper.GetString("passport.client_id"), ClientSecret: viper.GetString("passport.client_secret"), Type: "interactive.feedback", diff --git a/pkg/internal/services/attachments.go b/pkg/internal/services/attachments.go new file mode 100644 index 0000000..c27ccbc --- /dev/null +++ b/pkg/internal/services/attachments.go @@ -0,0 +1,20 @@ +package services + +import ( + "context" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/gap" + "git.solsynth.dev/hydrogen/paperclip/pkg/proto" + "github.com/samber/lo" +) + +func CheckAttachmentByIDExists(id uint, usage string) bool { + pc, err := gap.H.DiscoverServiceGRPC("Hydrogen.Paperclip") + if err != nil { + return false + } + _, err = proto.NewAttachmentsClient(pc).CheckAttachmentExists(context.Background(), &proto.AttachmentLookupRequest{ + Id: lo.ToPtr(uint64(id)), + Usage: &usage, + }) + return err == nil +} diff --git a/pkg/services/auth.go b/pkg/internal/services/auth.go similarity index 56% rename from pkg/services/auth.go rename to pkg/internal/services/auth.go index 8b41b7a..0805e1f 100644 --- a/pkg/services/auth.go +++ b/pkg/internal/services/auth.go @@ -1,17 +1,13 @@ package services import ( - "context" "errors" "fmt" - "reflect" - "time" - - "git.solsynth.dev/hydrogen/interactive/pkg/database" - "git.solsynth.dev/hydrogen/interactive/pkg/grpc" - "git.solsynth.dev/hydrogen/interactive/pkg/models" - "git.solsynth.dev/hydrogen/passport/pkg/grpc/proto" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/database" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/models" + "git.solsynth.dev/hydrogen/passport/pkg/proto" "gorm.io/gorm" + "reflect" ) func LinkAccount(userinfo *proto.Userinfo) (models.Account, error) { @@ -53,24 +49,3 @@ func LinkAccount(userinfo *proto.Userinfo) (models.Account, error) { return account, err } - -func Authenticate(atk, rtk string) (models.Account, string, string, error) { - ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) - defer cancel() - - var err error - var user models.Account - reply, err := grpc.Auth.Authenticate(ctx, &proto.AuthRequest{ - AccessToken: atk, - RefreshToken: &rtk, - }) - if err != nil { - return user, reply.GetAccessToken(), reply.GetRefreshToken(), err - } else if !reply.IsValid { - return user, reply.GetAccessToken(), reply.GetRefreshToken(), fmt.Errorf("invalid authorization context") - } - - user, err = LinkAccount(reply.Userinfo) - - return user, reply.GetAccessToken(), reply.GetRefreshToken(), err -} diff --git a/pkg/services/categories.go b/pkg/internal/services/categories.go similarity index 93% rename from pkg/services/categories.go rename to pkg/internal/services/categories.go index 6921593..4216e84 100644 --- a/pkg/services/categories.go +++ b/pkg/internal/services/categories.go @@ -3,8 +3,8 @@ package services import ( "errors" - "git.solsynth.dev/hydrogen/interactive/pkg/database" - "git.solsynth.dev/hydrogen/interactive/pkg/models" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/database" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/models" "gorm.io/gorm" ) diff --git a/pkg/services/cleaner.go b/pkg/internal/services/cleaner.go similarity index 90% rename from pkg/services/cleaner.go rename to pkg/internal/services/cleaner.go index 34cb5be..c6d14eb 100644 --- a/pkg/services/cleaner.go +++ b/pkg/internal/services/cleaner.go @@ -1,7 +1,7 @@ package services import ( - "git.solsynth.dev/hydrogen/interactive/pkg/database" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/database" "github.com/rs/zerolog/log" "time" ) diff --git a/pkg/services/encryptor.go b/pkg/internal/services/encryptor.go similarity index 100% rename from pkg/services/encryptor.go rename to pkg/internal/services/encryptor.go diff --git a/pkg/services/jwt.go b/pkg/internal/services/jwt.go similarity index 100% rename from pkg/services/jwt.go rename to pkg/internal/services/jwt.go diff --git a/pkg/services/mailer.go b/pkg/internal/services/mailer.go similarity index 100% rename from pkg/services/mailer.go rename to pkg/internal/services/mailer.go diff --git a/pkg/services/posts.go b/pkg/internal/services/posts.go similarity index 97% rename from pkg/services/posts.go rename to pkg/internal/services/posts.go index ec343d7..b91cb48 100644 --- a/pkg/services/posts.go +++ b/pkg/internal/services/posts.go @@ -5,9 +5,9 @@ import ( "fmt" "time" - "git.solsynth.dev/hydrogen/interactive/pkg/database" - "git.solsynth.dev/hydrogen/interactive/pkg/models" - "git.solsynth.dev/hydrogen/passport/pkg/grpc/proto" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/database" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/models" + "git.solsynth.dev/hydrogen/passport/pkg/proto" "github.com/rs/zerolog/log" "github.com/samber/lo" "github.com/spf13/viper" diff --git a/pkg/services/realms.go b/pkg/internal/services/realms.go similarity index 62% rename from pkg/services/realms.go rename to pkg/internal/services/realms.go index 8d999c2..35af531 100644 --- a/pkg/services/realms.go +++ b/pkg/internal/services/realms.go @@ -4,10 +4,10 @@ import ( "context" "errors" "fmt" - "git.solsynth.dev/hydrogen/interactive/pkg/database" - "git.solsynth.dev/hydrogen/interactive/pkg/grpc" - "git.solsynth.dev/hydrogen/interactive/pkg/models" - "git.solsynth.dev/hydrogen/passport/pkg/grpc/proto" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/database" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/gap" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/models" + "git.solsynth.dev/hydrogen/passport/pkg/proto" "github.com/samber/lo" "gorm.io/gorm" "reflect" @@ -15,7 +15,11 @@ import ( func GetRealm(id uint) (models.Realm, error) { var realm models.Realm - response, err := grpc.Realms.GetRealm(context.Background(), &proto.RealmLookupRequest{ + pc, err := gap.H.DiscoverServiceGRPC("Hydrogen.Passport") + if err != nil { + return realm, err + } + response, err := proto.NewRealmsClient(pc).GetRealm(context.Background(), &proto.RealmLookupRequest{ Id: lo.ToPtr(uint64(id)), }) if err != nil { @@ -26,7 +30,11 @@ func GetRealm(id uint) (models.Realm, error) { func GetRealmWithAlias(alias string) (models.Realm, error) { var realm models.Realm - response, err := grpc.Realms.GetRealm(context.Background(), &proto.RealmLookupRequest{ + pc, err := gap.H.DiscoverServiceGRPC("Hydrogen.Passport") + if err != nil { + return realm, err + } + response, err := proto.NewRealmsClient(pc).GetRealm(context.Background(), &proto.RealmLookupRequest{ Alias: &alias, }) if err != nil { @@ -36,7 +44,11 @@ func GetRealmWithAlias(alias string) (models.Realm, error) { } func GetRealmMember(realmId uint, userId uint) (*proto.RealmMemberResponse, error) { - response, err := grpc.Realms.GetRealmMember(context.Background(), &proto.RealmMemberLookupRequest{ + pc, err := gap.H.DiscoverServiceGRPC("Hydrogen.Passport") + if err != nil { + return nil, err + } + response, err := proto.NewRealmsClient(pc).GetRealmMember(context.Background(), &proto.RealmMemberLookupRequest{ RealmId: uint64(realmId), UserId: lo.ToPtr(uint64(userId)), }) @@ -48,7 +60,11 @@ func GetRealmMember(realmId uint, userId uint) (*proto.RealmMemberResponse, erro } func ListRealmMember(realmId uint) ([]*proto.RealmMemberResponse, error) { - response, err := grpc.Realms.ListRealmMember(context.Background(), &proto.RealmMemberLookupRequest{ + pc, err := gap.H.DiscoverServiceGRPC("Hydrogen.Passport") + if err != nil { + return nil, err + } + response, err := proto.NewRealmsClient(pc).ListRealmMember(context.Background(), &proto.RealmMemberLookupRequest{ RealmId: uint64(realmId), }) if err != nil { diff --git a/pkg/views/favicon.png b/pkg/internal/views/favicon.png similarity index 100% rename from pkg/views/favicon.png rename to pkg/internal/views/favicon.png diff --git a/pkg/views/index.gohtml b/pkg/internal/views/index.gohtml similarity index 100% rename from pkg/views/index.gohtml rename to pkg/internal/views/index.gohtml diff --git a/pkg/views/open.gohtml b/pkg/internal/views/open.gohtml similarity index 100% rename from pkg/views/open.gohtml rename to pkg/internal/views/open.gohtml diff --git a/pkg/cmd/main.go b/pkg/main.go similarity index 69% rename from pkg/cmd/main.go rename to pkg/main.go index 49744eb..c742bd7 100644 --- a/pkg/cmd/main.go +++ b/pkg/main.go @@ -1,19 +1,19 @@ package main import ( - "git.solsynth.dev/hydrogen/interactive/pkg/grpc" - "git.solsynth.dev/hydrogen/interactive/pkg/server" - "git.solsynth.dev/hydrogen/interactive/pkg/services" + "git.solsynth.dev/hydrogen/interactive/pkg/internal" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/database" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/gap" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/grpc" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/server" + "git.solsynth.dev/hydrogen/interactive/pkg/internal/services" "github.com/robfig/cron/v3" - "os" - "os/signal" - "syscall" - - interactive "git.solsynth.dev/hydrogen/interactive/pkg" - "git.solsynth.dev/hydrogen/interactive/pkg/database" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/spf13/viper" + "os" + "os/signal" + "syscall" ) func init() { @@ -41,11 +41,10 @@ func main() { } // Connect other services - if err := grpc.ConnectPaperclip(); err != nil { + if err := gap.Register(); err != nil { log.Fatal().Err(err).Msg("An error occurred when connecting to paperclip...") - } - if err := grpc.ConnectPassport(); err != nil { - log.Fatal().Err(err).Msg("An error occurred when connecting to passport...") + } else { + gap.NewHyperClient() } // Configure timed tasks @@ -57,14 +56,17 @@ func main() { server.NewServer() go server.Listen() + grpc.NewGRPC() + go grpc.ListenGRPC() + // Messages - log.Info().Msgf("Interactive v%s is started...", interactive.AppVersion) + log.Info().Msgf("Interactive v%s is started...", pkg.AppVersion) quit := make(chan os.Signal, 1) signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) <-quit - log.Info().Msgf("Interactive v%s is quitting...", interactive.AppVersion) + log.Info().Msgf("Interactive v%s is quitting...", pkg.AppVersion) quartz.Stop() } diff --git a/pkg/server/auth.go b/pkg/server/auth.go deleted file mode 100644 index 16f9b55..0000000 --- a/pkg/server/auth.go +++ /dev/null @@ -1,50 +0,0 @@ -package server - -import ( - "git.solsynth.dev/hydrogen/interactive/pkg/services" - "github.com/gofiber/fiber/v2" - "strings" -) - -func authMiddleware(c *fiber.Ctx) error { - var token string - if cookie := c.Cookies(services.CookieAccessKey); len(cookie) > 0 { - token = cookie - } - if header := c.Get(fiber.HeaderAuthorization); len(header) > 0 { - tk := strings.Replace(header, "Bearer", "", 1) - token = strings.TrimSpace(tk) - } - - c.Locals("token", token) - - if err := authFunc(c); err != nil { - return err - } - - return c.Next() -} - -func authFunc(c *fiber.Ctx, overrides ...string) error { - var token string - if len(overrides) > 0 { - token = overrides[0] - } else { - if tk, ok := c.Locals("token").(string); !ok { - return fiber.NewError(fiber.StatusUnauthorized) - } else { - token = tk - } - } - - rtk := c.Cookies(services.CookieRefreshKey) - if user, atk, rtk, err := services.Authenticate(token, rtk); err == nil { - if atk != token { - services.SetJwtCookieSet(c, atk, rtk) - } - c.Locals("principal", user) - return nil - } else { - return fiber.NewError(fiber.StatusUnauthorized, err.Error()) - } -} diff --git a/pkg/server/well_known_api.go b/pkg/server/well_known_api.go deleted file mode 100644 index db04299..0000000 --- a/pkg/server/well_known_api.go +++ /dev/null @@ -1,16 +0,0 @@ -package server - -import ( - "github.com/gofiber/fiber/v2" - "github.com/spf13/viper" -) - -func getMetadata(c *fiber.Ctx) error { - return c.JSON(fiber.Map{ - "name": viper.GetString("name"), - "domain": viper.GetString("domain"), - "components": fiber.Map{ - "passport": viper.GetString("passport.endpoint"), - }, - }) -} diff --git a/pkg/services/attachments.go b/pkg/services/attachments.go deleted file mode 100644 index 3e90acb..0000000 --- a/pkg/services/attachments.go +++ /dev/null @@ -1,29 +0,0 @@ -package services - -import ( - "context" - "git.solsynth.dev/hydrogen/interactive/pkg/grpc" - pcpb "git.solsynth.dev/hydrogen/paperclip/pkg/grpc/proto" - "github.com/samber/lo" -) - -func GetAttachmentByID(id uint) (*pcpb.Attachment, error) { - return grpc.Attachments.GetAttachment(context.Background(), &pcpb.AttachmentLookupRequest{ - Id: lo.ToPtr(uint64(id)), - }) -} - -func GetAttachmentByUUID(uuid string) (*pcpb.Attachment, error) { - return grpc.Attachments.GetAttachment(context.Background(), &pcpb.AttachmentLookupRequest{ - Uuid: &uuid, - }) -} - -func CheckAttachmentByIDExists(id uint, usage string) bool { - _, err := grpc.Attachments.CheckAttachmentExists(context.Background(), &pcpb.AttachmentLookupRequest{ - Id: lo.ToPtr(uint64(id)), - Usage: &usage, - }) - - return err == nil -} diff --git a/settings.toml b/settings.toml index febc092..5f99ecd 100644 --- a/settings.toml +++ b/settings.toml @@ -1,9 +1,9 @@ -name = "Solarplaza" -maintainer = "SmartSheep Studio" +id = "interactive01" frontend = "https://lian.solsynth.dev" bind = "0.0.0.0:8445" +grpc_bind = "0.0.0.0:7445" domain = "im.solsynth.dev" secret = "LtTjzAGFLshwXhN4ZD4nG5KlMv1MWcsvfv03TSZYnT1VhiAnLIZFTnHUwR0XhGgi"