add mission details, allow specification of float/int from sqf
This commit is contained in:
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
*.pbo
|
||||||
|
*.bak
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
*.so
|
||||||
|
|
||||||
|
RangerMetrics.h
|
||||||
|
|
||||||
|
RangerMetrics_x64.h
|
||||||
@@ -2,42 +2,38 @@
|
|||||||
|
|
||||||
#include "extensionCallback.h"
|
#include "extensionCallback.h"
|
||||||
|
|
||||||
extern void goRVExtension(char *output, size_t outputSize, char *input);
|
extern void goRVExtension(char *output, int outputSize, char *input);
|
||||||
extern void goRVExtensionVersion(char *output, size_t outputSize);
|
extern void goRVExtensionVersion(char *output, int outputSize);
|
||||||
extern void goRVExtensionArgs(char* output, size_t outputSize, char* input, char** argv, int argc);
|
extern int goRVExtensionArgs(char* output, int outputSize, char* input, char** argv, int argc);
|
||||||
// extern void goRVExtensionRegisterCallback(extensionCallback fnc);
|
// extern void goRVExtensionRegisterCallback(extensionCallback fnc);
|
||||||
|
|
||||||
#ifdef WIN64
|
//--- Called by Engine on extension load
|
||||||
__declspec(dllexport) void RVExtension(char *output, size_t outputSize, char *input) {
|
__attribute__((dllexport)) void RVExtensionVersion(char *output, int outputSize);
|
||||||
|
//--- STRING callExtension STRING
|
||||||
|
__attribute__((dllexport)) void RVExtension(char *output, int outputSize, char *input);
|
||||||
|
//--- STRING callExtension ARRAY
|
||||||
|
__attribute__((dllexport)) int RVExtensionArgs(char *output, int outputSize, char* input, char** argv, int argc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void RVExtension(char *output, int outputSize, char *input)
|
||||||
|
{
|
||||||
goRVExtension(output, outputSize, input);
|
goRVExtension(output, outputSize, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(dllexport) void RVExtensionVersion(char *output, size_t outputSize) {
|
void RVExtensionVersion(char *output, int outputSize)
|
||||||
|
{
|
||||||
goRVExtensionVersion(output, outputSize);
|
goRVExtensionVersion(output, outputSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(dllexport) void RVExtensionArgs(char* output, size_t outputSize, char* input, char** argv, int argc) {
|
|
||||||
goRVExtensionArgs(output, outputSize, input, argv, argc);
|
int RVExtensionArgs(char *output, int outputSize, char* input, char** argv, int argc)
|
||||||
|
{
|
||||||
|
return goRVExtensionArgs(output, outputSize, input, argv, argc);
|
||||||
}
|
}
|
||||||
|
|
||||||
//__declspec(dllexport) void RVExtensionRegisterCallback(extensionCallback fnc) {
|
|
||||||
// goRVExtensionRegisterCallback(fnc);
|
|
||||||
//}
|
|
||||||
#else
|
|
||||||
__declspec(dllexport) void __stdcall _RVExtension(char *output, size_t outputSize, char *input) {
|
|
||||||
goRVExtension(output, outputSize, input);
|
|
||||||
}
|
|
||||||
|
|
||||||
__declspec(dllexport) void __stdcall _RVExtensionVersion(char *output, size_t outputSize) {
|
// __declspec(dllexport) void RVExtensionRegisterCallback(extensionCallback fnc) {
|
||||||
goRVExtensionVersion(output, outputSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
__declspec(dllexport) void __stdcall _RVExtensionArgs(char* output, size_t outputSize, char* input, char** argv, int argc) {
|
|
||||||
goRVExtensionArgs(output, outputSize, input, argv, argc);
|
|
||||||
}
|
|
||||||
|
|
||||||
// __declspec(dllexport) void __stdcall _RVExtensionRegisterCallback(extensionCallback fnc) {
|
|
||||||
// goRVExtensionRegisterCallback(fnc);
|
// goRVExtensionRegisterCallback(fnc);
|
||||||
// }
|
// }
|
||||||
#endif
|
|
||||||
// do this for all the other exported functions
|
|
||||||
|
|||||||
BIN
a3influx.dll
BIN
a3influx.dll
Binary file not shown.
Binary file not shown.
87
a3influx.h
87
a3influx.h
@@ -1,87 +0,0 @@
|
|||||||
/* Code generated by cmd/cgo; DO NOT EDIT. */
|
|
||||||
|
|
||||||
/* package github.com/7cav/a3-fone-home */
|
|
||||||
|
|
||||||
|
|
||||||
#line 1 "cgo-builtin-export-prolog"
|
|
||||||
|
|
||||||
#include <stddef.h> /* for ptrdiff_t below */
|
|
||||||
|
|
||||||
#ifndef GO_CGO_EXPORT_PROLOGUE_H
|
|
||||||
#define GO_CGO_EXPORT_PROLOGUE_H
|
|
||||||
|
|
||||||
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
|
||||||
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Start of preamble from import "C" comments. */
|
|
||||||
|
|
||||||
|
|
||||||
#line 3 "arma.go"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "extensionCallback.h"
|
|
||||||
|
|
||||||
#line 1 "cgo-generated-wrapper"
|
|
||||||
|
|
||||||
|
|
||||||
/* End of preamble from import "C" comments. */
|
|
||||||
|
|
||||||
|
|
||||||
/* Start of boilerplate cgo prologue. */
|
|
||||||
#line 1 "cgo-gcc-export-header-prolog"
|
|
||||||
|
|
||||||
#ifndef GO_CGO_PROLOGUE_H
|
|
||||||
#define GO_CGO_PROLOGUE_H
|
|
||||||
|
|
||||||
typedef signed char GoInt8;
|
|
||||||
typedef unsigned char GoUint8;
|
|
||||||
typedef short GoInt16;
|
|
||||||
typedef unsigned short GoUint16;
|
|
||||||
typedef int GoInt32;
|
|
||||||
typedef unsigned int GoUint32;
|
|
||||||
typedef long long GoInt64;
|
|
||||||
typedef unsigned long long GoUint64;
|
|
||||||
typedef GoInt64 GoInt;
|
|
||||||
typedef GoUint64 GoUint;
|
|
||||||
typedef __SIZE_TYPE__ GoUintptr;
|
|
||||||
typedef float GoFloat32;
|
|
||||||
typedef double GoFloat64;
|
|
||||||
typedef float _Complex GoComplex64;
|
|
||||||
typedef double _Complex GoComplex128;
|
|
||||||
|
|
||||||
/*
|
|
||||||
static assertion to make sure the file is being used on architecture
|
|
||||||
at least with matching size of GoInt.
|
|
||||||
*/
|
|
||||||
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
|
|
||||||
|
|
||||||
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
|
||||||
typedef _GoString_ GoString;
|
|
||||||
#endif
|
|
||||||
typedef void *GoMap;
|
|
||||||
typedef void *GoChan;
|
|
||||||
typedef struct { void *t; void *v; } GoInterface;
|
|
||||||
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* End of boilerplate cgo prologue. */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern __declspec(dllexport) void goRVExtensionVersion(char* output, size_t outputsize);
|
|
||||||
extern __declspec(dllexport) GoInt goRVExtensionArgs(char* output, size_t outputsize, char* input, char** argv, int argc);
|
|
||||||
extern __declspec(dllexport) void goRVExtension(char* output, size_t outputsize, char* input);
|
|
||||||
extern __declspec(dllexport) void goRVExtensionRegisterCallback(extensionCallback fnc);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
BIN
a3influx_x64.dll
BIN
a3influx_x64.dll
Binary file not shown.
112
arma.go
112
arma.go
@@ -29,7 +29,7 @@ func runExtensionCallback(name *C.char, function *C.char, data *C.char) C.int {
|
|||||||
|
|
||||||
//export goRVExtensionVersion
|
//export goRVExtensionVersion
|
||||||
func goRVExtensionVersion(output *C.char, outputsize C.size_t) {
|
func goRVExtensionVersion(output *C.char, outputsize C.size_t) {
|
||||||
result := C.CString("Version 1.2.3")
|
result := C.CString("Version 1.0")
|
||||||
defer C.free(unsafe.Pointer(result))
|
defer C.free(unsafe.Pointer(result))
|
||||||
var size = C.strlen(result) + 1
|
var size = C.strlen(result) + 1
|
||||||
if size > outputsize {
|
if size > outputsize {
|
||||||
@@ -73,28 +73,56 @@ func callBackExample() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
func sendToInflux(data string) {
|
func sendToInflux(data string) {
|
||||||
|
|
||||||
fields := strings.Split(data, ",")
|
a3Data := strings.Split(data, ",")
|
||||||
|
|
||||||
host := fields[0]
|
host := a3Data[0]
|
||||||
token := fields[1]
|
token := a3Data[1]
|
||||||
org := fields[2]
|
org := a3Data[2]
|
||||||
bucket := fields[3]
|
bucket := a3Data[3]
|
||||||
profile := fields[4]
|
profile, locality := a3Data[4], a3Data[5]
|
||||||
locality := fields[5]
|
missionName, worldName, serverName := a3Data[6], a3Data[7], a3Data[8]
|
||||||
metric := fields[6]
|
metric := a3Data[9]
|
||||||
value := fields[7]
|
valueType := a3Data[10]
|
||||||
|
|
||||||
int_value, err := strconv.Atoi(value)
|
tags := map[string]string{
|
||||||
|
"profile": profile,
|
||||||
|
"locality": locality,
|
||||||
|
"worldName": worldName,
|
||||||
|
"serverName": serverName,
|
||||||
|
}
|
||||||
|
fields := map[string]interface{}{
|
||||||
|
"missionName": missionName,
|
||||||
|
// "count": value,
|
||||||
|
}
|
||||||
|
|
||||||
|
var err error
|
||||||
|
// allow for float or int values
|
||||||
|
if valueType == "float" {
|
||||||
|
fields["count"], err = strconv.ParseFloat(a3Data[11], 64)
|
||||||
|
} else if valueType == "int" {
|
||||||
|
fields["count"], err = strconv.Atoi(a3Data[11])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (valueType != "float") && (valueType != "int") {
|
||||||
|
log.Println("valueType must be either 'float' or 'int'", metric, valueType, a3Data[11])
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// int_value, err := strconv.Atoi(value)
|
||||||
client := influxdb2.NewClient(host, token)
|
client := influxdb2.NewClient(host, token)
|
||||||
writeAPI := client.WriteAPI(org, bucket)
|
writeAPI := client.WriteAPI(org, bucket)
|
||||||
|
|
||||||
p := influxdb2.NewPoint(metric,
|
p := influxdb2.NewPoint(
|
||||||
map[string]string{"profile": profile, "locality": locality},
|
metric,
|
||||||
map[string]interface{}{"count": int_value},
|
tags,
|
||||||
time.Now())
|
fields,
|
||||||
|
time.Now(),
|
||||||
|
)
|
||||||
|
|
||||||
// write point asynchronously
|
// write point asynchronously
|
||||||
writeAPI.WritePoint(p)
|
writeAPI.WritePoint(p)
|
||||||
@@ -115,56 +143,6 @@ func sendToInflux(data string) {
|
|||||||
//logger.Println(err)
|
//logger.Println(err)
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
func sendToInflux(data string) {
|
|
||||||
|
|
||||||
fields := strings.Split(data, ",")
|
|
||||||
|
|
||||||
host := fields[0]
|
|
||||||
token := fields[1]
|
|
||||||
org := fields[2]
|
|
||||||
bucket := fields[3]
|
|
||||||
profile := fields[4]
|
|
||||||
locality := fields[5]
|
|
||||||
metric := fields[6]
|
|
||||||
value := fields[7]
|
|
||||||
|
|
||||||
|
|
||||||
client := influxdb2.NewClient(host, token)
|
|
||||||
writeAPI := client.WriteAPI(org, bucket)
|
|
||||||
int_value, err := strconv.Atoi(value)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
p := influxdb2.NewPoint(metric,
|
|
||||||
map[string]string{"profile": profile, "locality": locality},
|
|
||||||
map[string]interface{}{"count": int_value},
|
|
||||||
time.Now())
|
|
||||||
|
|
||||||
// write point asynchronously
|
|
||||||
writeAPI.WritePoint(p)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Flush writes
|
|
||||||
writeAPI.Flush()
|
|
||||||
|
|
||||||
defer client.Close()
|
|
||||||
|
|
||||||
f, err := os.OpenFile("a3metrics.log",
|
|
||||||
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
//logger := log.New(f, "", log.LstdFlags)
|
|
||||||
//logger.Println(err)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//export goRVExtension
|
//export goRVExtension
|
||||||
func goRVExtension(output *C.char, outputsize C.size_t, input *C.char) {
|
func goRVExtension(output *C.char, outputsize C.size_t, input *C.char) {
|
||||||
@@ -173,7 +151,7 @@ func goRVExtension(output *C.char, outputsize C.size_t, input *C.char) {
|
|||||||
go callBackExample()
|
go callBackExample()
|
||||||
} else {
|
} else {
|
||||||
// Return a result through callextension Arma call
|
// Return a result through callextension Arma call
|
||||||
temp := fmt.Sprintf("Rangermetrics: %s", C.GoString(input))
|
temp := fmt.Sprintf("Cavmetrics: %s", C.GoString(input))
|
||||||
result := C.CString(temp)
|
result := C.CString(temp)
|
||||||
defer C.free(unsafe.Pointer(result))
|
defer C.free(unsafe.Pointer(result))
|
||||||
var size = C.strlen(result) + 1
|
var size = C.strlen(result) + 1
|
||||||
|
|||||||
@@ -1,191 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
/*
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "extensionCallback.h"
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
|
|
||||||
)
|
|
||||||
|
|
||||||
var extensionCallbackFnc C.extensionCallback
|
|
||||||
|
|
||||||
func runExtensionCallback(name *C.char, function *C.char, data *C.char) C.int {
|
|
||||||
return C.runExtensionCallback(extensionCallbackFnc, name, function, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
//export goRVExtensionVersion
|
|
||||||
func goRVExtensionVersion(output *C.char, outputsize C.size_t) {
|
|
||||||
result := C.CString("Version 1.2.3")
|
|
||||||
defer C.free(unsafe.Pointer(result))
|
|
||||||
var size = C.strlen(result) + 1
|
|
||||||
if size > outputsize {
|
|
||||||
size = outputsize
|
|
||||||
}
|
|
||||||
C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), size)
|
|
||||||
}
|
|
||||||
|
|
||||||
//export goRVExtensionArgs
|
|
||||||
func goRVExtensionArgs(output *C.char, outputsize C.size_t, input *C.char, argv **C.char, argc C.int) int {
|
|
||||||
var offset = unsafe.Sizeof(uintptr(0))
|
|
||||||
var out []string
|
|
||||||
for index := C.int(0); index < argc; index++ {
|
|
||||||
out = append(out, C.GoString(*argv))
|
|
||||||
argv = (**C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(argv)) + offset))
|
|
||||||
}
|
|
||||||
temp := fmt.Sprintf("Function: %s nb params: %d params: %s!", C.GoString(input), argc, out)
|
|
||||||
|
|
||||||
// Return a result to Arma
|
|
||||||
result := C.CString(temp)
|
|
||||||
defer C.free(unsafe.Pointer(result))
|
|
||||||
var size = C.strlen(result) + 1
|
|
||||||
if size > outputsize {
|
|
||||||
size = outputsize
|
|
||||||
}
|
|
||||||
C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), size)
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
func callBackExample() {
|
|
||||||
name := C.CString("arma")
|
|
||||||
defer C.free(unsafe.Pointer(name))
|
|
||||||
function := C.CString("funcToExecute")
|
|
||||||
defer C.free(unsafe.Pointer(function))
|
|
||||||
// Make a callback to Arma
|
|
||||||
for i := 0; i < 3; i++ {
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
param := C.CString(fmt.Sprintf("Loop: %d", i))
|
|
||||||
defer C.free(unsafe.Pointer(param))
|
|
||||||
runExtensionCallback(name, function, param)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
func sendToInflux(data string) {
|
|
||||||
|
|
||||||
fields := strings.Split(data, ",")
|
|
||||||
|
|
||||||
host := fields[0]
|
|
||||||
token := fields[1]
|
|
||||||
org := fields[2]
|
|
||||||
bucket := fields[3]
|
|
||||||
profile := fields[4]
|
|
||||||
locality := fields[5]
|
|
||||||
metric := fields[6]
|
|
||||||
value := fields[7]
|
|
||||||
|
|
||||||
int_value, err := strconv.Atoi(value)
|
|
||||||
client := influxdb2.NewClient(host, token)
|
|
||||||
writeAPI := client.WriteAPI(org, bucket)
|
|
||||||
|
|
||||||
p := influxdb2.NewPoint(metric,
|
|
||||||
map[string]string{"profile": profile, "locality": locality},
|
|
||||||
map[string]interface{}{"count": int_value},
|
|
||||||
time.Now())
|
|
||||||
|
|
||||||
// write point asynchronously
|
|
||||||
writeAPI.WritePoint(p)
|
|
||||||
|
|
||||||
// Flush writes
|
|
||||||
writeAPI.Flush()
|
|
||||||
|
|
||||||
defer client.Close()
|
|
||||||
|
|
||||||
f, err := os.OpenFile("a3metrics.log",
|
|
||||||
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
//logger := log.New(f, "", log.LstdFlags)
|
|
||||||
//logger.Println(err)
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
func sendToInflux(data string) {
|
|
||||||
|
|
||||||
fields := strings.Split(data, ",")
|
|
||||||
|
|
||||||
host := fields[0]
|
|
||||||
token := fields[1]
|
|
||||||
org := fields[2]
|
|
||||||
bucket := fields[3]
|
|
||||||
profile := fields[4]
|
|
||||||
locality := fields[5]
|
|
||||||
metric := fields[6]
|
|
||||||
value := fields[7]
|
|
||||||
|
|
||||||
|
|
||||||
int_value, err := strconv.Atoi(value)
|
|
||||||
client := influxdb2.NewClient(host, token)
|
|
||||||
writeAPI := client.WriteAPI(org, bucket)
|
|
||||||
|
|
||||||
p := influxdb2.NewPoint(metric,
|
|
||||||
map[string]string{"profile": profile, "locality": locality},
|
|
||||||
map[string]interface{}{"count": int_value},
|
|
||||||
time.Now())
|
|
||||||
|
|
||||||
// write point asynchronously
|
|
||||||
writeAPI.WritePoint(p)
|
|
||||||
|
|
||||||
// Flush writes
|
|
||||||
writeAPI.Flush()
|
|
||||||
|
|
||||||
defer client.Close()
|
|
||||||
|
|
||||||
f, err := os.OpenFile("a3metrics.log",
|
|
||||||
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
//logger := log.New(f, "", log.LstdFlags)
|
|
||||||
//logger.Println(err)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//export goRVExtension
|
|
||||||
func goRVExtension(output *C.char, outputsize C.size_t, input *C.char) {
|
|
||||||
// Return by default through ExtensionCallback arma handler the result
|
|
||||||
if extensionCallbackFnc != nil {
|
|
||||||
go callBackExample()
|
|
||||||
} else {
|
|
||||||
// Return a result through callextension Arma call
|
|
||||||
temp := fmt.Sprintf("Rangermetrics: %s", C.GoString(input))
|
|
||||||
result := C.CString(temp)
|
|
||||||
defer C.free(unsafe.Pointer(result))
|
|
||||||
var size = C.strlen(result) + 1
|
|
||||||
if size > outputsize {
|
|
||||||
size = outputsize
|
|
||||||
}
|
|
||||||
|
|
||||||
go sendToInflux(C.GoString(input))
|
|
||||||
|
|
||||||
C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), size)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//export goRVExtensionRegisterCallback
|
|
||||||
func goRVExtensionRegisterCallback(fnc C.extensionCallback) {
|
|
||||||
extensionCallbackFnc = fnc
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {}
|
|
||||||
@@ -1,195 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
/*
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "extensionCallback.h"
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
|
|
||||||
)
|
|
||||||
|
|
||||||
var extensionCallbackFnc C.extensionCallback
|
|
||||||
|
|
||||||
func runExtensionCallback(name *C.char, function *C.char, data *C.char) C.int {
|
|
||||||
return C.runExtensionCallback(extensionCallbackFnc, name, function, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
//export goRVExtensionVersion
|
|
||||||
func goRVExtensionVersion(output *C.char, outputsize C.size_t) {
|
|
||||||
result := C.CString("Version 1.2.3")
|
|
||||||
defer C.free(unsafe.Pointer(result))
|
|
||||||
var size = C.strlen(result) + 1
|
|
||||||
if size > outputsize {
|
|
||||||
size = outputsize
|
|
||||||
}
|
|
||||||
C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), size)
|
|
||||||
}
|
|
||||||
|
|
||||||
//export goRVExtensionArgs
|
|
||||||
func goRVExtensionArgs(output *C.char, outputsize C.size_t, input *C.char, argv **C.char, argc C.int) int {
|
|
||||||
var offset = unsafe.Sizeof(uintptr(0))
|
|
||||||
var out []string
|
|
||||||
for index := C.int(0); index < argc; index++ {
|
|
||||||
out = append(out, C.GoString(*argv))
|
|
||||||
argv = (**C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(argv)) + offset))
|
|
||||||
}
|
|
||||||
temp := fmt.Sprintf("Function: %s nb params: %d params: %s!", C.GoString(input), argc, out)
|
|
||||||
|
|
||||||
// Return a result to Arma
|
|
||||||
result := C.CString(temp)
|
|
||||||
defer C.free(unsafe.Pointer(result))
|
|
||||||
var size = C.strlen(result) + 1
|
|
||||||
if size > outputsize {
|
|
||||||
size = outputsize
|
|
||||||
}
|
|
||||||
C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), size)
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
func callBackExample() {
|
|
||||||
name := C.CString("arma")
|
|
||||||
defer C.free(unsafe.Pointer(name))
|
|
||||||
function := C.CString("funcToExecute")
|
|
||||||
defer C.free(unsafe.Pointer(function))
|
|
||||||
// Make a callback to Arma
|
|
||||||
for i := 0; i < 3; i++ {
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
param := C.CString(fmt.Sprintf("Loop: %d", i))
|
|
||||||
defer C.free(unsafe.Pointer(param))
|
|
||||||
runExtensionCallback(name, function, param)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
func sendToInflux(data string) {
|
|
||||||
|
|
||||||
fields := strings.Split(data, ",")
|
|
||||||
|
|
||||||
host := fields[0]
|
|
||||||
token := fields[1]
|
|
||||||
org := fields[2]
|
|
||||||
bucket := fields[3]
|
|
||||||
profile := fields[4]
|
|
||||||
locality := fields[5]
|
|
||||||
metric := fields[6]
|
|
||||||
value := fields[7]
|
|
||||||
|
|
||||||
int_value, err := strconv.Atoi(value)
|
|
||||||
client := influxdb2.NewClient(host, token)
|
|
||||||
writeAPI := client.WriteAPI(org, bucket)
|
|
||||||
|
|
||||||
p := influxdb2.NewPoint(metric,
|
|
||||||
map[string]string{"profile": profile, "locality": locality},
|
|
||||||
map[string]interface{}{"count": int_value},
|
|
||||||
time.Now())
|
|
||||||
|
|
||||||
// write point asynchronously
|
|
||||||
writeAPI.WritePoint(p)
|
|
||||||
|
|
||||||
// Flush writes
|
|
||||||
writeAPI.Flush()
|
|
||||||
|
|
||||||
defer client.Close()
|
|
||||||
|
|
||||||
f, err := os.OpenFile("a3metrics.log",
|
|
||||||
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
//logger := log.New(f, "", log.LstdFlags)
|
|
||||||
//logger.Println(err)
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
func sendToInflux(data string) {
|
|
||||||
|
|
||||||
fields := strings.Split(data, ",")
|
|
||||||
|
|
||||||
host := fields[0]
|
|
||||||
token := fields[1]
|
|
||||||
org := fields[2]
|
|
||||||
bucket := fields[3]
|
|
||||||
profile := fields[4]
|
|
||||||
locality := fields[5]
|
|
||||||
metric := fields[6]
|
|
||||||
value := fields[7]
|
|
||||||
|
|
||||||
|
|
||||||
client := influxdb2.NewClient(host, token)
|
|
||||||
writeAPI := client.WriteAPI(org, bucket)
|
|
||||||
// int_value, err := strconv.Atoi(value)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
p := influxdb2.NewPoint(metric,
|
|
||||||
map[string]string{"profile": profile, "locality": locality},
|
|
||||||
map[string]interface{}{"count": int_value},
|
|
||||||
time.Now())
|
|
||||||
|
|
||||||
// write point asynchronously
|
|
||||||
writeAPI.WritePoint(p)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Flush writes
|
|
||||||
writeAPI.Flush()
|
|
||||||
|
|
||||||
defer client.Close()
|
|
||||||
|
|
||||||
f, err := os.OpenFile("a3metrics.log",
|
|
||||||
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
//logger := log.New(f, "", log.LstdFlags)
|
|
||||||
//logger.Println(err)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//export goRVExtension
|
|
||||||
func goRVExtension(output *C.char, outputsize C.size_t, input *C.char) {
|
|
||||||
// Return by default through ExtensionCallback arma handler the result
|
|
||||||
if extensionCallbackFnc != nil {
|
|
||||||
go callBackExample()
|
|
||||||
} else {
|
|
||||||
// Return a result through callextension Arma call
|
|
||||||
temp := fmt.Sprintf("Rangermetrics: %s", C.GoString(input))
|
|
||||||
result := C.CString(temp)
|
|
||||||
defer C.free(unsafe.Pointer(result))
|
|
||||||
var size = C.strlen(result) + 1
|
|
||||||
if size > outputsize {
|
|
||||||
size = outputsize
|
|
||||||
}
|
|
||||||
|
|
||||||
go sendToInflux(C.GoString(input))
|
|
||||||
|
|
||||||
C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), size)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//export goRVExtensionRegisterCallback
|
|
||||||
func goRVExtensionRegisterCallback(fnc C.extensionCallback) {
|
|
||||||
extensionCallbackFnc = fnc
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {}
|
|
||||||
195
armaMission.go
195
armaMission.go
@@ -1,195 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
/*
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "extensionCallback.h"
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
|
|
||||||
)
|
|
||||||
|
|
||||||
var extensionCallbackFnc C.extensionCallback
|
|
||||||
|
|
||||||
func runExtensionCallback(name *C.char, function *C.char, data *C.char) C.int {
|
|
||||||
return C.runExtensionCallback(extensionCallbackFnc, name, function, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
//export goRVExtensionVersion
|
|
||||||
func goRVExtensionVersion(output *C.char, outputsize C.size_t) {
|
|
||||||
result := C.CString("Version 1.2.3")
|
|
||||||
defer C.free(unsafe.Pointer(result))
|
|
||||||
var size = C.strlen(result) + 1
|
|
||||||
if size > outputsize {
|
|
||||||
size = outputsize
|
|
||||||
}
|
|
||||||
C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), size)
|
|
||||||
}
|
|
||||||
|
|
||||||
//export goRVExtensionArgs
|
|
||||||
func goRVExtensionArgs(output *C.char, outputsize C.size_t, input *C.char, argv **C.char, argc C.int) int {
|
|
||||||
var offset = unsafe.Sizeof(uintptr(0))
|
|
||||||
var out []string
|
|
||||||
for index := C.int(0); index < argc; index++ {
|
|
||||||
out = append(out, C.GoString(*argv))
|
|
||||||
argv = (**C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(argv)) + offset))
|
|
||||||
}
|
|
||||||
temp := fmt.Sprintf("Function: %s nb params: %d params: %s!", C.GoString(input), argc, out)
|
|
||||||
|
|
||||||
// Return a result to Arma
|
|
||||||
result := C.CString(temp)
|
|
||||||
defer C.free(unsafe.Pointer(result))
|
|
||||||
var size = C.strlen(result) + 1
|
|
||||||
if size > outputsize {
|
|
||||||
size = outputsize
|
|
||||||
}
|
|
||||||
C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), size)
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
func callBackExample() {
|
|
||||||
name := C.CString("arma")
|
|
||||||
defer C.free(unsafe.Pointer(name))
|
|
||||||
function := C.CString("funcToExecute")
|
|
||||||
defer C.free(unsafe.Pointer(function))
|
|
||||||
// Make a callback to Arma
|
|
||||||
for i := 0; i < 3; i++ {
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
param := C.CString(fmt.Sprintf("Loop: %d", i))
|
|
||||||
defer C.free(unsafe.Pointer(param))
|
|
||||||
runExtensionCallback(name, function, param)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
func sendToInflux(data string) {
|
|
||||||
|
|
||||||
fields := strings.Split(data, ",")
|
|
||||||
|
|
||||||
host := fields[0]
|
|
||||||
token := fields[1]
|
|
||||||
org := fields[2]
|
|
||||||
bucket := fields[3]
|
|
||||||
profile := fields[4]
|
|
||||||
locality := fields[5]
|
|
||||||
metric := fields[6]
|
|
||||||
value := fields[7]
|
|
||||||
|
|
||||||
int_value, err := strconv.Atoi(value)
|
|
||||||
client := influxdb2.NewClient(host, token)
|
|
||||||
writeAPI := client.WriteAPI(org, bucket)
|
|
||||||
|
|
||||||
p := influxdb2.NewPoint(metric,
|
|
||||||
map[string]string{"profile": profile, "locality": locality},
|
|
||||||
map[string]interface{}{"count": int_value},
|
|
||||||
time.Now())
|
|
||||||
|
|
||||||
// write point asynchronously
|
|
||||||
writeAPI.WritePoint(p)
|
|
||||||
|
|
||||||
// Flush writes
|
|
||||||
writeAPI.Flush()
|
|
||||||
|
|
||||||
defer client.Close()
|
|
||||||
|
|
||||||
f, err := os.OpenFile("a3metrics.log",
|
|
||||||
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
//logger := log.New(f, "", log.LstdFlags)
|
|
||||||
//logger.Println(err)
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
func sendToInflux(data string) {
|
|
||||||
|
|
||||||
fields := strings.Split(data, ",")
|
|
||||||
|
|
||||||
host := fields[0]
|
|
||||||
token := fields[1]
|
|
||||||
org := fields[2]
|
|
||||||
bucket := fields[3]
|
|
||||||
profile := fields[4]
|
|
||||||
locality := fields[5]
|
|
||||||
metric := fields[6]
|
|
||||||
value := fields[7]
|
|
||||||
|
|
||||||
|
|
||||||
client := influxdb2.NewClient(host, token)
|
|
||||||
writeAPI := client.WriteAPI(org, bucket)
|
|
||||||
// int_value, err := strconv.Atoi(value)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
p := influxdb2.NewPoint(metric,
|
|
||||||
map[string]string{"profile": profile, "locality": locality},
|
|
||||||
map[string]interface{}{"count": int_value},
|
|
||||||
time.Now())
|
|
||||||
|
|
||||||
// write point asynchronously
|
|
||||||
writeAPI.WritePoint(p)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Flush writes
|
|
||||||
writeAPI.Flush()
|
|
||||||
|
|
||||||
defer client.Close()
|
|
||||||
|
|
||||||
f, err := os.OpenFile("a3metrics.log",
|
|
||||||
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
//logger := log.New(f, "", log.LstdFlags)
|
|
||||||
//logger.Println(err)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//export goRVExtension
|
|
||||||
func goRVExtension(output *C.char, outputsize C.size_t, input *C.char) {
|
|
||||||
// Return by default through ExtensionCallback arma handler the result
|
|
||||||
if extensionCallbackFnc != nil {
|
|
||||||
go callBackExample()
|
|
||||||
} else {
|
|
||||||
// Return a result through callextension Arma call
|
|
||||||
temp := fmt.Sprintf("Rangermetrics: %s", C.GoString(input))
|
|
||||||
result := C.CString(temp)
|
|
||||||
defer C.free(unsafe.Pointer(result))
|
|
||||||
var size = C.strlen(result) + 1
|
|
||||||
if size > outputsize {
|
|
||||||
size = outputsize
|
|
||||||
}
|
|
||||||
|
|
||||||
go sendToInflux(C.GoString(input))
|
|
||||||
|
|
||||||
C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), size)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//export goRVExtensionRegisterCallback
|
|
||||||
func goRVExtensionRegisterCallback(fnc C.extensionCallback) {
|
|
||||||
extensionCallbackFnc = fnc
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {}
|
|
||||||
@@ -77,10 +77,10 @@ typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern __declspec(dllexport) void goRVExtensionVersion(char* output, size_t outputsize);
|
extern void goRVExtensionVersion(char* output, size_t outputsize);
|
||||||
extern __declspec(dllexport) GoInt goRVExtensionArgs(char* output, size_t outputsize, char* input, char** argv, int argc);
|
extern GoInt goRVExtensionArgs(char* output, size_t outputsize, char* input, char** argv, int argc);
|
||||||
extern __declspec(dllexport) void goRVExtension(char* output, size_t outputsize, char* input);
|
extern void goRVExtension(char* output, size_t outputsize, char* input);
|
||||||
extern __declspec(dllexport) void goRVExtensionRegisterCallback(extensionCallback fnc);
|
extern void goRVExtensionRegisterCallback(extensionCallback fnc);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
13
go.mod
13
go.mod
@@ -1,5 +1,12 @@
|
|||||||
module github.com/7cav/a3-fone-home
|
module arma.go
|
||||||
|
|
||||||
go 1.16
|
go 1.20
|
||||||
|
|
||||||
require github.com/influxdata/influxdb-client-go/v2 v2.6.0
|
require github.com/influxdata/influxdb-client-go/v2 v2.12.3
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/deepmap/oapi-codegen v1.8.2 // indirect
|
||||||
|
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 // indirect
|
||||||
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
|
golang.org/x/net v0.7.0 // indirect
|
||||||
|
)
|
||||||
|
|||||||
17
go.sum
17
go.sum
@@ -1,12 +1,10 @@
|
|||||||
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
|
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/deepmap/oapi-codegen v1.6.0 h1:w/d1ntwh91XI0b/8ja7+u5SvA4IFfM0UNNLmiDR1gg0=
|
|
||||||
github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M=
|
|
||||||
github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU=
|
github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU=
|
||||||
github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw=
|
github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw=
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||||
github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4=
|
|
||||||
github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4=
|
github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4=
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs=
|
github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs=
|
||||||
@@ -14,10 +12,8 @@ github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34
|
|||||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||||
github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y=
|
github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y=
|
||||||
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||||
github.com/influxdata/influxdb-client-go/v2 v2.3.0 h1:4YzLWRsPUoHuQYWDwPoybaJjN01e0/k0AIQO85ymCKI=
|
github.com/influxdata/influxdb-client-go/v2 v2.12.3 h1:28nRlNMRIV4QbtIUvxhWqaxn0IpXeMSkY/uJa/O/vC4=
|
||||||
github.com/influxdata/influxdb-client-go/v2 v2.3.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8=
|
github.com/influxdata/influxdb-client-go/v2 v2.12.3/go.mod h1:IrrLUbCjjfkmRuaCiGQg4m2GbkaeJDcuWoxiWdQEbA0=
|
||||||
github.com/influxdata/influxdb-client-go/v2 v2.6.0 h1:bIOaGTgvvv1Na2hG+nIvqyv7PK2UiU2WrJN1ck1ykyM=
|
|
||||||
github.com/influxdata/influxdb-client-go/v2 v2.6.0/go.mod h1:Y/0W1+TZir7ypoQZYd2IrnVOKB3Tq6oegAQeSVN/+EU=
|
|
||||||
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7wlPfJLvMCdtV4zPulc4uCPrlywQOmbFOhgQNU=
|
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7wlPfJLvMCdtV4zPulc4uCPrlywQOmbFOhgQNU=
|
||||||
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo=
|
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
@@ -37,11 +33,13 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
|
|||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
|
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
||||||
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||||
@@ -52,8 +50,9 @@ golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWP
|
|||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew=
|
|
||||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
|
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
|
||||||
|
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
@@ -79,5 +78,5 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
|
|||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
|||||||
14
makefile
14
makefile
@@ -1,4 +1,12 @@
|
|||||||
build:
|
build:
|
||||||
export GOARCH="amd64"
|
$env:GOARCH="amd64"
|
||||||
export CGO_ENABLED=1
|
$env:CGO_ENABLED=1
|
||||||
go build -o armago.dll -buildmode=c-shared .
|
go build -o RangerMetrics_x64.so -buildmode=c-shared .
|
||||||
|
|
||||||
|
$env:GOARCH = "386"
|
||||||
|
$env:CGO_ENABLED = 1
|
||||||
|
go build -o RangerMetrics.dll -buildmode=c-shared .
|
||||||
|
|
||||||
|
$env:GOARCH = "amd64"
|
||||||
|
$env:CGO_ENABLED = 1
|
||||||
|
go build -o RangerMetrics_x64.dll -buildmode=c-shared .
|
||||||
|
|||||||
Reference in New Issue
Block a user