✨ Captcha Gateway Toolkit
This commit is contained in:
parent
62dcbbf424
commit
e670724c4c
19
pkg/nex/captcha.go
Normal file
19
pkg/nex/captcha.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package nex
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"git.solsynth.dev/hypernet/nexus/pkg/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (v *Conn) ValidateCaptcha(token, ip string) bool {
|
||||||
|
client := proto.NewCaptchaServiceClient(v.nexusConn)
|
||||||
|
resp, err := client.CheckCaptcha(context.Background(), &proto.CheckCaptchaRequest{
|
||||||
|
Token: token,
|
||||||
|
RemoteIp: ip,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return resp.GetIsValid()
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user