✨ Captcha Gateway
This commit is contained in:
14
pkg/internal/grpc/captcha.go
Normal file
14
pkg/internal/grpc/captcha.go
Normal file
@ -0,0 +1,14 @@
|
||||
package grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/internal/captcha"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/proto"
|
||||
)
|
||||
|
||||
func (v *Server) CheckCaptcha(_ context.Context, req *proto.CheckCaptchaRequest) (*proto.CheckCaptchaResponse, error) {
|
||||
return &proto.CheckCaptchaResponse{
|
||||
IsValid: captcha.Validate(req.Token, req.RemoteIp),
|
||||
}, nil
|
||||
}
|
@ -19,6 +19,7 @@ type Server struct {
|
||||
proto.UnimplementedDatabaseServiceServer
|
||||
proto.UnimplementedStreamServiceServer
|
||||
proto.UnimplementedAllocatorServiceServer
|
||||
proto.UnimplementedCaptchaServiceServer
|
||||
health.UnimplementedHealthServer
|
||||
|
||||
srv *grpc.Server
|
||||
@ -33,6 +34,7 @@ func NewServer() *Server {
|
||||
proto.RegisterDatabaseServiceServer(server.srv, server)
|
||||
proto.RegisterStreamServiceServer(server.srv, server)
|
||||
proto.RegisterAllocatorServiceServer(server.srv, server)
|
||||
proto.RegisterCaptchaServiceServer(server.srv, server)
|
||||
health.RegisterHealthServer(server.srv, server)
|
||||
|
||||
reflection.Register(server.srv)
|
||||
|
Reference in New Issue
Block a user