Nexus/pkg/nex/captcha.go
2025-03-22 19:50:40 +08:00

20 lines
378 B
Go

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()
}