|
|
|
@ -19,22 +19,22 @@ type user struct { |
|
|
|
|
Confirmed bool |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type gRPCServer struct { |
|
|
|
|
type authDBServer struct { |
|
|
|
|
mu sync.Mutex |
|
|
|
|
users map[string]*user |
|
|
|
|
api.UnimplementedAuthDBServer |
|
|
|
|
id int32 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func NewServer() *gRPCServer { |
|
|
|
|
return &gRPCServer{ |
|
|
|
|
func NewServer() *authDBServer { |
|
|
|
|
return &authDBServer{ |
|
|
|
|
mu: sync.Mutex{}, |
|
|
|
|
users: make(map[string]*user), |
|
|
|
|
id: 0, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (s *gRPCServer) Login(ctx context.Context, req *api.LoginRequest) (*api.LoginResponse, error) { |
|
|
|
|
func (s *authDBServer) Login(ctx context.Context, req *api.LoginRequest) (*api.LoginResponse, error) { |
|
|
|
|
s.mu.Lock() |
|
|
|
|
defer s.mu.Unlock() |
|
|
|
|
|
|
|
|
@ -59,7 +59,7 @@ func (s *gRPCServer) Login(ctx context.Context, req *api.LoginRequest) (*api.Log |
|
|
|
|
}, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (s *gRPCServer) Registration(ctx context.Context, req *api.RegistrationRequest) (*api.RegistrationResponse, error) { |
|
|
|
|
func (s *authDBServer) Registration(ctx context.Context, req *api.RegistrationRequest) (*api.RegistrationResponse, error) { |
|
|
|
|
s.mu.Lock() |
|
|
|
|
defer s.mu.Unlock() |
|
|
|
|
|
|
|
|
@ -115,7 +115,7 @@ func (s *gRPCServer) Registration(ctx context.Context, req *api.RegistrationRequ |
|
|
|
|
}, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (s *gRPCServer) Confirmation(ctx context.Context, req *api.ConfirmationRequest) (*api.ConfirmationResponse, error) { |
|
|
|
|
func (s *authDBServer) Confirmation(ctx context.Context, req *api.ConfirmationRequest) (*api.ConfirmationResponse, error) { |
|
|
|
|
s.mu.Lock() |
|
|
|
|
defer s.mu.Unlock() |
|
|
|
|
|
|
|
|
|