diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 704948a..e5b0d7c 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,8 +5,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -30,7 +81,7 @@
-
+
{
"customColor": "",
@@ -54,7 +105,7 @@
"git-widget-placeholder": "features/consul",
"go.import.settings.migrated": "true",
"go.sdk.automatically.set": "true",
- "last_opened_file_path": "/Users/littlesheep/Documents/Projects/Hydrogen/Passport/pkg/services",
+ "last_opened_file_path": "/Users/littlesheep",
"node.js.detected.package.eslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
diff --git a/pkg/internal/database/migrator.go b/pkg/internal/database/migrator.go
index 98bb097..febeaf2 100644
--- a/pkg/internal/database/migrator.go
+++ b/pkg/internal/database/migrator.go
@@ -1,7 +1,7 @@
package database
import (
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"gorm.io/gorm"
)
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
index c0ee4a2..7878576 100644
--- a/pkg/internal/gap/server.go
+++ b/pkg/internal/gap/server.go
@@ -17,21 +17,23 @@ func Register() error {
return err
}
- bind := strings.SplitN(viper.GetString("consul.srv_serve"), ":", 2)
- baseAddr := viper.GetString("consul.srv_http")
+ httpBind := strings.SplitN(viper.GetString("bind"), ":", 2)
+ grpcBind := strings.SplitN(viper.GetString("grpc_bind"), ":", 2)
- port, _ := strconv.Atoi(bind[1])
+ outboundIp, _ := GetOutboundIP()
+ port, _ := strconv.Atoi(httpBind[1])
registration := new(api.AgentServiceRegistration)
registration.ID = viper.GetString("id")
registration.Name = "Hydrogen.Passport"
- registration.Address = bind[0]
+ registration.Address = outboundIp.String()
registration.Port = port
registration.Check = &api.AgentServiceCheck{
- HTTP: fmt.Sprintf("%s/.well-known", baseAddr),
+ GRPC: fmt.Sprintf("%s:%s", outboundIp, grpcBind[1]),
+ HTTP: fmt.Sprintf("%s:%s/.well-known", outboundIp, httpBind[1]),
Timeout: "5s",
- Interval: "5s",
- DeregisterCriticalServiceAfter: "10s",
+ Interval: "1m",
+ DeregisterCriticalServiceAfter: "3m",
}
return client.Agent().ServiceRegister(registration)
diff --git a/pkg/internal/grpc/auth.go b/pkg/internal/grpc/auth.go
index 9ee0ad1..792716f 100644
--- a/pkg/internal/grpc/auth.go
+++ b/pkg/internal/grpc/auth.go
@@ -3,8 +3,8 @@ package grpc
import (
"context"
- "git.solsynth.dev/hydrogen/passport/pkg/grpc/proto"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/proto"
jsoniter "github.com/json-iterator/go"
"github.com/samber/lo"
)
diff --git a/pkg/internal/grpc/friendships.go b/pkg/internal/grpc/friendships.go
index f9275c4..9551ca0 100644
--- a/pkg/internal/grpc/friendships.go
+++ b/pkg/internal/grpc/friendships.go
@@ -3,9 +3,9 @@ package grpc
import (
"context"
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/grpc/proto"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/proto"
"github.com/samber/lo"
)
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/notify.go b/pkg/internal/grpc/notify.go
index f1bc325..482c7aa 100644
--- a/pkg/internal/grpc/notify.go
+++ b/pkg/internal/grpc/notify.go
@@ -4,9 +4,9 @@ import (
"context"
jsoniter "github.com/json-iterator/go"
- "git.solsynth.dev/hydrogen/passport/pkg/grpc/proto"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/proto"
"github.com/samber/lo"
)
diff --git a/pkg/internal/grpc/realms.go b/pkg/internal/grpc/realms.go
index c8330ee..345048b 100644
--- a/pkg/internal/grpc/realms.go
+++ b/pkg/internal/grpc/realms.go
@@ -3,10 +3,10 @@ package grpc
import (
"context"
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
"git.solsynth.dev/hydrogen/passport/pkg/proto"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
"github.com/samber/lo"
"google.golang.org/protobuf/types/known/emptypb"
)
diff --git a/pkg/internal/grpc/server.go b/pkg/internal/grpc/server.go
index e5f5312..148f5a1 100644
--- a/pkg/internal/grpc/server.go
+++ b/pkg/internal/grpc/server.go
@@ -1,35 +1,43 @@
package grpc
import (
+ "google.golang.org/grpc/reflection"
"net"
- "git.solsynth.dev/hydrogen/passport/pkg/grpc/proto"
+ "git.solsynth.dev/hydrogen/passport/pkg/proto"
"github.com/spf13/viper"
"google.golang.org/grpc"
- "google.golang.org/grpc/reflection"
)
+import health "google.golang.org/grpc/health/grpc_health_v1"
+
type Server struct {
proto.UnimplementedAuthServer
proto.UnimplementedNotifyServer
proto.UnimplementedFriendshipsServer
proto.UnimplementedRealmsServer
+ health.UnimplementedHealthServer
}
-func StartGrpc() error {
+var S *grpc.Server
+
+func NewGRPC() {
+ S = grpc.NewServer()
+
+ proto.RegisterAuthServer(S, &Server{})
+ proto.RegisterNotifyServer(S, &Server{})
+ proto.RegisterFriendshipsServer(S, &Server{})
+ proto.RegisterRealmsServer(S, &Server{})
+ health.RegisterHealthServer(S, &Server{})
+
+ reflection.Register(S)
+}
+
+func ListenGRPC() error {
listen, err := net.Listen("tcp", viper.GetString("grpc_bind"))
if err != nil {
return err
}
- server := grpc.NewServer()
-
- proto.RegisterAuthServer(server, &Server{})
- proto.RegisterNotifyServer(server, &Server{})
- proto.RegisterFriendshipsServer(server, &Server{})
- proto.RegisterRealmsServer(server, &Server{})
-
- reflection.Register(server)
-
- return server.Serve(listen)
+ return S.Serve(listen)
}
diff --git a/pkg/internal/server/accounts_api.go b/pkg/internal/server/accounts_api.go
index 8c22673..4f64b82 100644
--- a/pkg/internal/server/accounts_api.go
+++ b/pkg/internal/server/accounts_api.go
@@ -5,11 +5,11 @@ import (
"strconv"
"time"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
"github.com/gofiber/fiber/v2"
jsoniter "github.com/json-iterator/go"
"github.com/spf13/viper"
diff --git a/pkg/internal/server/admin/badges_api.go b/pkg/internal/server/admin/badges_api.go
index 2696f9a..bcfdc5b 100644
--- a/pkg/internal/server/admin/badges_api.go
+++ b/pkg/internal/server/admin/badges_api.go
@@ -3,10 +3,10 @@ package admin
import (
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
"github.com/gofiber/fiber/v2"
)
diff --git a/pkg/internal/server/auth_api.go b/pkg/internal/server/auth_api.go
index 528b7db..82722bd 100644
--- a/pkg/internal/server/auth_api.go
+++ b/pkg/internal/server/auth_api.go
@@ -2,12 +2,12 @@ package server
import (
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
"time"
"github.com/gofiber/fiber/v2"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
)
func doAuthenticate(c *fiber.Ctx) error {
diff --git a/pkg/internal/server/auth_middleware.go b/pkg/internal/server/auth_middleware.go
index 05cf3fb..91583aa 100644
--- a/pkg/internal/server/auth_middleware.go
+++ b/pkg/internal/server/auth_middleware.go
@@ -3,7 +3,7 @@ package server
import (
"strings"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
"github.com/gofiber/fiber/v2"
)
diff --git a/pkg/internal/server/avatar_api.go b/pkg/internal/server/avatar_api.go
index cffb5cc..c4d8848 100644
--- a/pkg/internal/server/avatar_api.go
+++ b/pkg/internal/server/avatar_api.go
@@ -5,11 +5,11 @@ import (
"fmt"
pcpb "git.solsynth.dev/hydrogen/paperclip/pkg/grpc/proto"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/grpc"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/grpc"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
"github.com/gofiber/fiber/v2"
"github.com/samber/lo"
)
diff --git a/pkg/internal/server/factors_api.go b/pkg/internal/server/factors_api.go
index ae655bf..2bff580 100644
--- a/pkg/internal/server/factors_api.go
+++ b/pkg/internal/server/factors_api.go
@@ -1,7 +1,7 @@
package server
import (
- "git.solsynth.dev/hydrogen/passport/pkg/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
"github.com/gofiber/fiber/v2"
)
diff --git a/pkg/internal/server/friendships_api.go b/pkg/internal/server/friendships_api.go
index fcc15ba..b7a87fb 100644
--- a/pkg/internal/server/friendships_api.go
+++ b/pkg/internal/server/friendships_api.go
@@ -1,9 +1,9 @@
package server
import (
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
"github.com/gofiber/fiber/v2"
)
diff --git a/pkg/internal/server/notifications_api.go b/pkg/internal/server/notifications_api.go
index 2367f48..b6ccc14 100644
--- a/pkg/internal/server/notifications_api.go
+++ b/pkg/internal/server/notifications_api.go
@@ -1,10 +1,10 @@
package server
import (
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
"github.com/gofiber/fiber/v2"
)
diff --git a/pkg/internal/server/notify_api.go b/pkg/internal/server/notify_api.go
index 8824509..24e18de 100644
--- a/pkg/internal/server/notify_api.go
+++ b/pkg/internal/server/notify_api.go
@@ -1,9 +1,9 @@
package server
import (
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
"github.com/gofiber/fiber/v2"
)
diff --git a/pkg/internal/server/page_api.go b/pkg/internal/server/page_api.go
index 1f25188..b2b3958 100644
--- a/pkg/internal/server/page_api.go
+++ b/pkg/internal/server/page_api.go
@@ -1,9 +1,9 @@
package server
import (
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
"github.com/gofiber/fiber/v2"
)
diff --git a/pkg/internal/server/realm_members_api.go b/pkg/internal/server/realm_members_api.go
index ac488ad..2bed1f1 100644
--- a/pkg/internal/server/realm_members_api.go
+++ b/pkg/internal/server/realm_members_api.go
@@ -1,10 +1,10 @@
package server
import (
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
"github.com/gofiber/fiber/v2"
)
diff --git a/pkg/internal/server/realms_api.go b/pkg/internal/server/realms_api.go
index 8944d02..b4e5d8d 100644
--- a/pkg/internal/server/realms_api.go
+++ b/pkg/internal/server/realms_api.go
@@ -1,10 +1,10 @@
package server
import (
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
"github.com/gofiber/fiber/v2"
)
diff --git a/pkg/internal/server/security_api.go b/pkg/internal/server/security_api.go
index 34e857e..6b6a043 100644
--- a/pkg/internal/server/security_api.go
+++ b/pkg/internal/server/security_api.go
@@ -1,8 +1,8 @@
package server
import (
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/gofiber/fiber/v2"
)
diff --git a/pkg/internal/server/startup.go b/pkg/internal/server/startup.go
index 0e4a2ff..17263e8 100644
--- a/pkg/internal/server/startup.go
+++ b/pkg/internal/server/startup.go
@@ -6,10 +6,10 @@ import (
"github.com/gofiber/contrib/websocket"
- "git.solsynth.dev/hydrogen/passport/pkg"
- "git.solsynth.dev/hydrogen/passport/pkg/i18n"
- "git.solsynth.dev/hydrogen/passport/pkg/server/admin"
- "git.solsynth.dev/hydrogen/passport/pkg/server/ui"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/i18n"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/server/admin"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/server/ui"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/gofiber/fiber/v2/middleware/favicon"
diff --git a/pkg/internal/server/ui/accounts.go b/pkg/internal/server/ui/accounts.go
index b1a394a..d8ecaa2 100644
--- a/pkg/internal/server/ui/accounts.go
+++ b/pkg/internal/server/ui/accounts.go
@@ -5,8 +5,8 @@ import (
"html/template"
"time"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/gofiber/fiber/v2"
"github.com/gomarkdown/markdown"
"github.com/gomarkdown/markdown/html"
diff --git a/pkg/internal/server/ui/index.go b/pkg/internal/server/ui/index.go
index eb8b19f..11bc703 100644
--- a/pkg/internal/server/ui/index.go
+++ b/pkg/internal/server/ui/index.go
@@ -3,8 +3,8 @@ package ui
import (
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
"github.com/gofiber/fiber/v2"
)
diff --git a/pkg/internal/server/ui/mfa.go b/pkg/internal/server/ui/mfa.go
index 08d6747..670f0f6 100644
--- a/pkg/internal/server/ui/mfa.go
+++ b/pkg/internal/server/ui/mfa.go
@@ -2,9 +2,9 @@ package ui
import (
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
"github.com/gofiber/fiber/v2"
"github.com/nicksnyder/go-i18n/v2/i18n"
"github.com/samber/lo"
diff --git a/pkg/internal/server/ui/oauth.go b/pkg/internal/server/ui/oauth.go
index 5092698..839eabf 100644
--- a/pkg/internal/server/ui/oauth.go
+++ b/pkg/internal/server/ui/oauth.go
@@ -2,9 +2,9 @@ package ui
import (
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
"github.com/gofiber/fiber/v2"
"github.com/nicksnyder/go-i18n/v2/i18n"
"github.com/samber/lo"
diff --git a/pkg/internal/server/ui/signin.go b/pkg/internal/server/ui/signin.go
index b2a4d0b..443101b 100644
--- a/pkg/internal/server/ui/signin.go
+++ b/pkg/internal/server/ui/signin.go
@@ -2,8 +2,8 @@ package ui
import (
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
"github.com/gofiber/fiber/v2"
"github.com/nicksnyder/go-i18n/v2/i18n"
"github.com/samber/lo"
diff --git a/pkg/internal/server/ui/signup.go b/pkg/internal/server/ui/signup.go
index 28e9d49..cf5bfa9 100644
--- a/pkg/internal/server/ui/signup.go
+++ b/pkg/internal/server/ui/signup.go
@@ -2,10 +2,10 @@ package ui
import (
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
- "git.solsynth.dev/hydrogen/passport/pkg/utils"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/utils"
"github.com/gofiber/fiber/v2"
"github.com/nicksnyder/go-i18n/v2/i18n"
"github.com/samber/lo"
diff --git a/pkg/internal/server/userinfo_api.go b/pkg/internal/server/userinfo_api.go
index ed2d1f0..eb06de5 100644
--- a/pkg/internal/server/userinfo_api.go
+++ b/pkg/internal/server/userinfo_api.go
@@ -1,8 +1,8 @@
package server
import (
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/gofiber/fiber/v2"
)
diff --git a/pkg/internal/server/ws.go b/pkg/internal/server/ws.go
index 5199809..61d2d6c 100644
--- a/pkg/internal/server/ws.go
+++ b/pkg/internal/server/ws.go
@@ -3,8 +3,8 @@ package server
import (
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
"github.com/gofiber/contrib/websocket"
jsoniter "github.com/json-iterator/go"
"github.com/rs/zerolog/log"
diff --git a/pkg/internal/services/accounts.go b/pkg/internal/services/accounts.go
index 11e7f85..a84d9f9 100644
--- a/pkg/internal/services/accounts.go
+++ b/pkg/internal/services/accounts.go
@@ -6,8 +6,8 @@ import (
"gorm.io/datatypes"
"time"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/google/uuid"
"github.com/samber/lo"
"gorm.io/gorm"
diff --git a/pkg/internal/services/auth.go b/pkg/internal/services/auth.go
index 42b2fb1..9e40307 100644
--- a/pkg/internal/services/auth.go
+++ b/pkg/internal/services/auth.go
@@ -7,7 +7,7 @@ import (
jsoniter "github.com/json-iterator/go"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/gofiber/fiber/v2"
"github.com/rs/zerolog/log"
)
diff --git a/pkg/internal/services/badges.go b/pkg/internal/services/badges.go
index ef40b02..9718047 100644
--- a/pkg/internal/services/badges.go
+++ b/pkg/internal/services/badges.go
@@ -1,8 +1,8 @@
package services
import (
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
)
func GrantBadge(user models.Account, badge models.Badge) error {
diff --git a/pkg/internal/services/cleaner.go b/pkg/internal/services/cleaner.go
index 1f398f0..d124f3e 100644
--- a/pkg/internal/services/cleaner.go
+++ b/pkg/internal/services/cleaner.go
@@ -1,7 +1,7 @@
package services
import (
- "git.solsynth.dev/hydrogen/passport/pkg/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
"github.com/rs/zerolog/log"
"time"
)
diff --git a/pkg/internal/services/clients.go b/pkg/internal/services/clients.go
index 6f98bce..8cf38cd 100644
--- a/pkg/internal/services/clients.go
+++ b/pkg/internal/services/clients.go
@@ -3,8 +3,8 @@ package services
import (
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
)
func GetThirdClient(id string) (models.ThirdClient, error) {
diff --git a/pkg/internal/services/connections.go b/pkg/internal/services/connections.go
index 02e84c5..f38ad3a 100644
--- a/pkg/internal/services/connections.go
+++ b/pkg/internal/services/connections.go
@@ -3,7 +3,7 @@ package services
import (
"sync"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/gofiber/contrib/websocket"
)
diff --git a/pkg/internal/services/e2ee.go b/pkg/internal/services/e2ee.go
index 6197c02..a119625 100644
--- a/pkg/internal/services/e2ee.go
+++ b/pkg/internal/services/e2ee.go
@@ -1,7 +1,7 @@
package services
import (
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/gofiber/contrib/websocket"
"github.com/gofiber/fiber/v2"
"time"
diff --git a/pkg/internal/services/events.go b/pkg/internal/services/events.go
index 66af86d..fa626b9 100644
--- a/pkg/internal/services/events.go
+++ b/pkg/internal/services/events.go
@@ -1,8 +1,8 @@
package services
import (
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
)
func AddEvent(user models.Account, event, target, ip, ua string) models.ActionEvent {
diff --git a/pkg/internal/services/factors.go b/pkg/internal/services/factors.go
index 33fb93e..4a30bf8 100644
--- a/pkg/internal/services/factors.go
+++ b/pkg/internal/services/factors.go
@@ -4,8 +4,8 @@ import (
"fmt"
"github.com/samber/lo"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/google/uuid"
"github.com/spf13/viper"
)
diff --git a/pkg/internal/services/friendships.go b/pkg/internal/services/friendships.go
index 4c0a039..89d0385 100644
--- a/pkg/internal/services/friendships.go
+++ b/pkg/internal/services/friendships.go
@@ -4,8 +4,8 @@ import (
"errors"
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"gorm.io/gorm"
)
diff --git a/pkg/internal/services/mfa.go b/pkg/internal/services/mfa.go
index 116b173..8126f9b 100644
--- a/pkg/internal/services/mfa.go
+++ b/pkg/internal/services/mfa.go
@@ -1,7 +1,7 @@
package services
import (
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/nicksnyder/go-i18n/v2/i18n"
)
diff --git a/pkg/internal/services/notifications.go b/pkg/internal/services/notifications.go
index c9c65f6..f9db8ae 100644
--- a/pkg/internal/services/notifications.go
+++ b/pkg/internal/services/notifications.go
@@ -3,8 +3,8 @@ package services
import (
"context"
"firebase.google.com/go/messaging"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/rs/zerolog/log"
"github.com/sideshow/apns2"
payload2 "github.com/sideshow/apns2/payload"
diff --git a/pkg/internal/services/realms.go b/pkg/internal/services/realms.go
index a51a366..46b81da 100644
--- a/pkg/internal/services/realms.go
+++ b/pkg/internal/services/realms.go
@@ -2,8 +2,8 @@ package services
import (
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/samber/lo"
)
diff --git a/pkg/internal/services/ticker_maintainer.go b/pkg/internal/services/ticker_maintainer.go
index e80fa69..78fdcf7 100644
--- a/pkg/internal/services/ticker_maintainer.go
+++ b/pkg/internal/services/ticker_maintainer.go
@@ -1,8 +1,8 @@
package services
import (
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"time"
diff --git a/pkg/internal/services/ticket.go b/pkg/internal/services/ticket.go
index f6d6d19..7039e0c 100644
--- a/pkg/internal/services/ticket.go
+++ b/pkg/internal/services/ticket.go
@@ -6,8 +6,8 @@ import (
"github.com/google/uuid"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/samber/lo"
)
diff --git a/pkg/internal/services/ticket_queries.go b/pkg/internal/services/ticket_queries.go
index 6412868..3c9d643 100644
--- a/pkg/internal/services/ticket_queries.go
+++ b/pkg/internal/services/ticket_queries.go
@@ -1,8 +1,8 @@
package services
import (
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
)
func GetTicket(id uint) (models.AuthTicket, error) {
diff --git a/pkg/internal/services/ticket_token.go b/pkg/internal/services/ticket_token.go
index f3a67db..4cb4772 100644
--- a/pkg/internal/services/ticket_token.go
+++ b/pkg/internal/services/ticket_token.go
@@ -2,8 +2,8 @@ package services
import (
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/samber/lo"
"github.com/spf13/viper"
"strconv"
diff --git a/pkg/internal/services/tokens.go b/pkg/internal/services/tokens.go
index 96b4326..f297444 100644
--- a/pkg/internal/services/tokens.go
+++ b/pkg/internal/services/tokens.go
@@ -5,8 +5,8 @@ import (
"strings"
"time"
- "git.solsynth.dev/hydrogen/passport/pkg/database"
- "git.solsynth.dev/hydrogen/passport/pkg/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/database"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/google/uuid"
"github.com/spf13/viper"
)
diff --git a/pkg/internal/utils/request.go b/pkg/internal/utils/request.go
index e82d7bc..fd43caa 100644
--- a/pkg/internal/utils/request.go
+++ b/pkg/internal/utils/request.go
@@ -2,7 +2,7 @@ package utils
import (
"fmt"
- "git.solsynth.dev/hydrogen/passport/pkg/services"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
"github.com/go-playground/validator/v10"
"github.com/gofiber/fiber/v2"
"github.com/samber/lo"
diff --git a/pkg/main.go b/pkg/main.go
index a41b454..870be1f 100644
--- a/pkg/main.go
+++ b/pkg/main.go
@@ -51,13 +51,13 @@ func main() {
log.Error().Err(err).Msg("An error occurred when registering service to gateway...")
}
if err := services.SetupFirebase(); err != nil {
- log.Error().Err(err).Msg("An error occurred when connecting firebase...")
+ log.Error().Err(err).Msg("An error occurred when connecting Firebase...")
}
if err := services.SetupAPNS(); err != nil {
log.Error().Err(err).Msg("An error occurred when connecting APNs...")
}
if err := grpc.ConnectPaperclip(); err != nil {
- log.Fatal().Err(err).Msg("An error occurred when connecting to paperclip...")
+ log.Fatal().Err(err).Msg("An error occurred when connecting to Paperclip...")
}
// Server
@@ -65,9 +65,8 @@ func main() {
go server.Listen()
// Grpc Server
- if err := grpc.StartGrpc(); err != nil {
- log.Fatal().Err(err).Msg("An message occurred when starting grpc server.")
- }
+ grpc.NewGRPC()
+ go grpc.ListenGRPC()
// Configure timed tasks
quartz := cron.New(cron.WithLogger(cron.VerbosePrintfLogger(&log.Logger)))
diff --git a/settings.toml b/settings.toml
index ec6be6e..6e0415d 100644
--- a/settings.toml
+++ b/settings.toml
@@ -21,8 +21,6 @@ print_routes = false
[consul]
addr = "127.0.0.1:8500"
-srv_serve = "127.0.0.1:8444"
-srv_http = "http://192.168.50.83:8444"
[paperclip]
endpoint = "http://localhost:8443"