Skip to content

Instantly share code, notes, and snippets.

local ffi = require("ffi")
local authlib = ffi.load("/gateway/auth/main/libauth.so")
ffi.cdef([[
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef struct { const char *p; GoInt n; } GoString;
extern GoInt Authenticate(GoString p0);
package main
import "C"
//export Authenticate
func Authenticate(token string) int {
// Here you can write your authentication code.
// For demo purposes , let us compare the token with a hardcoded string "abc"
if token == "abc" {
return 1
{
"status": "Pass",
"dependencies":[
{
"Name":"isOracleUp",
"status":"Pass"
},
{
"Name":"isRedisUp",
"status":"Pass"
@myselfneerav
myselfneerav / values_pointers.go
Created July 21, 2020 14:29 — forked from josephspurrier/values_pointers.go
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value