From e670724c4c186661c2797272f222d806a9d8728e Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 22 Mar 2025 19:50:40 +0800 Subject: [PATCH] :sparkles: Captcha Gateway Toolkit --- pkg/nex/captcha.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pkg/nex/captcha.go diff --git a/pkg/nex/captcha.go b/pkg/nex/captcha.go new file mode 100644 index 0000000..80a7b24 --- /dev/null +++ b/pkg/nex/captcha.go @@ -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() +}